px4-offboard
px4-offboard copied to clipboard
is there any cpp example of the offboard control?
the offboard_control.cpp from /px4_ros_com/src/examples/offboard could not run well. Could you provide any other cpp offboard example? thank you.
@JetJie It shouldnt be too hard to create a cpp example, but could you explain what the problem is exactly?
the problem is that my previous offboard node is in cpp(microRTPS version). But now it cannot run on the current micro XRCE-DDS version. So I need a cpp offboard example to run my node in the new XRCE-DDS environment.
Another issue is, there is no arm and mode change in your example. So could you tell me how to do that?
I have a working C++ node for a simulation environment (px4_sitl gazebo
) that I can share. It was inspired by this repo. @Jaeyoung-Lim I can make a pull request, how would you like to structure the repo if c++ and python are mixed?
@Ecuashungo It would be great if you could provide a working C++ example.
I have struggled with it for a few days, but my simulated iris drone is always on the ground. I opened the discussion here
I think that problem is somewhere on the PX4 side because the drone is armed and switched to offboard mode. But TrajectorySetpoint
is somehow ignored.
I am starting PX4 (tag v1.13.1
) like this make px4_sitl_rtps gazebo
I just modified ROMFS/px4fmu_common/init.d-posix/px4-rc.rtps
where I had to start microdds_client instead of micrortps_client. microdds_client start -t udp -h 127.0.0.1 -p 8888
It would be great if you could share your PX4 setup.
@Ecuashungo Thanks for sharing in advance and I am looking forward to your CPP example. If there is no progress here. I would like to back v1.13.1 with the rtps version. In rtps version, I also can send commands to Pixhawk 4 Autopilot to arm a real drone. I am afraid that with the new DDS version, there will be some new unknown issues when communicating with the Pixhawk 4 Autopilot.
I have created a pull request with a c++ example: #7
@elanius
I am starting PX4 (tag
v1.13.1
) like thismake px4_sitl_rtps gazebo
I think this is wrong. You need the main
branch for it to work with the new DDS system.
You can have a look at the new README.md, where I have written down everything step by step.
@Ecuashungo you are right, this was my issue. Finally, the drone did takeoff.
@Ecuashungo @Jaeyoung-Lim
Hi thank you for python and cpp example of offboard control.
I tried cpp offboard example node in ros2 humble & Gazebo Garden.
I run just single drone on gazebo with make px4_sitl gz_x500 and run the code, the code runs smoothly.
The problem is that I want to run two drones using the commands below link.
https://docs.px4.io/main/en/sim_gazebo_gz/multi_vehicle_simulation.html
I want to offboard control the first drone, so I changed the topic as shown in the picture below.
However, even if I run the node, the drone does not work. Could you please help?
These are the topics when i spawn the dr
ones.
@hwanyongpark Please provide more details of "not working". How does it fail? Do you have any logs to show? Have you checked if whether you get any data out of each drone even before you run the offboard code?
Sorry for not being detailed.
Let me elaborate on why the code doesn't work.
When I run the code, it works fine, but it doesn't work because the commands aren't being delivered to the drone.
As a result of checking the connection between nodes and topic transmission through rqt_graph, it appears that the connection between the publisher and subscriber is good.
@hwanyongpark I now see that you are using code as part of the PR? Please try manually arming the drone via QGC.
Unfortunately, I haven't tested the code, and it is not yet part of this repository