visnet-docker
August 11, 2023 · View on GitHub
Docker files needed to build images for visnet/px4_sitl simulation in ROS2 and Gazebo
The ./work directory setup
run ./get_src.sh to clone each repo and add AbuDhabi model to px4 gz world (probably will set up submodules soon)
work/
┣ px4/
┣ ros2_ws/
┃ ┗ src/
┃ ┣ px4_msgs/
┃ ┣ ros_gz/
┃ ┗ visnet/
┗ .gitignore
Build and run
To build the image
docker compose build
To run multiple drones
./run_dev.sh
To access the shell of each service, in two different terminals run
Terminal 1: docker exec -u user -it visnet-visnet_1-1 terminator
Terminal 2: docker exec -u user -it visnet-visnet_2-1 terminator
To start px4_sitl and ros2 offboard control, split each terminator into 3 panels and run
-
cd px4 && make px4_sitlto build px4_sitl first. (This only need to be built once in one of the container shells)
PX4_SYS_AUTOSTART=4001 ./build/px4_sitl_default/bin/px4 -i 1to start px4_sitl instance 1 with x500 in gz-garden.
In the other container shell start with-i 2 -
MicroXRCEAgent udp4 -p 8888to start DDS agent for communication with ROS2\ -
cd ros2_ws && colcon buildto build ros2 packages neccessary for px4-ros-gz communications
thenpython3 ros2_ws/src/visnet/scripts/offboard_control.pyto start the offboard control example.
Environment Variables
PX4_GZ_MODELName of the px4 vehicle model to spawn in gzPX4_GZ_MODEL_POSESpawn pose of the vehicle model, must used withPX4_GZ_MODELPX4_MICRODDS_NSNamespace assigned to the sitl vehicle, normally associated with px4 instances, but can be set mannuallyROS_DOMAIN_IDSeparate each container into its own domain (Is it still necessary since each SITL instance has a unique namespace?)