-
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
How to use mavros2 #1718
Comments
What version do you use? Try to build current ros2 branch, as it might have some important fixes. Firmware usually tells something when it rejects to fly, so maybe you have some |
@dzywater If you uninstall the mavros_extras package that will fix that error printing repeatedly, and I assume you likely don't need the plugins for your implementation (at least not yet): EDIT: See bottom block for an actual fix for the issue I just figured out (3) As for your commands, its possible that you giving the lat and long coordinates for takeoff is causing it to reject the command for being out of range of the drone. You can work on adjusting this by looking at the output of the gps: Or you can just leave those out, which will use the drone's current location from the gps to set takeoff location, though you need absolute altitude rather than relative to home for this command I believe: With regard to your request for some tutorials, I can pass along some of the other commands I've worked out for doing some useful stuff.
This ended up being a lot more involved and in-depth than I expected it to be, but I hope it helps put you on the right path to learning how to do this stuff yourself. Note that the above Edit:
If you try to use this directly you'll need to set the correct IP address for fcu_url. Thanks to @Vicidel in #1689 for setting me in the right direction to figure this issue out |
@Mark-Beaty please note that new python library may hide some interactions with rclpy: https://github.com/mavlink/mavros/blob/ros2/mavros/mavros/__init__.py#L17 - mavros.Client (node class) provides interfaces to params, missions and others.
|
Also note that plugin allow and deny lists only needed for UAS node (by default = |
All the plugins now runs inside UAS as a subnode. So each plugin has it's own parameter server, it's own resources. |
@vooon and @dzywater thank you so much for this thread (only thread that is getting ros2 mavros setup for SITL and potentially any system). Several questions related to porting over to ros2.
Sorry to tap on this thread to ask these questions! |
|
Hi. I keep going into loops through the issues related to ros2. Is there a working example of a launch file for PX4? |
I find this thread really important, as little resource exist talking about how to use mavros2 in ros2. Could you please help me connect mavros2 and my Ardupilot? Here is what I did:
|
@ZhongmouLi I recommend running mavros with the mavros launchfile, since it includes all the required params. You can find an example of a launchfile for adupilot here: https://github.com/kas-lab/suave/blob/835b8a0fa5a24fed66a031ccb7eaf36b92de42c7/suave/launch/simulation.launch.py#L34
|
@Rezenders Thanks so much for your reply. But I am using ros2 foxy. Do you mean I run mavros instead of mavros2 in foxy? |
Hi @ZhongmouLi, I am not really sure which mavros version is out for foxy. But what I am doing for ros2 Humble is that I am getting mavros from this github repo instead of the version in apt. The version in the repo is working better for me (at least the last time I tried). |
@Rezenders Thanks so much, after reading your reply. I finally found the solution. In fact, it should be |
Also you can create the config file, which names mavros_param.yaml, then run the command:
|
hello everyone, in ROS, i can use |
I don't know how to use mavros2 and want to get some tutorials like "how to connect/arm/land/takeoff/mission/offboard".
Currently in PX4 gazebo simulation
(1) ros2 run mavros mavros_node --ros-args --param fcu_url:=udp://:14540@
Teminal shows: [ERROR] [1646107611.895603244] [mavros.odometry]: ODOM: Ex: Could not find a connection between 'map' and 'base_link_frd' because they are not part of the same tree.Tf has two or more unconnected trees.
(2) ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool '{value: True}'
Iris drone can arm despite (1)'s error.
(3)ros2 service call /mavros/cmd/takeoff mavros_msgs/srv/CommandTOL '{min_pitch: 10, yaw: 10, latitude: 8, longitude: 47, altitude: 550}'
Iris drone don't takeoff.
The text was updated successfully, but these errors were encountered: