Skip to content
Snippets Groups Projects
Commit f1e8278b authored by Martí Morta Garriga's avatar Martí Morta Garriga
Browse files

primers arxius WET. No s'han comprovatsvn st

parent ad0674e4
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# WET
# check wether the scripts path environment variable has been defined
scripts_path=`echo "${IRI_ROS_SCRIPTS_PATH}"`
# check if scripts_path has size 0
......@@ -67,7 +69,9 @@ else
echo "Generating folder structure for project ${project_name} ..."
fi
roscreate-pkg ${project_name} roscpp iri_base_driver
# roscreate-pkg ${project_name} roscpp iri_base_driver
# WET
catkin_create_pkg ${project_name} roscpp iri_base_driver
#create driver filename
driver_filename="${input_name}_driver"
......@@ -162,5 +166,12 @@ 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 ${project_name}
#!/bin/bash
#WET
case ${ROS_ROOT} in
*electric* ) source "${ROS_ROOT}/tools/rosbash/rosbash" || kill_exit "ROS_ROOT Not found, try to install ROS again";;
*fuerte* ) source "${ROS_ROOT}/../rosbash/rosbash" || kill_exit "ROS_ROOT Not found, try to install ROS again";;
*hydro* ) source "${ROS_ROOT}/../rosbash/rosbash" || kill_exit "ROS_ROOT Not found, try to install ROS again";;
esac
# kill_exit
......@@ -194,11 +197,11 @@ function browse_files
# find_ros_message
# Validates existance of the given ros message type file in $1 with
# extension $2. When $2=action then looks for the 7 .msg created files.
# Adds message package to project manifest.xml if required.
# Adds message package to project package.xml if required.
# - $1: name of the ros message file to find
# - $2: type of the ros message file: msg, srv or action
# - $3: name of the ros pkg who wants to search the file
# (for searching manifest.xml to add dependency)
# (for searching package.xml to add dependency)
function find_ros_message
{
if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]]
......@@ -251,13 +254,13 @@ function find_ros_message
file_pkg=(`echo ${ros_out} | tr '[' ' ' | tr ']' ' ' | tr '/' ' '`)
fi
echo "ros_pkg=${ros_pkg}"
echo "file_pkg=${file_pkg}"
echo "ros_pkg=${ros_pkg}"
echo "file_pkg=${file_pkg}"
#check if both packages are the same
if [[ ${ros_pkg} != ${file_pkg} ]]
then
#modify manifest.xml to add dependency
add_pkg_to_manifest ${ros_pkg} ${file_pkg}
#modify package.xml to add dependency
add_pkg_to_packagexml ${ros_pkg} ${file_pkg}
fi
else
......@@ -265,15 +268,17 @@ echo "file_pkg=${file_pkg}"
fi
}
# add_pkg_to_manifest
# Adds $2 as dependency to $1 manifest.xml file.
# # DRY add_pkg_to_manifest
# # WET add_pkg_to_packagexml
# Adds $2 as dependency to $1 package.xml file.
# - $1: current ros package
# - $2: message ros package
function add_pkg_to_manifest
function add_pkg_to_packagexml
{
if [[ -z $1 ]] || [[ -z $2 ]]
then
kill_exit "add_pkg_to_manifest: missing input parameters"
kill_exit "add_pkg_to_packagexml: missing input parameters"
fi
#get path where message is stored
......@@ -283,21 +288,15 @@ function add_pkg_to_manifest
#go to package folder
roscd "${ros_pkg}"
# #parse folders in path
# local parsed_path=(`echo ${file_path} | tr '/' ' '`)
# #get the penultimate folder
# local path_length=${#parsed_path[@]}
# local pkg_dep=${parsed_path[path_length-2]}
#look for package in manifest.xml and add dependency if necessary
local pub="<depend package=\"${file_pkg}\"/>"
local pub1=$(grep "${pub}" "manifest.xml")
#look for package in package.xml and add dependency if necessary
local pub="<build_depend package=\"${file_pkg}\"/>"
local pub1=$(grep "${pub}" "package.xml")
if [[ -z "${pub1}" ]]
then
echo "Adding package \"${file_pkg}\" as dependency..."
local comment="depend package=\"iri_base_"
pub="<depend package=\"${file_pkg}\"\/>"
sed -i -e "/${comment}/a\\ ${pub}" "manifest.xml"
local comment="build_depend package=\"iri_base_"
pub="<build_depend package=\"${file_pkg}\"\/>"
sed -i -e "/${comment}/a\\ ${pub}" "package.xml"
else
echo "Package \"${file_pkg}\" already added as dependency, skipping"
fi
......@@ -428,9 +427,10 @@ function is_driver_or_alg_node
fi
}
# WET
function change_license_to_LGPL
{
find . -name manifest.xml -exec sed -i -e 's:<license>.*</license>:<license>LGPL</license>:g' {} \;
find . -name package.xml -exec sed -i -e 's:<license>.*</license>:<license>LGPL</license>:g' {} \;
}
......
#!/bin/bash
# WET
SCRIPT_PATH=`realpath "${BASH_SOURCE[0]}"`
export IRI_ROS_SCRIPTS_PATH=${SCRIPT_PATH%/*}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment