-
Notifications
You must be signed in to change notification settings - Fork 993
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
ROS2: port mavros launch #1564
Comments
What would need to be done here? |
We need to port node lanuch and variants for PX4 and APM. Possibly we may use component loader instead of mavros_node. |
@Vicidel probably i misinterpret your question. It is possible to run ether combined mavros_node or composition nodes without launch. They just helps to manage set of nodes, parameters and remappings. You can run combined node thus way (params file provides settings, see docs):
|
Hello, I'm working on this, I've succesfully ported node.launch to ROS2, right now doing tests with Pixhawk 4 with ArduPilot but without plugin.yaml and config.yaml as I don't know which plugins/parameters are ported to ROS2. |
Plugin lists should be the same, except that black/white checked to allow/deny lists. As for parameters it's harder, because with new parameter protocol each plugin has it's own node. |
Hello, this is blocking our ROS2 development, unfortunately, do you have an ETA for tackling the issue? Thanks! |
I just ported node.launch as I had to switch back to ros1. If you want I can PR that. |
I have also manually ported |
thanks for the pointer, @JosepBC. @Rainerino , would you be so kind to share your code? perhaps we could try to tackle it together? |
@eliabruni Yeah, of course, I am new to ROS2 and had to face quite a steep learning curve coming from ROS, would love to have some pointers! Currently, mavros can run with no problem (I tested most of the nodes manually by echo or request them, and nodes show up on rqt_graph. Connect and echo mavros_node with Ardupilot 4.1.2 and PX4 1.12.3, both work "fine" (some minor but annoying problems, see below) Here are the problems so far:
|
Here are the changes:
(assume you are using simulator) cd my_ws/src/my_pkg/launch
ros2 launch px4.launch fcu_url:="udp://:14550@" (please change include file path. I didn't include these in a project, so the path is hardcoded relative path) <!-- change this to your own workspace, or mavros -->
<include file="$(find-pkg-prefix my_ws)/launch/node.launch"> px4.launch <launch>
<!-- vim: set ft=xml noet : -->
<!-- example launch script for PX4 based FCU's -->
<arg name="fcu_url" default="/dev/ttyACM0:57600" />
<arg name="gcs_url" default="" />
<arg name="tgt_system" default="1" />
<arg name="tgt_component" default="1" />
<arg name="log_output" default="screen" />
<arg name="fcu_protocol" default="v2.0" />
<arg name="respawn_mavros" default="false" />
<!-- <push-ros-namespace namespace=""/> -->
<include file="$(find-pkg-prefix dy_mavros)/../../src/dy_mavros/launch/node.launch">
<arg name="fcu_url" value="$(var fcu_url)" />
<arg name="gcs_url" value="$(var gcs_url)" />
<arg name="tgt_system" value="$(var tgt_system)" />
<arg name="tgt_component" value="$(var tgt_component)" />
<arg name="log_output" value="$(var log_output)" />
<arg name="fcu_protocol" value="$(var fcu_protocol)" />
<arg name="respawn_mavros" value="$(var respawn_mavros)" />
<arg name="config_yaml" value="$(find-pkg-prefix dy_mavros)/../../src/dy_mavros/launch/px4_config.yaml"/>
<arg name="pluginlists_yaml" value="$(find-pkg-prefix dy_mavros)/../../src/dy_mavros/launch/px4_pluginlists.yaml"/>
</include>
</launch>
node.launch <launch>
<arg name="fcu_url" />
<arg name="gcs_url" />
<arg name="tgt_system" />
<arg name="tgt_component" />
<arg name="config_yaml" />
<arg name="pluginlists_yaml" />
<arg name="log_output" default="log" />
<arg name="fcu_protocol" default="v2.0" />
<arg name="respawn_mavros" default="false" />
<node pkg="mavros" exec="mavros_node">
<!-- <node pkg="mavros" exec="mavros_node" name="mavros" required="$(eval not respawn_mavros)" output="$(var log_output)"> -->
<param name="fcu_url" value="$(var fcu_url)" />
<param name="gcs_url" value="$(var gcs_url)" />
<!-- <param name="uas_url" value="dy_px4" /> -->
<param name="tparamet_system_id" value="$(var tgt_system)" />
<param name="tparamet_component_id" value="$(var tgt_component)" />
<param name="fcu_protocol" value="$(var fcu_protocol)" />
<param from="$(var config_yaml)" />
<param from="$(var pluginlists_yaml)" />
</node>
</launch>
px4_config.yaml
|
@Rainerino that yaml wouldn't work, unfortunately it's impossible to make 1-to-1 migration as ROS2 param can only be flat list. node:
tf:
option: false In most cases you'd have to check sources of each plugin to get new names. For example sys_status uses new names and instead of /mavros/sys:
ros_parameters:
conn_timeout: 10.0
min_voltage: 10.0
disable_diag: false
heartbeat_rate: 1.0
heartbeat_mav_type: ONBOARD_CONTROLLER And other thing that each plugin is a sub-node to UAS node. |
And one more thing, distance_sensor uses a hack to workaround flatness and predefinition of params, a /mavros/distance_sensor:
ros_parameters:
base_frame_id: base_link
config: |-
hrlv_ez4_pub:
id: 0
frame_id: "hrlv_ez4_sonar"
orientation: PITCH_270 # RPY:{0.0, 270.0, 0.0} - downward-facing
field_of_view: 0.0 # XXX TODO
send_tf: true
sensor_position: {x: 0.0, y: 0.0, z: -0.1} |
@vooon Thank you very much for the pointer! I will give it another try, any suggestions on how to test if the parameters are loaded correctly? I would imagine using |
@Rainerino i think you can dump parameters for each plugin and compare them to source. Something like that command (not tested):
|
thanks for sharing @Rainerino ! am glad you already got some good pointers; will give it a try too and see what I can get out of it. |
Is there currently any workaround for launching apm.launch in ROS2? |
hi, I'm really interested! is there currently any workaround or a working solution? |
Running:
I'm currently working on writing a python launch file for this but the params file still needs to change... |
Can confirm I am getting the same error. |
Done. |
Specifically:
|
@vooon What's the official status regarding the node.launch file? Is it enough to change the node name or is it necessary to change namespace as well? |
I think better to use namespaces. Also you can experiment with single-Router - multiple-UAS setup. |
We could try to continue use of xml, but probably launch.py would be preferable.
The text was updated successfully, but these errors were encountered: