Skip to content
Snippets Groups Projects
Commit 8b419efa authored by Matthias Grob's avatar Matthias Grob
Browse files

FlightTaskOrbit: fix rotation direction from command

parent 25aa2b9c
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,8 @@ FlightTaskOrbit::~FlightTaskOrbit()
bool FlightTaskOrbit::applyCommandParameters(const vehicle_command_s &command)
{
bool ret = true;
// save previous velocity and roatation direction
float v = fabsf(_v);
bool clockwise = _v > 0;
// commanded radius
......@@ -66,10 +68,11 @@ bool FlightTaskOrbit::applyCommandParameters(const vehicle_command_s &command)
// commanded velocity, take sign of radius as rotation direction
if (PX4_ISFINITE(command.param2)) {
const float v = command.param2 * (clockwise ? 1.f : -1.f);
ret = ret && setVelocity(v);
v = command.param2;
}
ret = ret && setVelocity(v * (clockwise ? 1.f : -1.f));
// TODO: apply x,y / z independently in geo library
// commanded center coordinates
// if(PX4_ISFINITE(command.param5) && PX4_ISFINITE(command.param6)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment