Giter VIP home page Giter VIP logo

sjtu_drone's Introduction

sjtu_drone

Humble Rolling

sjtu_drone is a quadrotor simulation program forked from tum_simulator, developed using ROS + Gazebo.

The acronym 'sjtu' stands for Shanghai Jiao Tong University. This package has been used in the past for testing algorithms for the UAV contest at SJTU

Requirements

This package is tested with ROS 2 Humble version (Ubuntu 22.04) and Gazebo 11.

Downloading and building

cd ~/git && git clone [email protected]:NovoG93/sjtu_drone.git -b ros2
cd ~/ros2_ws/src && ln -s ~/git/sjtu_drone
cd .. && rosdep install -r -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO && colcon build --packages-select-regex sjtu*

To use the playground.world file (as depicted below) make sure to install the common gazebo models, for more see the Readme in sjtu_drone_description.

Drone Topics

Sensors

The folowing sensors are currently implemented:

  • ~/front_camera/image_raw [sensor_msgs/msg/Image]
  • ~/bottom/image_raw [sensor_msgs/msg/Image]
  • ~/sonar [sensor_msgs/msg/Range]
  • ~/imu [sensor_msgs/msg/Imu]

Control

The following control topics are currently subscribed to:

  • ~/cmd_vel [geometry_msgs/msg/Twist]: Steers the drone
  • ~/land [std_msgs/msg/Empty]: Lands the drone
  • ~/takeoff [std_msgs/msg/Empty]: Starts the drone
  • ~/posctrl [std_msgs/msg/Bool]: Switch to position control
  • ~/dronevel_mode [std_msgs/msg/Bool]: Change the drone steering method
  • ~/reset [std_msgs/msg/Empty]: Resets the drone

Ground Truth

The following ground truth topics are currently published:

  • ~/gt_acc [geometry_msgs/msg/Twist]: ground truth acceleration
  • ~/gt_pose [geometry_msgs/msg/Pose]: ground truth pose
  • ~/gt_vel [geometry_msgs/msg/Twist]: ground truth velocity

Run

Docker

  1. Start the docker container:
    bash run_docker.sh
  2. Connect to docker container to takeoff / land drone:
    1. docker container exec -it sjtu_drone 'ros2 topic pub /drone/takeoff std_msgs/msg/Empty {} --once'
    2. docker container exec -it sjtu_drone 'ros2 topic pub /drone/land std_msgs/msg/Empty {} --once'

ROS 2 Source Installation

  1. Start gazebo, spawn drone, open teleop in xterm window, and open rviz:
    ros2 launch sjtu_drone_bringup sjtu_drone_bringup.launch.py
  2. Takeoff drone:
    ros2 topic pub /drone/takeoff std_msgs/msg/Empty {} --once
  3. Move drone: (use teleop window)
  4. Land drone:
    ros2 topic pub /drone/land std_msgs/msg/Empty {} --once

You should see the following:

Gazebo

For more see the following image: rosgraph

PID Params

The parameters of the PID controller that controls the drone and the motion noise can be changed by adapting the file sjtu_drone.urdf.xacro:

<plugin name='simple_drone' filename='libplugin_drone.so'>
    <bodyName>base_link</bodyName>
    <rosNamespace>drone</rosNamespace>
    <imuTopic>imu</imuTopic>
    <rollpitchProportionalGain>10.0</rollpitchProportionalGain>
    <rollpitchDifferentialGain>5.0</rollpitchDifferentialGain>
    <rollpitchLimit>0.5</rollpitchLimit>
    <yawProportionalGain>2.0</yawProportionalGain>
    <yawDifferentialGain>1.0</yawDifferentialGain>
    <yawLimit>1.5</yawLimit>
    <velocityXYProportionalGain>5.0</velocityXYProportionalGain>
    <velocityXYDifferentialGain>2.3</velocityXYDifferentialGain>
    <velocityXYLimit>2</velocityXYLimit>
    <velocityZProportionalGain>5.0</velocityZProportionalGain>
    <velocityZIntegralGain>0.0</velocityZIntegralGain>
    <velocityZDifferentialGain>1.0</velocityZDifferentialGain>
    <velocityZLimit>-1</velocityZLimit>
    <positionXYProportionalGain>1.1</positionXYProportionalGain>
    <positionXYDifferentialGain>0.0</positionXYDifferentialGain>
    <positionXYIntegralGain>0.0</positionXYIntegralGain>
    <positionXYLimit>5</positionXYLimit>
    <positionZProportionalGain>1.0</positionZProportionalGain>
    <positionZDifferentialGain>0.2</positionZDifferentialGain>
    <positionZIntegralGain>0.0</positionZIntegralGain>
    <positionZLimit>-1</positionZLimit>
    <maxForce>30</maxForce>
    <motionSmallNoise>0.05</motionSmallNoise>
    <motionDriftNoise>0.03</motionDriftNoise>
    <motionDriftNoiseTime>5.0</motionDriftNoiseTime>
</plugin>

Known Issues

  • No ROS communication between docker container and host
  • Change of ROS namespace not working automatically for plugin_drone when changed in spawn_drone.py
    • TODO: Change to gazebo_ros::Node::SharedPtr

sjtu_drone's People

Contributors

novog93 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.