From 6f1c7e6f8f11911bb6d6dac84e99659aef8d7122 Mon Sep 17 00:00:00 2001 From: Carter Frost Date: Tue, 20 Nov 2018 16:11:43 -0800 Subject: [PATCH 1/4] Allows run.sh to be executed from any folder within the repo using catkin locate and outside using dirname Testing: From home you could run `./SwarmBaseCode-ROS/run.sh` this will use dirname From SwarmBaseCode-ROS/src/behaviours/src you could run it as ../../../run.sh this will use catkin locate --- run.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/run.sh b/run.sh index 04e3ec16..57e20369 100755 --- a/run.sh +++ b/run.sh @@ -1,18 +1,19 @@ #!/bin/bash -echo "Running in $PWD" previous_gazebo_model_path=${GAZEBO_MODEL_PATH} previous_gazebo_plugin_path=${GAZEBO_PLUGIN_PATH} -export SWARMATHON_APP_ROOT="$PWD" -export GAZEBO_MODEL_PATH="$PWD/simulation/models" -export GAZEBO_PLUGIN_PATH="$PWD/build/gazebo_plugins" -source "$PWD/devel/setup.bash" +export SWARMATHON_APP_ROOT="$(catkin locate)" +if [ -z "$t" ]; then SWARMATHON_APP_ROOT=$(dirname "$0"); fi +echo "Running from: $PWD with repo root: $SWARMATHON_APP_ROOT" +export GAZEBO_MODEL_PATH="$SWARMATHON_APP_ROOT/simulation/models" +export GAZEBO_PLUGIN_PATH="$SWARMATHON_APP_ROOT/build/gazebo_plugins" +source "$SWARMATHON_APP_ROOT/devel/setup.bash" echo Cleaning up ROS and Gazebo Processes #Delete the rqt cache - can take 24 hours for changes in the UI # to show up otherwise rm ~/.config/ros.org/rqt_gui.ini -./cleanup.sh +$SWARMATHON_APP_ROOT/cleanup.sh echo Killing rosmaster pkill rosmaster echo Killing roscore @@ -28,7 +29,7 @@ echo Killing rosmaster pkill rosmaster echo Killing roscore pkill roscore -./cleanup.sh +$SWARMATHON_APP_ROOT/cleanup.sh # Restore previous environment export GAZEBO_MODEL_PATH=$previous_gazebo_model_path export GAZEBO_PLUGIN_PATH=$previous_gazebo_plugin_path From f894de289c7f39c9d1e0d75e56259b12aff5d984 Mon Sep 17 00:00:00 2001 From: Carter Frost Date: Wed, 21 Nov 2018 15:35:08 -0800 Subject: [PATCH 2/4] fixing typo from t to SWARMATHON_APP_ROOT in run.sh --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 57e20369..ba14cb9a 100755 --- a/run.sh +++ b/run.sh @@ -2,7 +2,7 @@ previous_gazebo_model_path=${GAZEBO_MODEL_PATH} previous_gazebo_plugin_path=${GAZEBO_PLUGIN_PATH} export SWARMATHON_APP_ROOT="$(catkin locate)" -if [ -z "$t" ]; then SWARMATHON_APP_ROOT=$(dirname "$0"); fi +if [ -z "$SWARMATHON_APP_ROOT" ]; then SWARMATHON_APP_ROOT=$(dirname "$0"); fi echo "Running from: $PWD with repo root: $SWARMATHON_APP_ROOT" export GAZEBO_MODEL_PATH="$SWARMATHON_APP_ROOT/simulation/models" export GAZEBO_PLUGIN_PATH="$SWARMATHON_APP_ROOT/build/gazebo_plugins" From 0cc658c4bfa36e1590a6e991801f0b51869bcb22 Mon Sep 17 00:00:00 2001 From: Carter Frost Date: Wed, 21 Nov 2018 18:51:28 -0800 Subject: [PATCH 3/4] Allows rover_launch_local.sh to be executed from any folder within the repo using catkin locate and outside using dirname --- misc/rover_launch_local.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/rover_launch_local.sh b/misc/rover_launch_local.sh index 209e05a4..26422a3b 100755 --- a/misc/rover_launch_local.sh +++ b/misc/rover_launch_local.sh @@ -1,3 +1,5 @@ #!/bin/bash +export SWARMATHON_APP_ROOT="$(catkin locate)" +if [ -z "$SWARMATHON_APP_ROOT" ]; then SWARMATHON_APP_ROOT=$(dirname "$0"); fi roscore & -./rover_onboard_node_launch.sh localhost $1 +$SWARMATHON_APP_ROOT/misc/rover_onboard_node_launch.sh localhost $1 From 62a37c681ccd8188e6ea9071ac43bc78a5f411f7 Mon Sep 17 00:00:00 2001 From: Carter Frost Date: Wed, 21 Nov 2018 18:53:44 -0800 Subject: [PATCH 4/4] Changed dirPath in misc/deploy.sh to allow it to run from any folder --- misc/deploy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/deploy.sh b/misc/deploy.sh index c52cf47a..07d88944 100755 --- a/misc/deploy.sh +++ b/misc/deploy.sh @@ -8,9 +8,9 @@ branch="" needsReboot=false calFile="" -cd .. -dirPath="$(pwd)" -dirName="$(basename `pwd`)" +export dirPath="$(catkin locate)" +if [ -z "$dirPath" ]; then dirPath=$(dirname "$0"); fi +dirName="$(basename $dirPath)" #Functions #--------------------------------------------------------------------------