diff --git a/hrpsys_ros_bridge_tutorials/catkin.cmake b/hrpsys_ros_bridge_tutorials/catkin.cmake index 5f1665ab..db5ba94c 100644 --- a/hrpsys_ros_bridge_tutorials/catkin.cmake +++ b/hrpsys_ros_bridge_tutorials/catkin.cmake @@ -247,14 +247,13 @@ generate_default_launch_eusinterface_files("$(find openhrp3)/share/OpenHRP-3.1/s macro (generate_hand_attached_hrp2_model _robot_name) set(_model_dir "${PROJECT_SOURCE_DIR}/models/") set(_in_urdf_file "${_model_dir}/${_robot_name}.urdf") - set(_out_urdf_file "${_model_dir}/${_robot_name}_WH.urdf") + set(_out_urdf_file "${_model_dir}/${_robot_name}_body.urdf") string(TOLOWER ${_robot_name} _srobot_name) - set(_launch_file "${PROJECT_SOURCE_DIR}/launch/${_srobot_name}_ros_bridge.launch") set(_script_file "${PROJECT_SOURCE_DIR}/models/gen_hand_attached_hrp2_model.sh") message("generate hand_attached_hrp2_model for ${_robot_name}") add_custom_command(OUTPUT ${_out_urdf_file} - COMMAND ${_script_file} ${_robot_name} ${_in_urdf_file} ${_out_urdf_file} ${_launch_file} ${PROJECT_SOURCE_DIR}/.. - DEPENDS ${_in_urdf_file} ${_launch_file} "${_model_dir}/HRP3HAND_L.urdf" "${_model_dir}/HRP3HAND_R.urdf") + COMMAND ${_script_file} ${_robot_name} ${_in_urdf_file} ${PROJECT_SOURCE_DIR}/.. + DEPENDS ${_in_urdf_file}) add_custom_target(${_robot_name}_model_generate DEPENDS ${_out_urdf_file}) list(APPEND compile_urdf_robots ${_robot_name}_model_generate) endmacro() diff --git a/hrpsys_ros_bridge_tutorials/models/HRP2JSKNT.urdf.xacro b/hrpsys_ros_bridge_tutorials/models/HRP2JSKNT.urdf.xacro index 957a26a7..7ebdc17f 100644 --- a/hrpsys_ros_bridge_tutorials/models/HRP2JSKNT.urdf.xacro +++ b/hrpsys_ros_bridge_tutorials/models/HRP2JSKNT.urdf.xacro @@ -1,5 +1,5 @@ - + diff --git a/hrpsys_ros_bridge_tutorials/models/HRP2JSKNTS.urdf.xacro b/hrpsys_ros_bridge_tutorials/models/HRP2JSKNTS.urdf.xacro index 479eb733..b6a357f6 100644 --- a/hrpsys_ros_bridge_tutorials/models/HRP2JSKNTS.urdf.xacro +++ b/hrpsys_ros_bridge_tutorials/models/HRP2JSKNTS.urdf.xacro @@ -1,5 +1,5 @@ - + diff --git a/hrpsys_ros_bridge_tutorials/models/gen_hand_attached_hrp2_model.sh b/hrpsys_ros_bridge_tutorials/models/gen_hand_attached_hrp2_model.sh index 68496ea9..16bd4c4f 100755 --- a/hrpsys_ros_bridge_tutorials/models/gen_hand_attached_hrp2_model.sh +++ b/hrpsys_ros_bridge_tutorials/models/gen_hand_attached_hrp2_model.sh @@ -7,34 +7,22 @@ trap error ERR ROBOT_MODEL=$1 INPUT_FILE=$2 -OUTPUT_FILE=$3 -LAUNCH_FILE=$4 -ADDITIONAL_ROS_PACKAGE_PATH=$5 -TMP_FILE=`echo ${INPUT_FILE} | sed "s/.urdf/_tmp.urdf/g"` +ADDITIONAL_ROS_PACKAGE_PATH=$3 +BODY_FILE=`echo ${INPUT_FILE} | sed "s/.urdf/_body.urdf/g"` export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$ADDITIONAL_ROS_PACKAGE_PATH # make tmp file -cp ${INPUT_FILE} ${TMP_FILE} +cp ${INPUT_FILE} ${BODY_FILE} # remove LARM_LINK6 -L_START=`grep -n "" -m 1 | cut -f1 -d:) ## +L_START=`grep -n "" -m 1 | cut -f1 -d:) ## L_END=`expr ${L_START} + ${L_END} - 1` -sed -i -e "${L_START},${L_END}d" ${TMP_FILE} +sed -i -e "${L_START},${L_END}d" ${BODY_FILE} # remove RARM_LINK6 -L_START=`grep -n "" -m 1 | cut -f1 -d:) ## +L_START=`grep -n "" -m 1 | cut -f1 -d:) ## L_END=`expr ${L_START} + ${L_END} - 1` -sed -i -e "${L_START},${L_END}d" ${TMP_FILE} - -# generate URDF with xacro -rosrun xacro xacro.py `echo ${INPUT_FILE} | sed "s/.urdf/.urdf.xacro/g"` > ${OUTPUT_FILE} - -# remove tmp file -rm -rf ${TMP_FILE} - -# overwrite launch file to use new model -OUTPUT_FILE_BASENAME=`basename ${OUTPUT_FILE}` -sed -i -e "s@arg\ name=\"COLLADA_FILE\"\ \(.*\)${ROBOT_MODEL}.dae\"@arg\ name=\"COLLADA_FILE\"\ \\1${OUTPUT_FILE_BASENAME}\"@g" ${LAUNCH_FILE} +sed -i -e "${L_START},${L_END}d" ${BODY_FILE}