Jaeyoung-Lim / mavros_controllers

Aggressive trajectory tracking using mavros for PX4 enabled vehicles
BSD 3-Clause "New" or "Revised" License
400 stars 164 forks source link

Question about EKF Origin Setting for Offboard Flight Mode Transition #238

Closed Mitchell-Lee-93 closed 9 months ago

Mitchell-Lee-93 commented 10 months ago

Hi Jaeyoung,

I want to say that you've done some amazing work with this code! I've been exploring it for an indoor offboard flight in a real drone.

According to the PX4 documentation (Link), even though local position data is obtained from Vicon, setting the global origin is necessary to establish a global position, a requirement for transitioning the drone into offboard mode. While going through the code, however, it seems like there isn't a part in the code that sends the EKF origin information to PX4.

Could you please clarify how the transition to offboard mode is achieved without the global coordinate being explicitly sent? I might be missing something in the code, or misunderstood the transition to offboard mode.

Thanks in advance for your help and the great work on this project!

Jaeyoung-Lim commented 9 months ago

@Mitchell-Lee-93 Sorry for the late response,

Could you please clarify how the transition to offboard mode is achieved without the global coordinate being explicitly sent? I might be missing something in the code, or misunderstood the transition to offboard mode.

Offboard mode does not need any reference of global position. I think the confusion comes from the fact that auto flight modes (which do not include offboard) are tracking GPS waypoints.

Could you elaborate on why you are trying to use global position estimates

Mitchell-Lee-93 commented 9 months ago

Thank you very much for the clarification Jaeyoung!

To provide more detail, I successfully conducted indoor flights using an Omnicopter. Following this, I attempted to use the MAVROS C++ offboard control example to enable the Omnicopter to follow a predefined trajectory. However, when I tried to switch to offboard mode using the RC stick, I encountered the message, "Switching to mode 'Offboard' currently not possible." Initially, I thought this issue was due to the lack of a global position origin, but now I realize that might not be the case. 🤔

Jaeyoung-Lim commented 9 months ago

To provide more detail, I successfully conducted indoor flights using an Omnicopter.

@Mitchell-Lee-93 Do you have a video? :)

I thought this issue was due to the lack of a global position origin, but now I realize that might not be the case. 🤔

It means that you either don't have a local position estimate, or the offboard control message flags are not sent properly.

Mitchell-Lee-93 commented 9 months ago

I don't have a video of the experiment at the moment, but I'll be sure to share it here as soon as I have one.

Thank you very much for highlighting the potential issues. I'm confident that the system has a valid vision_pose and local position estimate, as it was able to fly in position control mode. Based on your suggestion, I will take a closer look at the offboard control message flags!

Jaeyoung-Lim commented 9 months ago

@Mitchell-Lee-93 If you can share a flight log, would be easier to find what the problem is.

Edit: Similar issue: https://github.com/PX4/PX4-Autopilot/issues/22456

Mitchell-Lee-93 commented 9 months ago

Thank you a lot for your help and advice! I would have kept wasting my time on the global position thing if you haven't pointed it out. I was able to make it fly offboard mode by changing the setpoint topic from '/mavros/setpoint_position/local' to '/mavros/setpoint_raw/local' in MAVROS C++ offboard control example. This is the flight video of 8-figure trajectory tracking while rotating, to check 6 DOF flight capability (Video). Thank you again for the help!

Jaeyoung-Lim commented 9 months ago

@Mitchell-Lee-93 Thank you for the video!

I also have a ros2 implementation specifically for omnidirectional vehicles: https://github.com/Jaeyoung-Lim/px4-manipulation

Let me know if there is any way we can further collaborate :)

Mitchell-Lee-93 commented 9 months ago

That sounds awesome! I'll contact you by email :)