From 75ec16b72d6f70df9b4afe055cfaf46b08b8b656 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 2 Feb 2023 12:33:52 +0100 Subject: [PATCH 1/2] gazebo_ros: fix killing the gzserver after the client terminated with the gazebo script, add exec to all other scripts --- gazebo_ros/scripts/debug | 2 +- gazebo_ros/scripts/gazebo | 4 ++-- gazebo_ros/scripts/gzclient | 2 +- gazebo_ros/scripts/gzserver | 2 +- gazebo_ros/scripts/perf | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gazebo_ros/scripts/debug b/gazebo_ros/scripts/debug index e1326766c..375735f05 100755 --- a/gazebo_ros/scripts/debug +++ b/gazebo_ros/scripts/debug @@ -19,4 +19,4 @@ then fi setup_path=$(pkg-config --variable=prefix gazebo)/share/gazebo/ -. $setup_path/setup.sh && rosrun gazebo_ros gdbrun gzserver $final +. $setup_path/setup.sh && exec rosrun gazebo_ros gdbrun gzserver $final diff --git a/gazebo_ros/scripts/gazebo b/gazebo_ros/scripts/gazebo index 883aeb48e..b701646ef 100755 --- a/gazebo_ros/scripts/gazebo +++ b/gazebo_ros/scripts/gazebo @@ -49,7 +49,7 @@ if $(kill -0 $! 2> /dev/null); then fi # Kill the server if it is alive -if $(kill -0 $! 2> /dev/null); then +if $(kill -0 $gzserver_pid 2> /dev/null); then # -2 SIGINT valid for Linux and Mac - kill -2 $! + kill -2 $gzserver_pid fi diff --git a/gazebo_ros/scripts/gzclient b/gazebo_ros/scripts/gzclient index 488eb1b79..45493c61c 100755 --- a/gazebo_ros/scripts/gzclient +++ b/gazebo_ros/scripts/gzclient @@ -39,4 +39,4 @@ fi final=$(relocate_remappings "${final}") # Combine the commands -GAZEBO_MASTER_URI="$desired_master_uri" GAZEBO_MODEL_DATABASE_URI="$desired_model_database_uri" gzclient $final +GAZEBO_MASTER_URI="$desired_master_uri" GAZEBO_MODEL_DATABASE_URI="$desired_model_database_uri" exec gzclient $final diff --git a/gazebo_ros/scripts/gzserver b/gazebo_ros/scripts/gzserver index 16c3206b4..7b9a5ef6b 100755 --- a/gazebo_ros/scripts/gzserver +++ b/gazebo_ros/scripts/gzserver @@ -38,4 +38,4 @@ fi final=$(relocate_remappings "${final}") -GAZEBO_MASTER_URI="$desired_master_uri" GAZEBO_MODEL_DATABASE_URI="$desired_model_database_uri" gzserver $final +GAZEBO_MASTER_URI="$desired_master_uri" GAZEBO_MODEL_DATABASE_URI="$desired_model_database_uri" exec gzserver $final diff --git a/gazebo_ros/scripts/perf b/gazebo_ros/scripts/perf index 85b63b30f..c3f117483 100755 --- a/gazebo_ros/scripts/perf +++ b/gazebo_ros/scripts/perf @@ -18,4 +18,4 @@ then fi setup_path=$(pkg-config --variable=prefix gazebo)/share/gazebo/ -. $setup_path/setup.sh && /usr/bin/valgrind --tool=callgrind gzserver $final +. $setup_path/setup.sh && exec /usr/bin/valgrind --tool=callgrind gzserver $final From b8193d19356dfb6646164dbfcb1888144a3dcfda Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 2 Feb 2023 12:54:50 +0100 Subject: [PATCH 2/2] gazebo_ros: do not load the gazebo_ros_api_plugin into the gzclient --- gazebo_ros/scripts/gzclient | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gazebo_ros/scripts/gzclient b/gazebo_ros/scripts/gzclient index 45493c61c..ceed8cc78 100755 --- a/gazebo_ros/scripts/gzclient +++ b/gazebo_ros/scripts/gzclient @@ -17,12 +17,6 @@ then final="$final -g `catkin_find --first-only libgazebo_ros_paths_plugin.$EXT`" fi -# add ros api plugin if it does not already exist in the passed in arguments -if [ `expr "$final" : ".*libgazebo_ros_api_plugin\.$EXT.*"` -eq 0 ] -then - final="$final -g `catkin_find --first-only libgazebo_ros_api_plugin.$EXT`" -fi - setup_path=$(pkg-config --variable=prefix gazebo)/share/gazebo/ # source setup.sh, but keep local modifications to GAZEBO_MASTER_URI and GAZEBO_MODEL_DATABASE_URI