当前位置:   article > 正文

Jetson的mavros使用offboard模式,终端按键控制无人机飞行_jetson 控制无人机

jetson 控制无人机

基于Promethues根据wiki配置好之后可以实现使用终端控制,起飞;降落;前后左右飞行;上升下降左转右转;

开始我基于仿真测试实机不成功,是因为某个运行节点没有打开,仔细看gazebo.launch文件里仿真部分还加载了一个sitl.launch文件,它里面启动了相关节点。

仿真

终端1:make px4_sitl gazebo

终端2:roslaunch my_px4.launch

实机

修改mavros的fcu_url为/dev/ttyTHS1,然后运行

sudo chmod 777 /dev/ttyTHS1

roslaunch my_px4.launch

  1. <launch>
  2. <!-- 启动MAVROS -->
  3. <!-- 不同机载电脑,注意修改fcu_url至正确的端口号及波特率 -->
  4. <node pkg="mavros" type="mavros_node" name="mavros" output="screen">
  5. <!-- 与飞控连接方式,需要配置 -->
  6. <param name="fcu_url" value="udp://:14540@127.0.0.1:14557" />
  7. <param name="gcs_url" value="" />
  8. <param name="target_system_id" value="1" />
  9. <param name="target_component_id" value="1" />
  10. <rosparam command="load" file="$(find prometheus_experiment)/config/mavros_config/px4_pluginlists.yaml" />
  11. <rosparam command="load" file="$(find prometheus_experiment)/config/mavros_config/px4_config.yaml" />
  12. </node>
  13. <!-- Spawn vehicle model -->
  14. <!-- https://github.com/ros-simulation/gazebo_ros_pkgs/blob/kinetic-devel/gazebo_ros/scripts/spawn_model -->
  15. <!-- 初始位置 -->
  16. <arg name="x" default="0.0"/>
  17. <arg name="y" default="0.0"/>
  18. <arg name="z" default="0.2"/>
  19. <arg name="R" default="0.0"/>
  20. <arg name="P" default="0.0"/>
  21. <arg name="Y" default="0.0"/>
  22. <!-- TF transform -->
  23. <include file="$(find prometheus_gazebo)/launch_basic/tf_transform.launch">
  24. <arg name="x" value="$(arg x)"/>
  25. <arg name="y" value="$(arg y)"/>
  26. <arg name="z" value="$(arg z)"/>
  27. </include>
  28. <!-- 启动Prometheus代码 -->
  29. <!-- run the px4_pos_estimator.cpp -->
  30. <arg name="input_source" default="2"/>
  31. <arg name="rate_hz" default="30"/>
  32. <node pkg="prometheus_control" type="px4_pos_estimator" name="px4_pos_estimator" output="screen">
  33. <!-- 定位数据输入源 0 for vicon, 1 for 激光SLAM, 2 for gazebo ground truth, 3 for T265 -->
  34. <param name="input_source" value="$(arg input_source)" />
  35. <param name="rate_hz" value="$(arg rate_hz)" />
  36. <param name="offset_x" value="$(arg x)" />
  37. <param name="offset_y" value="$(arg y)" />
  38. <param name="offset_z" value="$(arg z)" />
  39. </node>
  40. <node pkg="prometheus_control" type="px4_sender" name="px4_sender" output="screen">
  41. <rosparam command="load" file="$(find prometheus_gazebo)/config/prometheus_control_config/px4_sender.yaml"/>
  42. </node>
  43. <!-- run the ground_station.cpp -->
  44. <node pkg="prometheus_station" type="ground_station" name="ground_station" output="screen" launch-prefix="gnome-terminal --tab --">
  45. </node>
  46. <!-- run the ground_station_msg.cpp -->
  47. <node pkg="prometheus_station" type="ground_station_msg" name="ground_station_msg" output="screen" launch-prefix="gnome-terminal --tab --">
  48. </node>
  49. <!-- run the terminal_control.cpp -->
  50. <node pkg="prometheus_control" type="terminal_control" name="terminal_control" output="screen" launch-prefix="gnome-terminal --">
  51. <rosparam command="load" file="$(find prometheus_gazebo)/config/prometheus_control_config/terminal_control.yaml" />
  52. </node>
  53. </launch>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/981568
推荐阅读
相关标签
  

闽ICP备14008679号