Page 1 of 1

Simple autonomous flight in firmware

Posted: Tue Aug 03, 2021 9:52 am
by jcl
Hey,
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);
    }
   }
I'd really appreciate help that leads to any thrust in the crazyflie.

Re: Simple autonomous flight in firmware

Posted: Wed Aug 04, 2021 2:26 pm
by kimberly
Hi!

Have you checked any of the demo examples for the app layer? Perhaps look at the push demo or wall following demo will give some inspiration.