support orbit command in fixed wing mode

Signed-off-by: RomanBapst <bapstroman@gmail.com>

commander: support orbit mode for fixed wings

Signed-off-by: RomanBapst <bapstroman@gmail.com>

FwPositionControl: publish orbit status

Signed-off-by: RomanBapst <bapstroman@gmail.com>

commander:reject orbit mode while doing a vtol transition

Signed-off-by: RomanBapst <bapstroman@gmail.com>

FixedWingPositionControl: explicitly cast waypoint for Orbit status

FixedwingPositionControl: fill missing orbit_status fields

navigator_main: handle reposition/orbit corner cases

- set orbit rotation direction correctly
- send mavlink message when orbit is rejected

FixedWingPositionControl: correctly report rotation direction in orbit_status

navigator: hack to not break orbit while doing altitude changes

Signed-off-by: RomanBapst <bapstroman@gmail.com>

navigator: set cruise throttle for orbit command

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2021-10-25 09:48:27 +02:00
committed by Silvan Fuhrer
parent 93eb0162e5
commit d84b0296d2
7 changed files with 135 additions and 39 deletions
@@ -49,34 +49,40 @@ public:
unsigned get_size() override
{
return _orbit_status_sub.advertised() ? MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
return _orbit_status_subs.advertised() ? MAVLINK_MSG_ID_ORBIT_EXECUTION_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
}
private:
explicit MavlinkStreamOrbitStatus(Mavlink *mavlink) : MavlinkStream(mavlink) {}
uORB::Subscription _orbit_status_sub{ORB_ID(orbit_status)};
uORB::SubscriptionMultiArray<orbit_status_s> _orbit_status_subs{ORB_ID::orbit_status};
bool send() override
{
orbit_status_s orbit_status;
bool updated = false;
if (_orbit_status_sub.update(&orbit_status)) {
mavlink_orbit_execution_status_t msg{};
for (auto &orbit_sub : _orbit_status_subs) {
msg.time_usec = orbit_status.timestamp;
msg.radius = orbit_status.radius;
msg.frame = orbit_status.frame;
msg.x = orbit_status.x * 1e7;
msg.y = orbit_status.y * 1e7;
msg.z = orbit_status.z;
if (orbit_sub.update(&orbit_status)) {
updated = true;
mavlink_orbit_execution_status_t msg_orbit_execution_status{};
mavlink_msg_orbit_execution_status_send_struct(_mavlink->get_channel(), &msg);
msg_orbit_execution_status.time_usec = orbit_status.timestamp;
msg_orbit_execution_status.radius = orbit_status.radius;
msg_orbit_execution_status.frame = orbit_status.frame;
msg_orbit_execution_status.x = orbit_status.x * 1e7;
msg_orbit_execution_status.y = orbit_status.y * 1e7;
msg_orbit_execution_status.z = orbit_status.z;
return true;
mavlink_msg_orbit_execution_status_send_struct(_mavlink->get_channel(), &msg_orbit_execution_status);
// only one subscription should ever be active at any time, so we can exit here
break;
}
}
return false;
return updated;
}
};