X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=modules%2Fdevices%2Frobot%2Ftrajectory_manager%2Ftrajectory_manager_core.c;h=6b3c172967865f91880e4d24d986889f44bb4785;hp=8ea3bd87a623bc6b29feb7fc925c0dc7cfec9c76;hb=HEAD;hpb=0abf8acb258a098ee79cbbdb71f284693489d678 diff --git a/modules/devices/robot/trajectory_manager/trajectory_manager_core.c b/modules/devices/robot/trajectory_manager/trajectory_manager_core.c index 8ea3bd8..6b3c172 100644 --- a/modules/devices/robot/trajectory_manager/trajectory_manager_core.c +++ b/modules/devices/robot/trajectory_manager/trajectory_manager_core.c @@ -318,8 +318,25 @@ uint8_t trajectory_distance_finished(struct trajectory *traj) * distance. */ uint8_t trajectory_finished(struct trajectory *traj) { - return trajectory_angle_finished(traj) && - trajectory_distance_finished(traj); + uint8_t flags, ret; + // uint8_t ret2; + + IRQ_LOCK(flags); + ret = trajectory_distance_finished(traj) && + trajectory_angle_finished(traj); + IRQ_UNLOCK(flags); + +#if 0 + /* XXX THIS IS A VERY BAD WORKAROUND (fix a race) */ + IRQ_LOCK(flags); + ret2 = trajectory_distance_finished(traj) && + trajectory_angle_finished(traj); + IRQ_UNLOCK(flags); + + return ret && ret2; +#else + return ret; +#endif } /** return true if traj is nearly finished */ @@ -1055,7 +1072,8 @@ int8_t trajectory_clitoid(struct trajectory *traj, if (calc_clitoid(traj, x, y, a_rad, alpha_deg, beta_deg, R_mm, Vd, traj->a_acc, d_inter_mm, &Aa, &Va, &remain) < 0) { - DEBUG(E_TRAJECTORY, "%s() calc_clitoid returned an error"); + DEBUG(E_TRAJECTORY, "%s() calc_clitoid returned an error", + __FUNCTION__); return -1; }