Lighthouse yaw at takeoff
Posted: Sat Feb 29, 2020 3:40 pm
Hello,
I have custom code running on a crazyflie that is equiped with both the loco and the flow v2 decks. However I'm running into issues during takeoff where the crazyflie rotates to a seemingly random yaw angle (Before takeoff its facing towards positive x). When the crazyflie is then navigating to an absolute coordiante position it initially flies into the wrong direction before gradually correcting the yaw angle by itself. After that everything works as expected, but in the process of correcting itself it's often crashing into the wall. I'm now wondering how to enable lighthouse yaw to automatically rotate to yaw=0 during takeoff. Thanks!
This is the code I'm running for takeoff:
I have custom code running on a crazyflie that is equiped with both the loco and the flow v2 decks. However I'm running into issues during takeoff where the crazyflie rotates to a seemingly random yaw angle (Before takeoff its facing towards positive x). When the crazyflie is then navigating to an absolute coordiante position it initially flies into the wrong direction before gradually correcting the yaw angle by itself. After that everything works as expected, but in the process of correcting itself it's often crashing into the wall. I'm now wondering how to enable lighthouse yaw to automatically rotate to yaw=0 during takeoff. Thanks!
This is the code I'm running for takeoff:
Code: Select all
static void setHoverSetpoint(setpoint_t *setpoint, float vx, float vy, float z)
{
setpoint->mode.x = modeVelocity;
setpoint->mode.y = modeVelocity;
setpoint->mode.z = modeAbs;
setpoint->velocity.x = vx;
setpoint->velocity.y = vy;
setpoint->position.z = z;
setpoint->velocity_body = true;
}
static void takeoff()
{
for (int i=0; i<30; i++)
{
setHoverSetpoint(&setpoint, 0.0f, 0.0f, 0.4f);
commanderSetSetpoint(&setpoint, 3);
vTaskDelay(M2T(100));
}
}