my current plan is to let the Crazyflie (2.1) to a specific position and hover there. I was going through the demos and the firmware itself to figure out how to control the Crazyflie via a firmware app. My first attempt was to use the crtpCommanderHighLevelGoTo() function since it's basically all the functionality I need. However, nothing happened. My current attempt is to use commanderSetSetpoint() as suggested it another thread, but again, the crazyflie doesn't generate any thrust at all and just stands still. Debug outputs work perfectly fine. I am using the LPS with 6 anchors, position estimates seem fine in the cfclient. This is basically my current code:
Code: Select all
static void setHoverSetpoint(setpoint_t *setpoint, float x, float y, float z, float yaw)
{
setpoint->mode.x = modeAbs;
setpoint->mode.y = modeAbs;
setpoint->mode.z = modeAbs;
setpoint->position.x = x;
setpoint->position.y = y;
setpoint->position.z = z;
setpoint->mode.yaw = modeAbs;
setpoint->mode.roll = modeDisable;
setpoint->mode.pitch = modeDisable;
setpoint->attitudeRate.yaw = yaw;
setpoint->velocity_body = false;
}
void appMain()
{
static setpoint_t setpoint;
commanderInit();
setHoverSetpoint(&setpoint, 0.0f, 0.0f, 0.0f, 0.0f); // Python library indicated this would be needed
commanderSetSetpoint(&setpoint, 3);
while(1){
vTaskDelay(50);
setHoverSetpoint(&setpoint, 1.0f, 1.0f, 2.0f, 0.0f);
commanderSetSetpoint(&setpoint, 3);
}
}