Jaeyoung-Lim / px4-offboard

Example of offboard control over microdds using python ROS 2
BSD 3-Clause "New" or "Revised" License
104 stars 51 forks source link

Offboard velocity control #6

Closed E-Olcay closed 10 months ago

E-Olcay commented 1 year ago

I've been working for a couple weeks on tracking of reference velocities (only v_x, v_y, v_z) using Offboard node. Although I checked the example implementation here and some other examples written with cpp, I don't have success. A very interesting thing is that the reference velocity in z direction is tracked well. However, according to the flight review, v_x and v_y are even not received by PX4 although I publish them in the same way as v_z. I should mention that we don't use the updated version of PX4 autopilot and micrortps. I attached a log file. Someone can maybe see what I overlook. I can also post my implementation if it's required. PX4logs.zip

Jaeyoung-Lim commented 1 year ago

I should mention that we don't use the updated version of PX4 autopilot and micrortps. I attached a log file.

If this is the case, your problem is not related to this repository at all, and is a issue with the PX4 firmware: https://github.com/PX4/PX4-Autopilot

However, according to the flight review, v_x and v_y are even not received by PX4 although I publish them in the same way as v_z.

image image image

If this is the case, I think there is something wrong with the implementation of how you publish vx and vy. I would say the vehicle is behaving as how it is commanded, and is behaving as expected.

How are you sending your offboard setpoints?

E-Olcay commented 1 year ago

v_x and v_y are published via TrajectorySetpoint (px4_msgs.msg -> float32 vx, float32 vy, float32 vz). An example reference velocity is e.g.; [5.0, 0.0, 0.0] In OffboardControlMode, I set msg. velocity to True and the rest to False. In TrajectorySetpoint(), msg.x, msg.y, and msg.z are all set to float("NaN") in offboard node. After the agent reaches an altitude of 7m with 3m/s, all velocities are set to zero and Offboard control is activated.

Jaeyoung-Lim commented 1 year ago

@E-Olcay How are you sending the setpoints? Are you using the microdds bridge? Why is vz set properly and not vx and vy?

In any case, I dont think this issue us related to this repository

E-Olcay commented 1 year ago

@E-Olcay How are you sending the setpoints? Are you using the microdds bridge? Why is vz set properly and not vx and vy?

We use microRTPS bridge. That's a good question, that I cannot answer yet:)

Jaeyoung-Lim commented 1 year ago

If you are using the microRTPS bridge, I would check the message definitions if they are compatible. The microRTPS has been removed from PX4 now, so better to transition to the microdds bridge (which this repository is based on)