On Ubuntu 22.04, ROS2 humble
and Gazebo Harmonic
(gz sim --version
)
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
Gazebo SITL (Software In The Loop)
Run the followings:
make px4_sitl gz_x500
The full syntax to call make with a particular configuration and initialization file is:
make [VENDOR_][MODEL][_VARIANT] [VIEWER_MODEL_DEBUGGER_WORLD]
- VENDOR:
px4
,aerotenna
,airmind
, etc - MODEL: The board model "model":
sitl
,fmu-v2
,fmu-v3
,fmu-v4
,fmu-v5
,navio2
, etc. - VARIANT: particular configurations,Most commonly this is default, and may be omitted.
list of all available CONFIGURATION_TARGET
options:
make list_config_targets
- VIEWER:
gz
,gazebo
,jmavsim
,none
. if you want to launch PX4 and wait for a simulator (jmavsim, Gazebo, Gazebo Classic, or some other simulator). For example,make px4_sitl none_iris
launches PX4 without a simulator (but with the iris airframe).
make px4_sitl jmavsim
-
MODEL: The vehicle model to use (e.g.
iris
(default),rover
,tailsitter
, etc). The environment variable PX4_SIM_MODEL will be set to the selected model -
WORLD: (Gazebo Classic only).
Refs: 1
You can also specify the world using the PX4_GZ_WORLD
environment variable:
PX4_GZ_WORLD=windy make px4_sitl gz_x500
List of some of the avilable vehicles
make px4_sitl gz_x500
make px4_sitl gz_x500_depth
make px4_sitl gz_x500_vision
make px4_sitl gz_x500_lidar
make px4_sitl gz_standard_vtol
make px4_sitl gz_rc_cessna
make px4_sitl gz_advanced_plane
make px4_sitl gz_r1_rover
make px4_sitl gz_rover_ackermann
All vehicle models (and worlds) are included as a submodule from the Gazebo Models Repository repository.
Refs: 1
In this mode PX4 SITL and Gazebo are started separately in their own terminals.
cd ~/workspace/PX4-Autopilot/Tools/simulation/gz/
python simulation-gazebo
or
python simulation-gazebo --world walls
then
PX4_GZ_STANDALONE=1 make px4_sitl gz_x500
more here
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
cd Micro-XRCE-DDS-Agent
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib/
installation:
make -j20 install DESTDIR=~/
LD_LIBRARY_PATH=~/usr/local/lib
cd ~/usr/local/bin
./MicroXRCEAgent udp4 -p 8888
First
cd ~/ros2_ws/src/
then
git clone [email protected]:PX4/px4_msgs.git
[email protected]:PX4/px4_ros_com.git
and finally:
cd ~/ros2_ws/
colcon build
gz topic -i -t /world/default/model/x500_lidar_0/link/link/sensor/lidar_2d_v2/scan/points
/world/default/model/x500_lidar_0/link/link/sensor/lidar_2d_v2/scan
sudo apt remove ros-humble-ros-gz
sudo apt install ros-humble-ros-gzharmonic
Refs: 1
https://docs.px4.io/main/en/test_and_ci/docker.html
xhost +
docker run -it --privileged
--env=LOCAL_USER_ID="$(id -u)"
-v ~/workspace/PX4-Autopilot:/src/PX4-Autopilot/:rw
-v /tmp/.X11-unix:/tmp/.X11-unix:ro
-e DISPLAY=$DISPLAY
--network host
--name=px4-ros px4io/px4-dev-base-jammy:latest bash
cd src/PX4-Autopilot #This is <container_src> make px4_sitl_default gazebo-classic
docker start -i px4-ros
docker exec -it px4-ros bash
cd /src/PX4-Autopilot/ source /opt/ros/noetic/setup.sh
https://docs.qgroundcontrol.com/master/en/qgc-user-guide/getting_started/quick_start.html
https://docs.px4.io/main/en/simulation/ros_interface.html
roslaunch mavros px4.launch fcu_url:="udp://:[email protected]:14557"
https://www.youtube.com/watch?v=jBTikChu02E&list=PLYy2pGCdhu7xEaNN8krzAKxv74L1mD4OV&index=5
export GZ_SIM_RESOURCE_PATH=/home/behnam/workspace/PX4-Autopilot/Tools/simulation/gz/worlds:$GZ_SIM_RESOURCE_PATH
PX4_SITL_WORLD=/home/behnam/workspace/PX4-Autopilot/Tools/simulation/gz/worlds/baylands.sdf make px4_sitl gz_x500_depth
PX4_SITL_WORLD=/home/behnam/workspace/PX4-Autopilot/Tools/simulation/gz/worlds/baylands.sdf make px4_sitl gz_x500_depth
ign topic -l
ign topic -i -t /camera Publishers [Address, Message Type]: tcp://172.17.0.1:46765, gz.msgs.Image
ros2 run ros_ign_bridge parameter_bridge /example_topic@std_msgs/msg/String[ignition.msgs.StringMsg
roslaunch mavros px4.launch fcu_url:="udp://:[email protected]:14557"