From b407b2fc23291dab26199fa7a82ffedac61664a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mart=C3=AD=20Morta=20Garriga?= <mmorta@iri.upc.edu>
Date: Tue, 1 Oct 2013 10:11:25 +0000
Subject: [PATCH] WET scripts. It is time for iri_core, iri_base_driver and
 iri_base_algorithm so we can check the scripts actually work

---
 add_action_server_client.sh        |  8 +++++---
 add_publisher_subscriber.sh        | 13 +++++++++----
 add_server_client.sh               | 11 ++++++++---
 create_algorithm_implementation.sh |  8 ++++++--
 create_driver_package.sh           |  8 +-------
 create_generic_algorithm.sh        |  8 ++++++--
 create_simple_algorithm_package.sh | 14 +++++++++++---
 libraries/create_action_client.sh  |  4 ++--
 libraries/create_action_server.sh  |  5 +++--
 libraries/create_client.sh         |  4 ++--
 libraries/create_publisher.sh      |  7 ++++---
 libraries/create_server.sh         |  4 ++--
 libraries/create_subscriber.sh     |  7 ++++---
 libraries/scripts_library.sh       |  2 +-
 14 files changed, 64 insertions(+), 39 deletions(-)

diff --git a/add_action_server_client.sh b/add_action_server_client.sh
index d8862fe..e0f41bb 100755
--- a/add_action_server_client.sh
+++ b/add_action_server_client.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
 then
-  echo "The scripts path environment varibale has not been defined. Please see the wiki documentation for instructions on how to create it."
+  echo "The scripts path environment variable has not been defined. Please see the wiki documentation for instructions on how to create it."
   exit
 else
   echo "The scripts path environment variable has been properly defined."
@@ -45,7 +47,7 @@ do
        ;;
     ?)
        echo "invalid input argument ${OPTION}"
-       kill_exit "Usage: ./add_action_server_client.sh -o [server,client] -p ros_pkg -a action_name -m message.action"
+       kill_exit "Usage: ./add_action_server_client.sh -o [server,client] -p ros_pkg -a action_name -m pkg/message.action"
        exit
        ;;
   esac
@@ -55,7 +57,7 @@ done
 if [ ! "${server_client}" ] || [ ! "${ros_pkg}" ] || [ ! "${action_name}" ] || [ ! "${action_file}" ]
 then
   echo "Missing input parameters..."
-  kill_exit "Usage: ./add_action_server_client.sh -o [server,client] -p ros_pkg -a action_name -m message.action"
+  kill_exit "Usage: ./add_action_server_client.sh -o [server,client] -p ros_pkg -a action_name -m pkg/message.action"
 fi
 
 #check server client parameter
diff --git a/add_publisher_subscriber.sh b/add_publisher_subscriber.sh
index f13ad0d..acd75f7 100755
--- a/add_publisher_subscriber.sh
+++ b/add_publisher_subscriber.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -49,7 +51,7 @@ do
        ;;
     ?)
        echo "invalid input argument ${OPTION}"
-       kill_exit "Usage: ./add_publisher_subscriber.sh -o [publisher,subscriber] -p ros_pkg -t topic_name -m message.msg -b 100"
+       kill_exit "Usage: ./add_publisher_subscriber.sh -o [publisher,subscriber] -p ros_pkg -t topic_name -m pkg/message.msg -b 100"
        exit
        ;;
   esac
@@ -59,7 +61,7 @@ done
 if [ ! "${pub_subs}" ] || [ ! "${ros_pkg}" ] || [ ! "${topic_name}" ] || [ ! "${msg_file}" ] || [ ! "${buffer}" ]
 then
   echo "Missing input parameters..."
-  kill_exit "Usage: ./add_publisher_subscriber.sh -o [publisher,subscriber] -p ros_pkg -t topic_name -m message.msg -b 100"
+  kill_exit "Usage: ./add_publisher_subscriber.sh -o [publisher,subscriber] -p ros_pkg -t topic_name -m pkg/message.msg -b 100"
 fi
 
 #check publisher subscriber parameter
@@ -69,7 +71,6 @@ then
 fi
 
 #check if package exists
-# script_path=`pwd`
 result=`roscd ${ros_pkg}`
 if [[ -z "${result}" ]]
 then
@@ -94,7 +95,7 @@ ext=$(echo ${ext} | tr "[:upper:]" "[:lower:]")
 #check extension
 if [[ ! "${ext}" = "${msg}" ]]
 then
-  kill_exit "Wrong file extension, please provide a .srv file, aborting ..."
+  kill_exit "Wrong file extension, please provide a .msg file, aborting ..."
 fi
 
 #look for MSG file
@@ -145,3 +146,7 @@ else
   create_subscriber ${ros_pkg} ${topic_name} ${msg_file%.msg} ${file_pkg} ${buffer} ${node_h} ${node_c} ${driver_alg}
 fi
 
+# WET
+cd.. # to catkin work space
+catkin_make --pkg ${ros_pkg}
+
diff --git a/add_server_client.sh b/add_server_client.sh
index 4d804e7..af33944 100755
--- a/add_server_client.sh
+++ b/add_server_client.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
 then
-  echo "The scripts path environment varibale has not been defined. Please see the wiki documentation for instructions on how to create it."
+  echo "The scripts path environment variable has not been defined. Please see the wiki documentation for instructions on how to create it."
   exit
 else
   echo "The scripts path environment variable has been properly defined."
@@ -45,7 +47,7 @@ do
        ;;
     ?)
        echo "invalid input argument ${OPTION}"
-       kill_exit "Usage: ./add_server_client.sh -o [server,client] -p ros_pkg -s service_name -m message.srv"
+       kill_exit "Usage: ./add_server_client.sh -o [server,client] -p ros_pkg -s service_name -m pkg/service.srv"
        exit
        ;;
   esac
@@ -55,7 +57,7 @@ done
 if [ ! "${server_client}" ] || [ ! "${ros_pkg}" ] || [ ! "${service_name}" ] || [ ! "${srv_file}" ]
 then
   echo "Missing input parameters..."
-  kill_exit "Usage: ./add_server_client.sh -o [server,client] -p ros_pkg -s service_name -m message.srv"
+  kill_exit "Usage: ./add_server_client.sh -o [server,client] -p ros_pkg -s service_name -m pkg/service.srv"
 fi
 
 #check server client parameter
@@ -121,3 +123,6 @@ else
   create_client ${ros_pkg} ${service_name} ${srv_file%.srv} ${file_pkg} ${node_h} ${node_c} ${driver_alg}
 fi
 
+# WET
+cd.. # to catkin work space
+catkin_make --pkg ${ros_pkg}
diff --git a/create_algorithm_implementation.sh b/create_algorithm_implementation.sh
index 0c84668..6befdf0 100755
--- a/create_algorithm_implementation.sh
+++ b/create_algorithm_implementation.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+ 
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -95,7 +97,7 @@ then
 fi
 
 #create package
-roscreate-pkg ${project_name} roscpp iri_base_algorithm ${if_pkg} ${gen_alg_pkg}
+catkin_create_pkg ${project_name} roscpp iri_base_algorithm ${if_pkg} ${gen_alg_pkg}
 
 #create driver filename
 algimpl_filename="${input_name}"
@@ -165,5 +167,7 @@ echo "Project ${project_name} has been successfully created!!"
 
 pushd "${project_name}"
 change_license_to_LGPL
-rosmake
 popd
+
+cd .. # to catkin work space
+catkin_make --pkg ${project_name}
diff --git a/create_driver_package.sh b/create_driver_package.sh
index 2557c1c..87556af 100755
--- a/create_driver_package.sh
+++ b/create_driver_package.sh
@@ -69,8 +69,6 @@ else
   echo "Generating folder structure for project ${project_name} ..."
 fi
 
-# roscreate-pkg ${project_name} roscpp iri_base_driver
-# WET
 catkin_create_pkg ${project_name} roscpp iri_base_driver 
 
 #create driver filename
@@ -168,10 +166,6 @@ pushd "${project_name}"
 change_license_to_LGPL
 popd
 
-# WET
 cd .. # to catkin work space
-
-#rosmake
-# WET
-catkin_make ${project_name}
+catkin_make --pkg ${project_name}
 
diff --git a/create_generic_algorithm.sh b/create_generic_algorithm.sh
index fcebe4d..9fd9250 100755
--- a/create_generic_algorithm.sh
+++ b/create_generic_algorithm.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -82,7 +84,7 @@ then
 fi
 
 #create package
-roscreate-pkg ${project_name} roscpp iri_base_algorithm ${if_pkg}
+catkin_create_pkg${project_name} roscpp iri_base_algorithm ${if_pkg}
 
 #create driver filename
 genalg_filename="${input_name}"
@@ -129,5 +131,7 @@ echo "Project ${project_name} has been successfully created!!"
 
 pushd "${project_name}"
 change_license_to_LGPL
-rosmake
 popd
+
+cd .. # to catkin work space
+catkin_make --pkg ${project_name}
diff --git a/create_simple_algorithm_package.sh b/create_simple_algorithm_package.sh
index 0f98eea..a0728c8 100755
--- a/create_simple_algorithm_package.sh
+++ b/create_simple_algorithm_package.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
 then
-  echo "The scripts path environment varibale has not been defined. Please see the wiki documentation for instructions on how to create it."
+  echo "The scripts path environment variable has not been defined. Please see the wiki documentation for instructions on how to create it."
   exit
 else
   echo "The scripts path environment variable has been properly defined."
@@ -66,7 +68,7 @@ else
   echo "Generating folder structure for project ${project_name} ..."
 fi
 
-roscreate-pkg ${project_name} roscpp iri_base_algorithm
+catkin_create_pkg ${project_name} roscpp iri_base_algorithm 
 
 #create alg filename
 alg_filename="${input_name}_alg"
@@ -156,5 +158,11 @@ echo "Project ${project_name} has been successfully created!!"
 
 pushd "${project_name}"
 change_license_to_LGPL
-rosmake
 popd
+
+# WET
+cd .. # to catkin work space
+
+#rosmake
+# WET
+catkin_make --pkg ${project_name}
diff --git a/libraries/create_action_client.sh b/libraries/create_action_client.sh
index 89efe88..823222b 100644
--- a/libraries/create_action_client.sh
+++ b/libraries/create_action_client.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -226,7 +228,5 @@ else
 fi
 
 # ################################################################################
-#compile
-rosmake ${ros_pkg}
 
 }
diff --git a/libraries/create_action_server.sh b/libraries/create_action_server.sh
index 1c50fe4..7cbaccc 100644
--- a/libraries/create_action_server.sh
+++ b/libraries/create_action_server.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -268,7 +270,6 @@ fi
 
 
 ################################################################################
-#compile
-rosmake ${ros_pkg}
+
 
 }
diff --git a/libraries/create_client.sh b/libraries/create_client.sh
index 225a4aa..cbe8501 100755
--- a/libraries/create_client.sh
+++ b/libraries/create_client.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -96,8 +98,6 @@ else
 fi
 
 ################################################################################
-#compile
-rosmake ${ros_pkg}
 
 }
 
diff --git a/libraries/create_publisher.sh b/libraries/create_publisher.sh
index 154f0f6..6a71bf2 100755
--- a/libraries/create_publisher.sh
+++ b/libraries/create_publisher.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
 then
-  echo "The scripts path environment varibale has not been defined. Please see the wiki documentation for instructions on how to create it."
+  echo "The scripts path environment variable has not been defined. Please see the wiki documentation for instructions on how to create it."
   exit
 else
   echo "The scripts path environment variable has been properly defined."
@@ -95,6 +97,5 @@ else
 fi
 
 ################################################################################
-#compile
-rosmake ${ros_pkg}
+
 }
diff --git a/libraries/create_server.sh b/libraries/create_server.sh
index 85e7f36..da72292 100755
--- a/libraries/create_server.sh
+++ b/libraries/create_server.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
@@ -130,7 +132,5 @@ fi
 
 
 ################################################################################
-#compile
 
-rosmake ${ros_pkg}
 }
diff --git a/libraries/create_subscriber.sh b/libraries/create_subscriber.sh
index 581e1c6..ef82649 100755
--- a/libraries/create_subscriber.sh
+++ b/libraries/create_subscriber.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
 
+# WET
+
 # check wether the scripts path environment variable has been defined
 scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
 if [[ -z "${scripts_path}" ]]
 then
-  echo "The scripts path environment varibale has not been defined. Please see the wiki documentation for instructions on how to create it."
+  echo "The scripts path environment variable has not been defined. Please see the wiki documentation for instructions on how to create it."
   exit
 else
   echo "The scripts path environment variable has been properly defined."
@@ -119,6 +121,5 @@ fi
 
 
 ################################################################################
-#compile
-rosmake ${ros_pkg}
+
 }
diff --git a/libraries/scripts_library.sh b/libraries/scripts_library.sh
index e754e2c..dceade8 100644
--- a/libraries/scripts_library.sh
+++ b/libraries/scripts_library.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-#WET
+# WET
 
 case ${ROS_ROOT} in
   *electric* ) source "${ROS_ROOT}/tools/rosbash/rosbash" || kill_exit "ROS_ROOT Not found, try to install ROS again";;
-- 
GitLab