Possible to plan and execute mission onboard?

I’ve been reading everywhere and cannot find any useful/promising information on this topic. I see a few several year old posts about it being in the works but no roadmap or progress. I’ve had great success using ROS and MAVROS for offboard mission planning and execution, but would like to do this onboard. Through offboard its all message publishing/subscribing but using similar tactics in my onboard program does nothing. I post to topics seemingly similar to the the ones I’ve used with ROS and I can “listener” to them showing that the messages have been posted but the uav doesn’t react them. I’m looking into generating mission waypoints and pushing them into the dataman mission location, but that seems like too much work by comparison, and doesn’t allow for navigation in the local frame. If anyone can point me in the right direction that’d be awesome. Thanks in advance for any potential assistance with this matter.

If you want to generate mission waypoints, you could do that without ROS with the Dronecode SDK.
Check the mission API:
https://sdk.dronecode.org/en/api_reference/classdronecode__sdk_1_1_mission.html
https://sdk.dronecode.org/en/api_reference/classdronecode__sdk_1_1_mission_item.html

Note that local missions are not supported yet:

1 Like

Thanks for the answer. Not quite what I had hoped but I appreciate the help none the less!

1 Like

Hi, I’m interested in offboard mission planning and execution. I can only plan a mission in QGroundControl, upload it to vehicle and switch the vehicle to mission mode by using ROS and MAVROS. I want to change the vehicle’s trajectory based on vision or other information while it’s executing waypoint mission. Is it possible to do this? Would you like to give me some suggestions? Thanks in advance.

Let me ping @Jaeyoung-Lim. He might be able to direct you to the MAVLink/MAVROS messages that you could use for this.

@Kumaron Mavros provides a interface to set and retreive missions with the waypoint plugin. You can refer to the mavros wiki for more infromation. I can imagine you would want services something like

~mission/pull (mavros_msgs/WaypointPull)
Request update waypoint list.
~mission/push (mavros_msgs/WaypointPush)
Send new waypoint table.
~mission/clear (mavros_msgs/WaypointClear)
Clear mission on FCU.
1 Like

And what about the messages to use to avoid something?

Thank you for your reply.
I used the waypoint plugin to set mission items and clear them, and I could set the drone to mission mode using ROS.
I want to change the trajectory between waypoints when the drone is in mission mode and executing mission. How can I do this?
Thanks in advance.

Thank you for your help!

@Kumaron You can also use the trajectory_msg on mavros.

The avoidance repo can be a good reference on how to do this

Thank you.
And I want to know is it possible to swtich AUTO.MISSION mode to OFFBOARD mode in ROS while drone is in mission mode and still executing mission?

@Kumaron you can switch mode from ROS. There is a mavros setMode service for that. However once you switch to offboard the mission plan won’t progress anymore.

@mrivi Thank you for your reply. If I switch the drone from AUTO.MISSION to AUTO.LOITER using setMode service, is it possible to switch back to AUTO.MISSION and continue the mission plan?

@kumaron yes, you can