#define HOKUYO_CENTER_OFFSET_M (HOKUYO_CENTER_OFFSET_MM/1000.0)
#define ODOMETRY_WHEEL_RADIUS_MM 30
#define ODOMETRY_WHEEL_RADIUS_M (ODOMETRY_WHEEL_RADIUS_MM/1000.0)
-#define ODOMETRY_ROTATION_RADIUS_MM (245/2)
+#define ODOMETRY_ROTATION_RADIUS_MM (246/2)
#define ODOMETRY_ROTATION_RADIUS_M (ODOMETRY_ROTATION_RADIUS_MM/1000.0)
/**
if (x>PLAYGROUND_WIDTH_M) x=PLAYGROUND_WIDTH_M;
if (y<0) y=0;
if (y>PLAYGROUND_HEIGHT_M) y=PLAYGROUND_HEIGHT_M;
- ROBOT_LOCK(est_pos_uzv);
- robot.est_pos_uzv.x = x;
- robot.est_pos_uzv.y = y;
- robot.est_pos_uzv.phi = phi;
- init_ekf_flag = true; // Tell kalman filter to reinitialize itself
+
+ ROBOT_LOCK(est_pos_indep_odo);
+ robot.est_pos_indep_odo.x = x;
+ robot.est_pos_indep_odo.y = y;
+ robot.est_pos_indep_odo.phi = phi;
+ ROBOT_UNLOCK(est_pos_indep_odo);
ROBOT_LOCK(est_pos_odo);
robot.est_pos_odo.x = x;
robot.ref_pos.y = y;
robot.ref_pos.phi = phi;
ROBOT_UNLOCK(ref_pos);
-
- ROBOT_UNLOCK(est_pos_uzv);
-
}
/**
pthread_mutex_init(&robot.lock_ref_pos, &mattr);
pthread_mutex_init(&robot.lock_est_pos_uzv, &mattr);
pthread_mutex_init(&robot.lock_est_pos_odo, &mattr);
- pthread_mutex_init(&robot.lock_est_pos_indep_odo, &mattr); // FIXME add MV
+ pthread_mutex_init(&robot.lock_est_pos_indep_odo, &mattr);
pthread_mutex_init(&robot.lock_meas_angles, &mattr);
pthread_mutex_init(&robot.lock_joy_data, &mattr);
pthread_mutex_init(&robot.lock_disp, &mattr);
dright = ((instance->right - robot.odo_data.right) >> 8) * c;
dtang = (dleft + dright) / 2.0;
- dphi = (dright - dleft) / (2.0*ROBOT_ROTATION_RADIUS_M);
+ dphi = (dright - dleft) / (2.0*ODOMETRY_ROTATION_RADIUS_M);
ROBOT_LOCK(est_pos_indep_odo);
double a = robot.est_pos_indep_odo.phi;
/* Where we are at the begining? */
switch (FSM_EVENT) {
case EV_ENTRY:
- FSM_TIMER(2000);
+ FSM_TIMER(10);
break;
case EV_TIMER:
FSM_TRANSITION(rectangle);
void follow_rectangle()
{
double rectangle[][2] = { { 0.5, 0.5 },
- { 1.2, 0.5 },
- { 1.2, 1.2 },
- { 0.5, 1.2 }};
+ { 1.5, 0.5 },
+ { 1.5, 1.5 },
+ { 0.5, 1.5 }};
static bool backward = false;
struct TrajectoryConstraints tc = trajectoryConstraintsDefault;
- tc.maxv *= 0.2;
- tc.maxacc *= 0.2;
- tc.maxomega *= 0.2;
+ tc.maxv = 1.0;
+ tc.maxacc = 0.5;
+ tc.maxomega = 2;
+ tc.maxe = 0.200;
/* Allocate new trajectory */
if (!backward)
if (i<3) {
robot_trajectory_add_point_trans(rectangle[j][0], rectangle[j][1]);
} else {
- robot_trajectory_add_final_point_trans(rectangle[j][0], rectangle[j][1], NO_TURN());
+ robot_trajectory_add_final_point_trans(rectangle[j][0], rectangle[j][1], TURN(0));
}
}
//backward = !backward;
follow_rectangle();
break;
case EV_MOTION_DONE:
- FSM_TRANSITION(turn);
+ //FSM_TRANSITION(turn);
FSM_TRANSITION(wait);
break;
default: