ROS功能包|mav_control_rw(基于MPC的无人机轨迹跟踪控制)---gazebo仿真测试
- gazebo仿真测试
gazebo仿真测试
启动gazebo并加载无人机模型
$ roslaunch rotors_gazebo mav.launch mav_name:=firefly
启动 linear mpc 控制器
$ roslaunch mav_linear_mpc mav_linear_mpc_sim.launch mav_name:=firefly
launch启动的节点如下:
<launch>
<arg name="mav_name" default="firefly" />
<arg name="namespace" default="$(arg mav_name)"/>
<group ns="$(arg namespace)">
<node name="mav_linear_mpc" pkg="mav_linear_mpc" type="mav_linear_mpc_node" respawn="true" clear_params="true" output="screen">
<remap from="odometry" to="ground_truth/odometry" />
<rosparam file="$(find mav_linear_mpc)/resources/linear_mpc_$(arg mav_name).yaml" />
<rosparam file="$(find mav_disturbance_observer)/resources/disturbance_observer_$(arg mav_name).yaml"/>
<param name="verbose" value="true" />
<param name="use_rc_teleop" value="false" />
<param name="reference_frame" value="world" />
</node>
<node name="PID_attitude_controller" pkg="mav_lowlevel_attitude_controller" type="mav_pid_attitude_controller_node" respawn="true" clear_params="true" output="screen">
<remap from="odometry" to="ground_truth/odometry" />
<rosparam file="$(find mav_lowlevel_attitude_controller)/resources/PID_attitude_$(arg mav_name).yaml" />
</node>
</group>
</launch>
启动 rqt
打开Plugins菜单中visualization里的Message Publisher,
在topic的下拉菜单中选择/firefly/command/pose
发布的话题名称为/firefly/command/pose即可实现定点控制拉
更改position 的 x y z 的值,就是给无人机发的位置控制指令
然后勾选那个方框把topic发送出去
无人机运动到了目标位置处
整体的运行效果很理想。