mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
sitl_run: allow to start required ROS2 plugins with Gazebo when ROS_VERSION is set to 2
This commit is contained in:
parent
cb2b09b80f
commit
e762d57222
@ -86,8 +86,15 @@ sleep 1
|
||||
|
||||
source ${src_path}/Tools/setup_gazebo.bash ${src_path} ${src_path}/build/${target}
|
||||
|
||||
# To use gazebo_ros ROS2 plugins
|
||||
if [[ -n "$ROS_VERSION" ]] && [ "$ROS_VERSION" == "2" ]; then
|
||||
ros_args="-s libgazebo_ros_init.so -s libgazebo_ros_factory.so"
|
||||
else
|
||||
ros_args=""
|
||||
fi
|
||||
|
||||
echo "Starting gazebo"
|
||||
gzserver ${src_path}/Tools/sitl_gazebo/worlds/${world}.world --verbose &
|
||||
gzserver ${src_path}/Tools/sitl_gazebo/worlds/${world}.world --verbose $ros_args &
|
||||
sleep 5
|
||||
|
||||
n=0
|
||||
|
||||
@ -56,6 +56,13 @@ else
|
||||
follow_mode=""
|
||||
fi
|
||||
|
||||
# To use gazebo_ros ROS2 plugins
|
||||
if [[ -n "$ROS_VERSION" ]] && [ "$ROS_VERSION" == "2" ]; then
|
||||
ros_args="-s libgazebo_ros_init.so -s libgazebo_ros_factory.so"
|
||||
else
|
||||
ros_args=""
|
||||
fi
|
||||
|
||||
if [ "$program" == "jmavsim" ]; then
|
||||
jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'`
|
||||
if [ -n "$jmavsim_pid" ]; then
|
||||
@ -133,7 +140,7 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
|
||||
world_path="$PX4_SITL_WORLD"
|
||||
fi
|
||||
fi
|
||||
gzserver $verbose $world_path &
|
||||
gzserver $verbose $world_path $ros_args &
|
||||
SIM_PID=$!
|
||||
|
||||
# Check all paths in ${GAZEBO_MODEL_PATH} for specified model
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user