Hello, I am seeking to create an actuator_controls listener over a ROS2 bridge, similar to #96. How do I specify that I want to listen to a specific topic (actuator_controls_0) within the message actuator_controls? (But not the topic, actuator_controls, which I see is never published.)
I have updated urtps_bridge_topics.yaml on both sides of the bridge:
- msg: actuator_controls_0
send: true
However, when I make px4_sitl_rtps jmavsim I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/<nsimon>/PX4-Autopilot/msg/actuator_controls_0.msg'
Am I making the correct edit to the .yaml file? Where should I specify that I would like to bridge to the actuator_controls_0 topic specifically, within the actuator_controls message?
This seems to match the convention with vehicle_odometry and other messages with a base. However, when I run ./build_ros2_workspace.bash this yields the error:
The multi-topic message base type 'ActuatorControls' does not exist.
No problem.
I haven’t run into the problem you mentioned.
Have you tried cleaning your workspace first?
If that doesn’t work, I tend to use colcon build command instead of scripts, maybe that could help:
Hi @aksuns, one follow-up question. When writing a ROS2 publisher/subscriber, do you happen to know the correct syntax when referring to a ‘base’ vs. ‘msg’? I am writing an actuator_controls_0 listener based on the sensor_combined listener example.
In the code, if I refer to: msg::ActuatorControls0, there is a build error: ‘ActuatorControls0’ is not a member of ‘px4_msgs::msg’; did you mean ‘ActuatorControls’?. But if I replace all with ActuatorControls, then the node doesn’t subscribe to the actuator_controls_0 message!
Do you happen to know the right syntax for specifying:
- base: ActuatorControls
msg: ActuatorControls0`
in the ROS2 publisher subscriber? I’ve pasted the full code below for reference (based on sensor_combined_listener).
Hello again,
I think the problem here is that you used #include <px4_msgs/msg/actuator_controls.hpp> which lets you use only px4_msgs::msg::ActuatorControls not px4_msgs::msg::ActuatorControls0.
Changing it to #include <px4_msgs/msg/actuator_controls0.hpp> should solve your problem.