Skip to content

arjungupta1012/drone_controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements of the repo

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

Downloading and building

cd ~/git && git clone git@github.com:NovoG93/sjtu_drone.git -b ros2
cd ~/ros2_ws/src && ln -s ~/git/sjtu_drone
git clone https://github.com/noshluk2/sjtu_drone.git
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

About

hey!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors