Skip to content

This repository provides a setup for quadcopter waypoint tracking using ROS2, Gazebo, and PX4. It includes a Docker file to automate the installation of ROS2, Gazebo, PX4, and QGroundControl, along with a development container for streamlined workflow. The system enables the quadcopter to track waypoints defined by the user.

License

Notifications You must be signed in to change notification settings

Srindot/Waypoint_Tracking_in_ROS-PX4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Waypoint Tracking of Quadcopter in PX4-ROS

This repository provides a streamlined platform to perform waypoint tracking in quadcopter in ROS2, Gazebo and PX4.

Software Stack

  • ROS2 Humble
  • Gazebo Harmonic
  • PX4
  • QGroundControl
  • OffboardControl

Trajectory of Quadrotor Navigation

Alt text

Alt text

Installation Guide

1. Clone the Repository

First, clone the project using Git:

bash

git clone https://github.com/Srindot/assignment2_Introduction_To_UAV_Design.git

2. Setup Docker

Ensure Docker is installed and configured on your device.

3. Open the Project in VS Code

  • Launch Visual Studio Code (VS Code) .
  • Open the cloned project folder.

4. Build the Container

  • Press Ctrl + Shift + P to open the Command Palette .

    Alt text

  • Search for "Dev Conatiners: Reopen in Container" and select it to start building the container.

5. Run Tasks Inside the Container

  • Once inside the container, press Ctrl + Shift + P again.

    Alt textt

  • Search for "Run Tasks" , then select and execute the following tasks :

Available Tasks

  • Below are the tasks avaliable

    Alt text

  1. MicroXRCEAgent : Connection to ROS2 and PX4
  2. PX4 SITL : To start up PX4 with gazebo gui
  3. QGroundControl : To launch QGroundControl
  4. Sensor Combined Listener : To echo gyro readings and acceleration in all three axis
  5. Offboard Control : To arm the vehicle and publish waypoint for quadcopter to track

Manual Installation (If you choose to run on terminal)

First pull the image: Open a terminal and run the following command

docker pull ghcr.io/srindot/rosgzpx4

This is going to take some time.

Create a container instance from the pulled image with the name as myros:

xhost +local:docker && docker run -it \
  --name myros \
  --privileged \
  --user rosusr \
  -e DISPLAY=$DISPLAY \
  -e PULSE_SERVER=unix:/run/user/$(id -u)/pulse/native \
  --volume=/run/user/$(id -u)/pulse/native:/run/user/$(id -u)/pulse/native \
  --device /dev/snd \
  --group-add audio \
  --net=host \
  --volume /tmp/.X11-unix:/tmp/.X11-unix \
  --volume /home/$(whoami)/.Xauthority:/root/.Xauthority:ro \
  ghcr.io/srindot/rosgzpx4:latest

After this command, the container opens up automatically in /bin/bash.

To exit the container :

exit

To stop the container :

docker stop myros

To start the contianer:

docker start myros

To re enter a container:

docker exec -it myros /bin/bash

To delete the container instance:

docker rm -f myros
  1. To launch MicroXRCEAgent: Navigate to a new terminal and run the below command to launch it
   MicroXRCEAgent udp4 -p 8888
  1. To make PX4_sitl, open another terminal and navigate to PX4-Autopilot dir
   cd ~/PX4-Autopilot

Make the PX4_sitl and launch the vehicle gz_x500

   make px4_sitl gz_x500
  1. To launch QGroundControl, Open another terminal and run the following command
   QGroudControl
  1. open a new terminal and source ros2 and local_setup.bash in sensor combined workspace
   cd ~/ws_sensor_combined && source /opt/ros/humble/setup.bash && source install/local_setup.bash

and run the below command to run the sensor combined listener

    ros2 launch px4_ros_com sensor_combined_listener.launch.py
  1. To arm the vehicle and switch it to offoard mode, open a new temrinal source ros2 and local setup by runnig below the command
   cd ~/ws_offboard_control/src && cd .. && source /opt/ros/humble/setup.bash && source install/local_setup.bash

Now run the offboard_control.py file present in the dir

   cd && python3 ~/workspace/offboard_control.py

To set Quadcopter Waypoints

To set the waypoint for the quadcopter to track, navigate to here and set the waypoints in the list.

Need Help? Raise an Issue!

If you encounter any problems or have questions, feel free to raise an issue.

About

This repository provides a setup for quadcopter waypoint tracking using ROS2, Gazebo, and PX4. It includes a Docker file to automate the installation of ROS2, Gazebo, PX4, and QGroundControl, along with a development container for streamlined workflow. The system enables the quadcopter to track waypoints defined by the user.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages