mavros 使用经验记录

本文介绍了如何使用Pixhawk飞控硬件板配合Mavros软件进行集成配置的过程。主要内容包括选择合适的固件版本、解决连接问题、配置参数、启动步骤及必要的调试技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 我用的飞控硬件板是pixhawk,用missionplanner刷的fight stack是apm的最新版本3.4。amp对mavros支持不是特别好,如果合适还是用px4的flight stack 比较好,没那么折腾。

在使用mavros之前,需要对飞控进行一些基本的设置,可以参考这位兄弟的文章:

http://blog.csdn.net/iracer/article/details/52718346

如果Mission Planner报 Bad gyro health,可能是usb口供电不足,接上电池就可以了。


使用mavros使用的接线示意图,连接电脑就用一个usb转串口模块接上就可以了。

接着在mission planner设置飞控的一些参数,如下:

 下载mavros,并进行编译,将apm.launch里面的波特率改成921600,就可以启动了,我是将launch改了一下,添加了rviz,下面是我的apm_test.launch:

<launch>
	<!-- vim: set ft=xml noet : -->
	<!-- example launch script for ArduPilotMega based FCU's -->

	<arg name="fcu_url" default="/dev/ttyUSB0:921600" />
	<arg name="gcs_url" default="" />
	<arg name="tgt_system" default="1" />
	<arg name="tgt_component" default="1" />
	<arg name="log_output" default="screen" />

	<include file="$(find mavros)/launch/node.launch">
		<arg name="pluginlists_yaml" value="$(find mavros)/launch/apm_pluginlists.yaml" />
		<arg name="config_yaml" value="$(find mavros)/launch/apm_config.yaml" />

		<arg name="fcu_url" value="$(arg fcu_url)" />
		<arg name="gcs_url" value="$(arg gcs_url)" />
		<arg name="tgt_system" value="$(arg tgt_system)" />
		<arg name="tgt_component" value="$(arg tgt_component)" />
		<arg name="log_output" value="$(arg log_output)" />
	</include>

	<node pkg="tf2_ros" type="static_transform_publisher" name="tf_world2fcu" args="0 0 0 0 0 0 fcu world" />
	<node pkg="rviz" type="rviz" name="rviz" args="-d $(find test_mavros)/launch/apm/apm_imu_test.rviz" required="True" />

</launch>

启动后,记得要用下面命令改一下飞控的广播频率,不然是收不到topic数据的。。

rosservice call /mavros/set_stream_rate 0 50 1



对于apm 固件,需要使用guided模式,因此需要有GPS信号才可以,有一些local_postion topic,是必须在有gps信号的时候才会有数据。


解锁命令:

rosrun mavros mavsafety arm

改飞控模式命令:

rosrun mavros mavsys mode -c GUIDED




记住下面的网址,有一些参考。

http://ardupilot.org/dev/docs/companion-computer-nvidia-tx1.html

https://erlerobotics.gitbooks.io/erlerobot/en/mavlink/ros/mavros.html

https://github.com/mavlink/mavros/issues/275

http://answers.ros.org/question/207097/how-to-send-velocity-to-pixhawk-with-mavros/

下面是mavros的作者,里面他回答了一些问题

http://answers.ros.org/users/10566/vooon/


评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值