plan_go_to Requires an Extra t Parameter in cffirmware, Causing Compatibility Issues #585
-
Hello! I’m running into an issue using the goTo function in Crazyswarm2, specifically when calling plan_go_to in the Crazyflie simulation firmware. Whenever I ran a script that uses the GoTo service, for example,
I get this error message:
I noticed that in the definition of GoTo.srv, the parameters required does not include 't':
however, in the definition of plan_to_go from cffirmware, the plan_go_to function require this parameter 't': int plan_go_to_from(struct planner *p, const struct traj_eval *curr_eval, bool relative, bool linear, struct vec hover_pos, float hover_yaw, float duration, float t)
{
if (relative) {
hover_pos = vadd(hover_pos, curr_eval->pos);
hover_yaw += curr_eval->yaw;
}
// compute the shortest possible rotation towards 0
float curr_yaw = normalize_radians(curr_eval->yaw);
hover_yaw = normalize_radians(hover_yaw);
float delta_yaw = shortest_signed_angle_radians(curr_yaw, hover_yaw);
float goal_yaw = curr_yaw + delta_yaw;
if (linear) {
struct vec vel = vdiv(vsub(hover_pos,curr_eval->pos), duration);
float omz = delta_yaw/duration;
piecewise_plan_7th_order_no_jerk(&p->planned_trajectory, duration,
curr_eval->pos, curr_yaw, vel, omz, vzero(),
hover_pos, goal_yaw, vel, omz, vzero());
}
else {
piecewise_plan_7th_order_no_jerk(&p->planned_trajectory, duration,
curr_eval->pos, curr_yaw, curr_eval->vel, curr_eval->omega.z, curr_eval->acc,
hover_pos, goal_yaw, vzero(), 0, vzero());
}
p->reversed = false;
p->state = TRAJECTORY_STATE_FLYING;
p->type = TRAJECTORY_TYPE_PIECEWISE;
p->planned_trajectory.t_begin = t;
p->trajectory = &p->planned_trajectory;
return 0;
}
int plan_go_to(struct planner *p, bool relative, bool linear, struct vec hover_pos, float hover_yaw, float duration, float t)
{
struct traj_eval setpoint = plan_current_goal(p, t);
return plan_go_to_from(p, &setpoint, relative, linear, hover_pos, hover_yaw, duration, t);
} Questions:
Any help would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This commit in the firmware broke API compatibility: bitcraze/crazyflie-firmware@bac4b10. For now the workaround is to use a firmware version before that commit. We'll have to adjust Software-in-the-loop interface for the new API. |
Beta Was this translation helpful? Give feedback.
This commit in the firmware broke API compatibility: bitcraze/crazyflie-firmware@bac4b10.
For now the workaround is to use a firmware version before that commit. We'll have to adjust Software-in-the-loop interface for the new API.