Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hrpsys_gazebo_general scripts in hrpsys_gazebo_tutorials #135

Merged
merged 1 commit into from
Oct 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions hrpsys_gazebo_general/cmake/compile_robot_model_for_gazebo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
## define macros
##
macro (generate_gazebo_urdf_file daefile)
if(NOT EXISTS ${daefile})
message(WARNING "generate gazebo_urdf_file: ${daefile} not found.")
break()
endif(NOT EXISTS ${daefile})
# set variable
if(hrpsys_gazebo_general_SOURCE_DIR)
set(hrpsys_gazebo_general_PACKAGE_PATH ${hrpsys_gazebo_general_SOURCE_DIR})
Expand All @@ -18,7 +22,7 @@ macro (generate_gazebo_urdf_file daefile)
add_custom_command(OUTPUT ${_out_dir}/meshes
COMMAND mkdir ${_out_dir}/meshes)
# convert dae to urdf
message("generate_gazebo_urdf_file ${daefile}")
message("generate_gazebo_urdf_file: converting ${daefile}.")
## ${compile_robots} is a global target used in compile_robot_model.cmake of hrpsys_ros_bridge.
## this dependency means that converting urdf after executing all of ${compile_robots}.
add_custom_command(OUTPUT ${_out_urdf_file}
Expand All @@ -32,22 +36,22 @@ macro (generate_gazebo_urdf_file daefile)
add_custom_command(OUTPUT ${_out_urdf_gazebo_file}
COMMAND sed -e "s@package://${PROJECT_NAME}/robot_models/@model://@g" ${_out_urdf_file} > ${_out_urdf_gazebo_file}
DEPENDS ${_out_urdf_file})
add_custom_target(${_robot_name}_compile DEPENDS ${_out_urdf_gazebo_file})
add_custom_target(${_robot_name}_${PROJECT_NAME}_compile DEPENDS ${_out_urdf_gazebo_file})
# generate launch and world file
set(ROBOT ${_robot_name})
string(TOLOWER ${_robot_name} _robot_sname)
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/launch/gazebo_${_robot_sname}_no_controllers.launch)
configure_file(${hrpsys_gazebo_general_PACKAGE_PATH}/scripts/default_gazebo_robot_no_controllers.launch.in ${PROJECT_SOURCE_DIR}/launch/gazebo_${_robot_sname}_no_controllers.launch)
list(APPEND ${_robot_name}_compile ${PROJECT_SOURCE_DIR}/launch/gazebo_${_robot_sname}_no_controllers.launch)
list(APPEND ${_robot_name}_${PROJECT_NAME}_compile ${PROJECT_SOURCE_DIR}/launch/gazebo_${_robot_sname}_no_controllers.launch)
endif()
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/launch/${_robot_sname}_hrpsys_bringup.launch)
configure_file(${hrpsys_gazebo_general_PACKAGE_PATH}/scripts/default_robot_hrpsys_bringup.launch.in ${_robot_sname}_hrpsys_bringup.launch)
list(APPEND ${_robot_name}_compile ${PROJECT_SOURCE_DIR}/launch/${_robot_sname}_hrpsys_bringup.launch)
list(APPEND ${_robot_name}_${PROJECT_NAME}_compile ${PROJECT_SOURCE_DIR}/launch/${_robot_sname}_hrpsys_bringup.launch)
endif()
if(NOT EXISTS ${_out_dir}/model.config)
configure_file(${hrpsys_gazebo_general_PACKAGE_PATH}/scripts/model.config.in ${_out_dir}/model.config)
list(APPEND ${_robot_name}_compile ${_out_dir}/model.config)
list(APPEND ${_robot_name}_${PROJECT_NAME}_compile ${_out_dir}/model.config)
endif()
list(APPEND compile_urdf_robots ${_robot_name}_compile)
list(APPEND compile_urdf_robots ${_robot_name}_${PROJECT_NAME}_compile)
install(DIRECTORY ${_out_dir} DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/robot_models/ PATTERN ".svn" EXCLUDE)
endmacro()
4 changes: 2 additions & 2 deletions hrpsys_gazebo_general/launch/robot_hrpsys_bringup.launch
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<arg name="ROBOT_INSTANCE_NAME" default="$(arg ROBOT_TYPE)" />
<arg name="USE_INSTANCE_NAME" default="false" />
<arg name="HRPSYS_PY_ARGS" default="" />
<arg name="CONF_DIR" value="$(find hrpsys_ros_bridge)/models" />
<arg name="CONF_FILE" value="$(arg CONF_DIR)/$(arg ROBOT_TYPE).conf" />
<arg name="CONF_DIR" default="$(find hrpsys_ros_bridge)/models" />
<arg name="CONF_FILE" default="$(arg CONF_DIR)/$(arg ROBOT_TYPE).conf" />

<!-- hrpsys_gazebo settings -->
<arg name="SYNCHRONIZED" default="false" />
Expand Down
67 changes: 20 additions & 47 deletions hrpsys_gazebo_tutorials/catkin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ pkg_check_modules(openhrp3 openhrp3.1 REQUIRED)
pkg_check_modules(hrpsys hrpsys-base REQUIRED)
pkg_check_modules(collada_urdf_jsk_patch collada_urdf_jsk_patch)

catkin_package(
DEPENDS
CATKIN_DEPENDS euscollada hrpsys_ros_bridge hrpsys_ros_bridge_tutorials
INCLUDE_DIRS # TODO include
LIBRARIES # TODO
)
catkin_package(CATKIN_DEPENDS euscollada hrpsys_ros_bridge hrpsys_ros_bridge_tutorials)

if(NOT hrpsys_ros_bridge_tutorials_SOURCE_DIR)
execute_process(
Expand All @@ -23,48 +18,26 @@ if(NOT hrpsys_ros_bridge_tutorials_SOURCE_DIR)
string(REGEX REPLACE "\n" "" hrpsys_ros_bridge_tutorials_SOURCE_DIR ${hrpsys_ros_bridge_tutorials_SOURCE_DIR})
endif()

install(PROGRAMS robot_models/install_robot_common.sh
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/robot_models/)
## Convert robot models
if(EXISTS ${hrpsys_gazebo_general_SOURCE_DIR})
set(hrpsys_gazebo_general_PACKAGE_PATH ${hrpsys_gazebo_general_SOURCE_DIR})
else()
set(hrpsys_gazebo_general_PACKAGE_PATH ${hrpsys_gazebo_general_PREFIX}/share/hrpsys_gazebo_general)
endif()
include(${hrpsys_gazebo_general_PACKAGE_PATH}/cmake/compile_robot_model_for_gazebo.cmake)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/SampleRobot.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/HRP3HAND_L.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/HRP3HAND_R.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/HRP2JSK.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/HRP2JSKNT.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/HRP2JSKNTS.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/STARO.dae)
generate_gazebo_urdf_file(${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/HRP4C.dae)
add_custom_target(all_robots_compile_tutorials ALL DEPENDS ${compile_urdf_robots})

## install
install(FILES setup.sh
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY euslisp worlds launch config environment_models DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
PATTERN ".svn" EXCLUDE)
install(PROGRAMS scripts/gazebo scripts/gzclient scripts/gzserver scripts/eus2urdf_for_gazebo_pyscript.py scripts/generate_model_database.py scripts/make_fixed_model.py scripts/remove_all_added_models.py scripts/generate_room_world.py scripts/make_static_model.py scripts/remove_all_generated_files.py
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/scripts/)


macro (generate_gazebo_urdf_file _robot_name)
set(_out_dir "${PROJECT_SOURCE_DIR}/robot_models/${_robot_name}")
set(_out_urdf_file "${_out_dir}/${_robot_name}.urdf")
add_custom_command(OUTPUT ${_out_dir}/meshes
COMMAND mkdir ${_out_dir}/meshes)
add_custom_command(OUTPUT ${_out_dir}/hrpsys
COMMAND mkdir ${_out_dir}/hrpsys)
message("urdf input -- ${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models/${_robot_name}.dae")
# ${compile_robots} is a global target used in compile_robot_model.cmake of hrpsys_ros_bridge.
# this dependency means that run install_robot_common.sh after executing all of ${compile_robots}.
add_custom_command(OUTPUT ${_out_urdf_file}
COMMAND ${PROJECT_SOURCE_DIR}/robot_models/install_robot_common.sh ${_robot_name} ${hrpsys_ros_bridge_tutorials_SOURCE_DIR}/models ${hrpsys_gazebo_tutorials_SOURCE_DIR}/robot_models/${_robot_name} ${collada_urdf_jsk_patch_PREFIX}/lib/collada_urdf_jsk_patch/collada_to_urdf ${PROJECT_SOURCE_DIR}/..
DEPENDS ${PROJECT_SOURCE_DIR}/robot_models/install_robot_common.sh ${_out_dir}/hrpsys ${_out_dir}/meshes ${compile_robots})
add_custom_target(${_robot_name}_compile DEPENDS ${_out_urdf_file})
set(ROBOT ${_robot_name})
string(TOLOWER ${_robot_name} _sname)
#configure_file(${PROJECT_SOURCE_DIR}/scripts/default_robot_hrpsys_bringup.launch.in ${PROJECT_SOURCE_DIR}/build/${_sname}_hrpsys_bringup.launch)
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/launch/gazebo_${_sname}_no_controllers.launch)
configure_file(${PROJECT_SOURCE_DIR}/scripts/default_gazebo_robot_no_controllers.launch.in ${PROJECT_SOURCE_DIR}/launch/gazebo_${_sname}_no_controllers.launch)
endif()
list(APPEND compile_urdf_robots ${_robot_name}_compile)
install(DIRECTORY ${_out_dir} DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/robot_models/ PATTERN ".svn" EXCLUDE)
endmacro()

generate_gazebo_urdf_file(SampleRobot)
generate_gazebo_urdf_file(HRP3HAND_L)
generate_gazebo_urdf_file(HRP3HAND_R)
generate_gazebo_urdf_file(HRP2JSK)
generate_gazebo_urdf_file(HRP2JSKNT)
generate_gazebo_urdf_file(HRP2JSKNTS)
generate_gazebo_urdf_file(STARO)
generate_gazebo_urdf_file(HRP4C)


add_custom_target(all_robots_compile ALL DEPENDS ${compile_urdf_robots})
install(DIRECTORY scripts DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} USE_SOURCE_PERMISSIONS)
17 changes: 0 additions & 17 deletions hrpsys_gazebo_tutorials/launch/gazebo_HRP4C_no_controllers.launch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<launch>
<arg name="gzname" default="gazebo"/>
<arg name="WORLD" default="HRP2JSK.world"/>
<arg name="WORLD" default="$(find hrpsys_gazebo_general)/worlds/empty.world"/>
<arg name="PAUSED" default="false"/>
<arg name="SYNCHRONIZED" default="false" />

<include file="$(find hrpsys_gazebo_tutorials)/launch/gazebo_robot_no_controllers.launch">
<include file="$(find hrpsys_gazebo_general)/launch/gazebo_robot_no_controllers.launch">
<arg name="ROBOT_TYPE" value="HRP2JSK" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
<arg name="WORLD" value="$(arg WORLD)" />
<arg name="HRPSYS_GAZEBO_CONFIG" default="$(find hrpsys_gazebo_tutorials)/config/HRP2JSK.yaml" />
<arg name="ROBOT_MODEL" default="$(find hrpsys_gazebo_tutorials)/robot_models/HRP2JSK/HRP2JSK.urdf.xacro" />

<arg name="PAUSED" value="$(arg PAUSED)"/>
<!-- <arg name="HRPSYS_GAZEBO_CONFIG" value="$(find hrpsys_gazebo_tutorials)/config/HRP2JSK.yaml" /> -->
<!-- <arg name="ROBOT_MODEL" value="$(find hrpsys_gazebo_tutorials)/robot_models/HRP2JSK/HRP2JSK.urdf" /> -->
<arg name="SYNCHRONIZED" value="$(arg SYNCHRONIZED)" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
</include>
</launch>
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<launch>
<arg name="gzname" default="gazebo"/>
<arg name="WORLD" default="HRP2JSKNT.world"/>
<arg name="WORLD" default="$(find hrpsys_gazebo_general)/worlds/empty.world"/>
<arg name="PAUSED" default="false"/>
<arg name="SYNCHRONIZED" default="false" />

<include file="$(find hrpsys_gazebo_tutorials)/launch/gazebo_robot_no_controllers.launch">
<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_L.yaml" ns="HRP3HAND_L" />
<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_R.yaml" ns="HRP3HAND_R" />

<include file="$(find hrpsys_gazebo_general)/launch/gazebo_robot_no_controllers.launch">
<arg name="ROBOT_TYPE" value="HRP2JSKNT" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
<arg name="WORLD" value="$(arg WORLD)" />
<arg name="HRPSYS_GAZEBO_CONFIG" default="$(find hrpsys_gazebo_tutorials)/config/HRP2JSKNT.yaml" />
<arg name="ROBOT_MODEL" default="$(find hrpsys_gazebo_tutorials)/robot_models/HRP2JSKNT/HRP2JSKNT.urdf.xacro" />

<arg name="PAUSED" value="$(arg PAUSED)"/>
<!-- <arg name="HRPSYS_GAZEBO_CONFIG" value="$(find hrpsys_gazebo_tutorials)/config/HRP2JSKNT.yaml" /> -->
<!-- <arg name="ROBOT_MODEL" value="$(find hrpsys_gazebo_tutorials)/robot_models/HRP2JSKNT/HRP2JSKNT.urdf" /> -->
<arg name="SYNCHRONIZED" value="$(arg SYNCHRONIZED)" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
</include>

<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_L.yaml" ns="HRP3HAND_L" />
<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_R.yaml" ns="HRP3HAND_R" />
</launch>
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<launch>
<arg name="gzname" default="gazebo"/>
<arg name="WORLD" default="HRP2JSKNTS.world"/>
<arg name="WORLD" default="$(find hrpsys_gazebo_general)/worlds/empty.world"/>
<arg name="PAUSED" default="false"/>
<arg name="SYNCHRONIZED" default="false" />

<include file="$(find hrpsys_gazebo_tutorials)/launch/gazebo_robot_no_controllers.launch">
<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_L.yaml" ns="HRP3HAND_L" />
<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_R.yaml" ns="HRP3HAND_R" />

<include file="$(find hrpsys_gazebo_general)/launch/gazebo_robot_no_controllers.launch">
<arg name="ROBOT_TYPE" value="HRP2JSKNTS" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
<arg name="WORLD" value="$(arg WORLD)" />
<arg name="HRPSYS_GAZEBO_CONFIG" default="$(find hrpsys_gazebo_tutorials)/config/HRP2JSKNTS.yaml" />
<arg name="ROBOT_MODEL" default="$(find hrpsys_gazebo_tutorials)/robot_models/HRP2JSKNTS/HRP2JSKNTS.urdf.xacro" />

<arg name="PAUSED" value="$(arg PAUSED)"/>
<!-- <arg name="HRPSYS_GAZEBO_CONFIG" value="$(find hrpsys_gazebo_tutorials)/config/HRP2JSKNTS.yaml" /> -->
<!-- <arg name="ROBOT_MODEL" value="$(find hrpsys_gazebo_tutorials)/robot_models/HRP2JSKNTS/HRP2JSKNTS.urdf" /> -->
<arg name="SYNCHRONIZED" value="$(arg SYNCHRONIZED)" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
</include>

<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_L.yaml" ns="HRP3HAND_L" />
<rosparam command="load"
file="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_R.yaml" ns="HRP3HAND_R" />
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<launch>
<arg name="gzname" default="gazebo"/>
<arg name="WORLD" default="$(find hrpsys_gazebo_general)/worlds/empty.world"/>
<arg name="PAUSED" default="false"/>
<arg name="SYNCHRONIZED" default="false" />

<include file="$(find hrpsys_gazebo_general)/launch/gazebo_robot_no_controllers.launch">
<arg name="ROBOT_TYPE" value="HRP3HAND_L" />
<arg name="WORLD" value="$(arg WORLD)" />
<arg name="HRPSYS_GAZEBO_CONFIG" default="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_L.yaml" />
<arg name="ROBOT_MODEL" default="$(find hrpsys_gazebo_tutorials)/robot_models/HRP3HAND_L/HRP3HAND_L.urdf.xacro" />

<arg name="PAUSED" value="$(arg PAUSED)"/>
<arg name="SYNCHRONIZED" value="$(arg SYNCHRONIZED)" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
</include>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<launch>
<arg name="gzname" default="gazebo"/>
<arg name="WORLD" default="$(find hrpsys_gazebo_general)/worlds/empty.world"/>
<arg name="PAUSED" default="false"/>
<arg name="SYNCHRONIZED" default="false" />

<include file="$(find hrpsys_gazebo_general)/launch/gazebo_robot_no_controllers.launch">
<arg name="ROBOT_TYPE" value="HRP3HAND_R" />
<arg name="WORLD" value="$(arg WORLD)" />
<arg name="HRPSYS_GAZEBO_CONFIG" default="$(find hrpsys_gazebo_tutorials)/config/HRP3HAND_R.yaml" />
<arg name="ROBOT_MODEL" default="$(find hrpsys_gazebo_tutorials)/robot_models/HRP3HAND_R/HRP3HAND_R.urdf.xacro" />

<arg name="PAUSED" value="$(arg PAUSED)"/>
<arg name="SYNCHRONIZED" value="$(arg SYNCHRONIZED)" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
</include>
</launch>
63 changes: 0 additions & 63 deletions hrpsys_gazebo_tutorials/launch/gazebo_robot_no_controllers.launch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<launch>
<arg name="gzname" default="gazebo"/>
<arg name="WORLD" default="SampleRobot.world"/>
<arg name="WORLD" default="$(find hrpsys_gazebo_general)/worlds/empty.world"/>
<arg name="PAUSED" default="false"/>
<arg name="SYNCHRONIZED" default="false" />

<include file="$(find hrpsys_gazebo_tutorials)/launch/gazebo_robot_no_controllers.launch">
<include file="$(find hrpsys_gazebo_general)/launch/gazebo_robot_no_controllers.launch">
<arg name="ROBOT_TYPE" value="SampleRobot" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
<arg name="WORLD" value="$(arg WORLD)" />
<arg name="HRPSYS_GAZEBO_CONFIG" default="$(find hrpsys_gazebo_tutorials)/config/SampleRobot.yaml" />
<arg name="ROBOT_MODEL" default="$(find hrpsys_gazebo_tutorials)/robot_models/SampleRobot/SampleRobot.urdf.xacro" />

<arg name="PAUSED" value="$(arg PAUSED)"/>
<!-- <arg name="HRPSYS_GAZEBO_CONFIG" value="$(find hrpsys_gazebo_tutorials)/config/SampleRobot.yaml" /> -->
<!-- <arg name="ROBOT_MODEL" value="$(find hrpsys_gazebo_tutorials)/robot_models/SampleRobot/SampleRobot.urdf" /> -->
<arg name="SYNCHRONIZED" value="$(arg SYNCHRONIZED)" />
<arg name="USE_INSTANCE_NAME" value="true" />
<arg name="gzname" value="$(arg gzname)" />
</include>
</launch>
Loading