6 Star 35 Fork 12

Peixuan Shu/UAVros

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

UAVros

Introduction

UAVros contains multiple ROS packages for PX4-gazebo simulation and experiment. Test has been made for the following PX4 drone version:

  • v1.11.3
  • v1.12.0-beta3
  • v1.13.3
  • v1.14 (under test)

Environment: ubuntu18.04 or ubuntu 20.04 with ROS1.

Several simulation examples are given in the form of ROS packages under the folder uavros_simulation/:

ROS Module PX4 version Function
ARtagLanding_sitl v1.11.3, v1.12.0-beta3, v1.13.3 Single UAV lands on an AR tag based on the visual servo using downward camera
kcffollow_simulation v1.11.3, v1.12.0-beta3, v1.13.3 Single UAV tracks AR tag using downward camera and KCF tracking algorithm
uavros_uavugv_sitl v1.11.3, v1.12.0-beta3, v1.13.3 Two UAVs fly around the UGV in a spinning circle formation
uavros_wrzf_sitl v1.11.3, v1.12.0-beta3, v1.13.3 Single UAV tracks the preset GPS setpoints and moving UGV based on the color detection using downward camera
uavros_multi_gimbal_sitl v1.13.3, v1.14 Multi-UAV with gimbal cameras cooperatively search and track targets
uavros_gazebo > v1.11.3 Gazebo simulation modules

Install

Clone this project:

cd ~
git clone https://gitee.com/shu-peixuan/UAVros.git
cd UAVros/

Install ROS1 if you don't have it:

# Install ROS noetic for ubuntu20:
sudo ./install_ros_noetic.sh
# Install ROS melodic for ubuntu18:
sudo ./install_ros_melodic.sh

Install dependencies:

# minimal dependencies for ubuntu20:
sudo ./install_dep_minimal_ubuntu20.sh
# minimal dependencies for ubuntu18:
sudo ./install_dep_minimal_ubuntu18.sh
# install numba for KCF tracking (optional):
sudo ./install_dep_kcf_tracking.sh

Install PX4 Autopilot project:

cd ~
git clone https://github.com/PX4/PX4-Autopilot.git
cd PX4-Autopilot
git checkout v1.13.3 # or other version
git submodule update --init --recursive
bash Tools/setup/ubuntu.sh # This step takes some time. Make sure all dependencies are installed successfully!
# Relogin or reboot the computer, then:
make px4_sitl gazebo

Compile UAVros:

cd UAVros/
./compile_all.sh

Add source path in ~/.bashrc:

### Add UAVros package path:
echo "source ~/UAVros/devel/setup.bash" >> ~/.bashrc

### Add px4 path:
# if you use px4 version v1.13 or lower:
echo "
source ~/PX4-Autopilot/Tools/setup_gazebo.bash ~/PX4-Autopilot ~/PX4-Autopilot/build/px4_sitl_default
export ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH:~/PX4-Autopilot
export ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH:~/PX4-Autopilot/Tools/sitl_gazebo
" >> ~/.bashrc

# if you use px4 version v1.14 (untested):
echo "
source ~/PX4-Autopilot/Tools/simulation/gazebo-classic/setup_gazebo.bash ~/PX4-Autopilot ~/PX4-Autopilot/build/px4_sitl_default
export ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH:~/PX4-Autopilot
export ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH:~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic
" >> ~/.bashrc

Usage

UAV landing on AR tag

  1. Launch the sitl simulation:

    roslaunch uavros_artaglanding_sitl singleLanding_sitl.launch
    

    In rqt_image_view, choose image_raw topic.

  2. Open QGroundControl. Click the left-top Q logo -> Vehicle Setup -> Parameters -> search "COM_RCL_EXCEPT" and change it to 7. Otherwise the UAV will activate failsafe return mode as there is no manual remote controller input in simulation (bug in px4 1.13.3).

  3. In QGroundControl, click "Ready To Fly" -> Arm -> Slide the bottom bar to confirm arming. Then click the top mode text and switch into "offboard" mode. Then the drone will takeoff.

  4. Begin tracking and landing:

    rostopic pub /uav0/command std_msgs/Int32 "data: 1"
    

A landing service is also provided in landing_service.cpp for UAV that is in offboard mode and suitable height to call to land. This service is used in uavrover_sitl.launch of "Multi-UAV formation tracking UGV".

img

UAV KCF tracking target

  1. Launch the sitl simulation:

    roslaunch uavros_kcffollow_simulation KCF_track.launch
    
  2. Open QGroundControl. Click the left-top Q logo -> Vehicle Setup -> Parameters -> search "COM_RCL_EXCEPT" and change it to 7. Otherwise the UAV will activate failsafe return mode as there is no manual remote controller input in simulation (bug in px4 1.13.3).

  3. In QGroundControl, click "Ready To Fly" -> Arm -> Slide the bottom bar to confirm arming. Then click the top mode text and switch into "offboard" mode. Then the drone will takeoff. Or you can use the terminal keyboard to send 0 (arm) and 2 (takeoff).

  4. Select the ROI area in the tracking window, then the UAV will begin tracking the target ROI.

img

Multi-UAV formation tracking UGV

  1. Launch the sitl simulation:

    roslaunch uavros_uavugv_sitl uavugv_sitl.launch # (two drones and one racecar)
    roslaunch uavros_uavugv_sitl uavrover_sitl.launch # (two drones and one rover)
    roslaunch uavros_uavugv_sitl uavrover_valley_sitl.launch # (two drones and one rover in valley)
    

    In rqt_image_view, choose image_raw topic of UAVs.

  2. Open QGroundControl. Click the left-top Q logo -> Vehicle Setup -> Parameters -> search "COM_RCL_EXCEPT" and change it to 7. Do this for every UAV! Otherwise the UAV will activate failsafe return mode as there is no manual remote controller input in simulation (bug in px4 1.13.3).

  3. In QGroundControl, click "Ready To Fly" -> Arm -> Slide the bottom bar to confirm arming. Then click the top mode text and switch into "offboard" mode. Repeat for each UAV. Then the drones will takeoff.

  4. Begin tracking and AR tag detection (will stop, return and land on the UGV using the AR tag landing module):

    rostopic pub /cmd std_msgs/Int32 "data: 1" # begin formation
    rostopic pub /cmd std_msgs/Int32 "data: 0" # stop formation
    

    The rover UGV and UAVs simulation video: https://www.bilibili.com/video/BV1U44y1r7ey/

img

img

UAV tracking GPS points and UGV

  1. Launch the sitl simulation:

    roscd uavros_wrzf_sitl/launch/
    ./cam_track_sitl.sh
    
  2. Open QGroundControl. Click the left-top Q logo -> Vehicle Setup -> Parameters -> search "COM_RCL_EXCEPT" and change it to 7. Do this for every UAV! Otherwise the UAV will activate failsafe return mode as there is no manual remote controller input in simulation (bug in px4 1.13.3).

  3. In QGroundControl, click "Ready To Fly" -> Arm -> Slide the bottom bar to confirm arming.

  4. Takeoff -> Fly to the first GPS setpoint -> begin tracking (if lost target for a period, auto fly to the next GPS setpoint defined in config/tracking_param_sitl.yaml)

    rostopic pub /jc_cmd std_msgs/Int32 "data: 0" # UAV wait
    rostopic pub /jc_cmd std_msgs/Int32 "data: 1" # UAV takeoff
    rostopic pub /jc_cmd std_msgs/Int32 "data: 6" # UAV return
    
  5. Move the UGV to see the tracking performance:

    rostopic pub /ugv0/cmd_vel geometry_msgs/Twist "linear:
      x: 1.0
      y: 1.0
      z: 0.0
    angular:
      x: 0.0
      y: 0.0
      z: 0.0" -r 10
    

img

Multi UAV with gimbal cameras

To launch multi-UAV with gimbals, you need to use PX4 v1.14 (under test) or PX4 v1.13.3 with the following modifications:

# If not in px4 v1.13.3, then you should first:
cd ~/PX4-Autopilot
git checkout v1.13.3
git submodule update --init --recursive

# 1. Substitute the gazebo_gimbal_controller_plugin.cpp (a udp_gimbal_port_remote is added to distinguish between gimbals)
roscd uavros_gazebo
cp px4_modification/gazebo_gimbal_controller_plugin.cpp ~/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp
# 2. Add airframes (8001_solo_gimbal with gimbal enabled)
cp -r px4_modification/airframes/* ~/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes/
# 3. Delete px4_sitl_default and remake
cd ~/PX4-Autopilot
rm -r build/px4_sitl_default/
make px4_sitl_default gazebo

Procedures:

  1. Launch the sitl simulation:

    roslaunch uavros_multi_gimbal_sitl multi_gimbal_uav_ugv.launch
    
  2. Open QGroundControl. Click the left-top Q logo -> Vehicle Setup -> Parameters -> search "COM_RCL_EXCEPT" and change it to 7. Do this for every UAV! Otherwise the UAV will activate failsafe return mode as there is no manual remote controller input in simulation (bug in px4 1.13.3).

  3. The states of the gimbals can be controlled and read by:

    # echo gimbal angle of uav0 (imu_angle follows FRD and rotor angle follows the gimbal configuration BRD)
    rostopic echo /uav0/amov_gimbal_ros/gimbal_state
    
    # gimbal angle control of uav0 (angle rate control is invalid):
    rostopic pub /uav0/amov_gimbal_ros/gimbal_control amov_gimbal_sdk_ros/GimbalControl "header:
      seq: 0
      stamp: {secs: 0, nsecs: 0}
      frame_id: ''
    mode: 2
    roll_angle: 0.0
    pitch_angle: 0.0
    yaw_angle: 60.0
    roll_rate: 0.0
    pitch_rate: 0.0
    yaw_rate: 0.0" -r 10
    
    # gimbal image of uav0
    rostopic hz /uav0/amov_gimbal_ros/gimbal_image
    

    The gimbal angle is limited by roll [-45,45], pitch [-90, 30] and yaw [-80, 80] degrees, where the roll and pitch are controlled as inertial angle and yaw as rotor angle.

    imu_angle in the gimbal_state topic follows FRD (forward-right-down) right-hand coordination frame,and the euler angle sequence is RPY (roll-pitch-yaw).

    rotor_angle in the gimbal_state topic follows BRD (back-right-down) right-hand coordination frame,and the rotor angle sequence follows the gimbal construction PRY (pitch-roll-yaw).

  4. You can use QGroundControl to arm and launch vehicle or your mavros scripts to control the UAV flight and gimbals.

  5. Move the UGV to see the tracking performance:

    rostopic pub /ugv0/cmd_vel geometry_msgs/Twist "linear:
      x: 0.5
      y: 0.0
      z: 0.0
    angular:
      x: 0.1
      y: 0.0
      z: 0.0" -r 10
    

img

BSD 3-Clause License Copyright (c) 2021, shupx All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

px4四旋翼无人机控制和编队飞行控制gazebo软件在环仿真。支持单机二维码引导降落、无人机-无人车异构编队搜索、编队跟踪、吊舱仿真等(舒沛玄,北京航空航天大学,shupeixuan@qq.com) 展开 收起
BSD-3-Clause
取消

发行版 (2)

全部
2年前

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shu-peixuan/UAVros.git
git@gitee.com:shu-peixuan/UAVros.git
shu-peixuan
UAVros
UAVros
main

搜索帮助