New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random values when sending mode switch request in SITL with ROS2 #27018
Comments
Can you supply which version or commit hash you were running of ArduPilot to reproduce this? "Rover" is not a version. |
@arshPratap Do you have a chance to look at this bug? |
Just an update. I moved to HW and the error is not present when using serial there. |
Running the agentros2 run micro_ros_agent micro_ros_agent udp4 -p 2019 -r dds_xrce_profile.xml Plane ./Tools/autotest/sim_vehicle.py -v Plane --map --console --enable-dds If you call arming right away, before the vehicle is booted, it properly reports a failure. ros2 service call /ap/arm_motors ardupilot_msgs/srv/ArmMotors "{arm: true}" If you call it later once it's properly initialized, it reports a success. For plane, you can set the mode to 4, and it switches mode correctly. ros2 service call /ap/mode_switch ardupilot_msgs/srv/ModeSwitch "{mode: 4}" I tested modes 1-9. All work. 9 gets rejected, with the current mode reported as 8, and the logs show "AP: No such mode 9" Copter ./Tools/autotest/sim_vehicle.py -v Plane --map --console --enable-dds Requesting all the mode changes works as expected.
Rover logs
ConclusionI can't reproduce on SITL. Please re-open if you can provide some steps like this to reproduce, otherwise I suspect it's an issue in your code. |
Bug report
Issue details
’m currently in the process of setting up a ROS2 environment to communicate with Pixhawk 6x. For the moment, I’m using SITL to test things before going to HW. So far, the AP_DDS works apart from the ROS2 services.
Arm Motors works (arm throttle SUCCESS), but result is never sent back after the request.
Mode Switch has a very weird behavior. When sending an integer mode, let’s say 4 ROVER_MODE_GUIDED, the message will arrive , but a complete random number and it will fail because that (random) mode does not exist.
I have tested this both with python and cpp ROS2 nodes. Bellow you can find my cpp node snipet for the request.
Version
Rover
Platform
[ x ] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine
Airframe type
Rover
Hardware type
SITL
Logs
@Ryanf55
The text was updated successfully, but these errors were encountered: