Ardupilot之Mavros实现Ros节点控制
这部分ros发布的命令话题参考的是PX4固件最基本的Offboard_node节点,命令发布后,能够连接并解锁,但是无法起飞,这里应该是poses发布出去的位置有问题,这里下一步需要继续理解一下。
整个过程有点长,我分成两部分下,先写环境配置相关的,下一篇写如何运行。
Mavros安装
ROS与Mavlink的通信需要通过Mavros,首先进行Mavros的安装。我这里采用二进制简单的安装。参考官网:
https://ardupilot.org/dev/docs/ros-install.html#installing-mavros
装Mavros
sudo apt-get install ros-kinetic-mavros ros-kinetic-mavros-extras
装依赖
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
chmod a+x install_geographiclib_datasets.sh
./install_geographiclib_datasets.sh
装rqt
sudo apt-get install ros-kinetic-rqt ros-kinetic-rqt-common-plugins ros-kinetic-rqt-robot-plugins
测试Mavros
//APM
roslaunch mavros apm.launch
//PX4
roslaunch mavros px4.launch
如果未连接硬件的话,会报如下错误,正常现象:
[FATAL] [1585652051.956903253]: FCU: DeviceError:serial:open: No such file or directory
================================================================================REQUIRED process [mavros-1] has died!
process has finished cleanly
log file: /home/myz/.ros/log/0cbdfa56-7335-11ea-9dc7-68071588544b/mavros-1*.log
Initiating shutdown!
================================================================================
修改Mavros
Ros的运行,也是参考官网内容:
https://ardupilot.org/dev/docs/ros-sitl.html
因为模拟仿真,所以要将默认串口进行修改:
这一步是将apm.launch复制到launch中,方便修改。
mkdir launch
cd launch
roscp mavros apm.launch apm.launch
修改
gedit apm.launch
把default中的串口改成如下:
udp://127.0.0.1:14551@14555
运行Mavros
首先运行Ardupilot的SITL仿真
sim_vehicle.py -v ArduCopter -f gazebo-iris -m --mav10 --map --console -I0
然后运行Gazebo的模拟仿真
gazebo --verbose worlds/iris_arducopter_runway.world
然后进入launch,运行apm.launch
roslaunch apm.launch
成功会进入一个类似roscore的进程,提示飞机类型及相关信息后,表示连接成功。
评论(0)
您还未登录,请登录后发表或查看评论