-
Notifications
You must be signed in to change notification settings - Fork 986
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
fix px4 launch file for ROS2 #1834
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overally looks good. Can you please do the same for apm?
mavros/launch/px4_config.yaml
Outdated
laser_1_sub: | ||
subscriber: true | ||
id: 3 | ||
orientation: PITCH_270 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That plugin now parses yaml from string parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see
OK, I will try to do the same for apm. |
I don't find any use for |
Yes, bridge is not needed anymore, because you have router. |
OK,I have removed them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried to use this launch?
I just have an idea, that params file not fully loaded.
Do you know, is it possible to define namespace for params?
Just if you run several copies of the UAS to control few drones, it might be convenient to have same config.
mavros/launch/px4_config.yaml
Outdated
send: false # send TF? | ||
frame_id: "map" # TF frame_id | ||
global_frame_id: "earth" # TF earth frame_id | ||
child_frame_id: "base_link" # TF child_frame_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ROS2 parameters are flat, so i had to change names. Please have a look:
mavros/mavros/src/plugins/global_position.cpp
Lines 90 to 107 in 6e86500
// tf subsection | |
node_declare_and_watch_parameter( | |
"tf.send", false, [&](const rclcpp::Parameter & p) { | |
tf_send = p.as_bool(); | |
}); | |
node_declare_and_watch_parameter( | |
"tf.frame_id", "map", [&](const rclcpp::Parameter & p) { | |
tf_frame_id = p.as_string(); | |
}); | |
// The global_origin should be represented as "earth" coordinate frame (ECEF) (REP 105) | |
node_declare_and_watch_parameter( | |
"tf.global_frame_id", "earth", [&](const rclcpp::Parameter & p) { | |
tf_global_frame_id = p.as_string(); | |
}); | |
node_declare_and_watch_parameter( | |
"tf.child_frame_id", "base_link", [&](const rclcpp::Parameter & p) { | |
tf_child_frame_id = p.as_string(); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see.
mavros/launch/px4_config.yaml
Outdated
p1: {x: 1.0, y: 1.0, z: 1.0} | ||
p2: {x: -1.0, y: -1.0, z: -1.0} | ||
# # safety_area | ||
/mavros/safety_area: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safety area is quite deprecated feature. I've removed it from ROS2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see.
orientation: PITCH_270 | ||
/mavros/distance_sensor: | ||
ros__parameters: | ||
config: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what i mean. +1
mavros/launch/px4_config.yaml
Outdated
mocap_transform: true # ~mocap/tf instead of pose | ||
use_vision: false # ~vision (pose) | ||
# origin (default: Zürich) | ||
geo_origin: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mavros/mavros_extras/src/plugins/fake_gps.cpp
Lines 133 to 144 in 6e86500
node_declare_and_watch_parameter( | |
"geo_origin.lat", 47.3667, [&](const rclcpp::Parameter & p) { | |
map_origin.x() = p.as_double(); | |
}); | |
node_declare_and_watch_parameter( | |
"geo_origin.lon", 8.5500, [&](const rclcpp::Parameter & p) { | |
map_origin.y() = p.as_double(); | |
}); | |
node_declare_and_watch_parameter( | |
"geo_origin.alt", 408.0, [&](const rclcpp::Parameter & p) { | |
map_origin.z() = p.as_double(); | |
}); |
So it should look like:
fake_gps:
ros__parameters:
geo_origin.lat: 47.3667
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see.
I have used this launch, but just tested a little. I think is a good idea. That will be really convenient for using multiple drones. |
The plugin mavros/mavros/launch/apm_config.yaml Lines 228 to 232 in a55c747
I can't find the parameters mavros/mavros/launch/px4_config.yaml Lines 232 to 235 in a55c747
Finally, it looks like:
|
2.Remove plugin safety_area in launch parameters file.
Odom have changed a lot, so it's not a surprise that conf outdated. We should use parameters what ROS2 have. mavros/mavros_extras/src/plugins/odom.cpp Lines 67 to 74 in 6e86500
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
Yes, in ROS2 i've implemented idea of splitting mavlink connections and UAS. So if previously you have to run several copies of whole mavros_node, and maybe gcs_nodes, now it utilizes ros2 loadable node classes.
|
I modified px4 launch file for ROS2, and tested it in the simulation environment.