-
Notifications
You must be signed in to change notification settings - Fork 27
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
[ros_bridge] Enable to use impedance controller through ros bridge #527
Open
pazeshun
wants to merge
8
commits into
start-jsk:indigo-devel
Choose a base branch
from
pazeshun:impedance-thru-ros-bridge
base: indigo-devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7cfce2a
Add idl for old impedance controller
pazeshun 5ddc329
Add ros bridge generation from idl
pazeshun 1b9532a
Add .gitignore for auto generated files
pazeshun c59e4b0
Bring up impedance controller unique to hironx
pazeshun 589e7f3
Don't generate python from idl to avoid error
pazeshun ce2c999
Enable impedance ros bridge by default in real robot
pazeshun 0a9bc49
Avoid compile error in other pkgs including idl
pazeshun dcb20d3
add build_depend of message_generation for genjava
takayuki5168 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# For rtmbuild | ||
msg/OpenHRP_* | ||
srv/OpenHRP_* | ||
src_gen | ||
|
||
# For others | ||
conf/*.conf | ||
conf/*.xml | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# Based on rtmbuild/cmake/rtmbuild.cmake | ||
cmake_minimum_required(VERSION 2.8.3) | ||
|
||
#set(DEBUG_RTMBUILD_CMAKE TRUE) | ||
|
||
set(use_catkin TRUE) | ||
|
||
# for rosbuild | ||
if(NOT COMMAND _rtmbuild_genbridge_init) | ||
include(${rtmbuild_PACKAGE_PATH}/cmake/servicebridge.cmake) | ||
set(use_catkin FALSE) | ||
endif() | ||
|
||
|
||
## | ||
## See rtmbuild/cmake/rtmbuild.cmake for GLOBAL VARIABLES | ||
## | ||
|
||
# add_custom_command to compile idl/*.idl file into c++ | ||
# Change points from original rtmbuild_genidl: | ||
# - don't generate python | ||
# - don't overwrite lib of CORBA skeleton and stub from other pkgs to avoid compile error in those pkgs | ||
macro(rtmbuild_genidl_customed) | ||
message("[rtmbuild_genidl_customed] add_custom_command for idl files in package ${PROJECT_NAME}") | ||
|
||
set(_autogen "") | ||
|
||
if (use_catkin) | ||
set(_output_cpp_dir ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_INCLUDE_DESTINATION}) | ||
# don't overwrite lib of CORBA skeleton and stub from other pkgs to avoid compile error in those pkgs | ||
# set(_output_lib_dir ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}) | ||
set(_output_lib_dir ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}/${PROJECT_NAME}) | ||
# don't generate python | ||
# set(_output_python_dir ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/${PROJECT_NAME}) | ||
unset(_output_python_dir) | ||
else() | ||
set(_output_dir ${PROJECT_SOURCE_DIR}/idl_gen) | ||
set(_output_cpp_dir ${PROJECT_SOURCE_DIR}/idl_gen/cpp/${PROJECT_NAME}) | ||
set(_output_lib_dir ${PROJECT_SOURCE_DIR}/idl_gen/lib) | ||
# don't generate python | ||
# set(_output_python_dir ${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}) | ||
unset(_output_python_dir) | ||
include_directories(${PROJECT_SOURCE_DIR}/idl_gen/cpp/) | ||
endif() | ||
|
||
# don't generate python | ||
# set(_output_idl_py_files "") | ||
unset(_output_idl_py_files) | ||
set(_output_idl_hh_files "") | ||
file(MAKE_DIRECTORY ${_output_cpp_dir}/idl) | ||
file(MAKE_DIRECTORY ${_output_lib_dir}) | ||
link_directories(${_output_lib_dir}) | ||
|
||
message("[rtmbuild_genidl_customed] - _output_cpp_dir : ${_output_cpp_dir}") | ||
message("[rtmbuild_genidl_customed] - _output_lib_dir : ${_output_lib_dir}") | ||
# don't generate python | ||
# message("[rtmbuild_genidl] - _output_python_dir : ${_output_python_dir}") | ||
|
||
## RTMBUILD_${PROJECT_NAME}_genrpc) depends on each RTMBUILD_${PROJECT_NAME}_${_idl_name}_genrpc) | ||
add_custom_target(RTMBUILD_${PROJECT_NAME}_genrpc) | ||
if(NOT ${PROJECT_NAME}_idl_files) | ||
message(AUTHOR_WARNING "[rtmbuild_genidl_customed] - no idl file is defined") | ||
endif() | ||
foreach(_idl_file ${${PROJECT_NAME}_idl_files}) | ||
get_filename_component(_idl_name ${_idl_file} NAME_WE) | ||
message("[rtmbuild_genidl_customed] - _idl_file : ${_idl_file}") | ||
message("[rtmbuild_genidl_customed] - _idl_name : ${_idl_name}") | ||
|
||
# set(_input_idl ${PROJECT_SOURCE_DIR}/idl/${_idl}) | ||
|
||
set(_output_idl_hh ${_output_cpp_dir}/idl/${_idl_name}.hh) | ||
# don't generate python | ||
# set(_output_idl_py ${_output_python_dir}/${_idl_name}_idl.py) | ||
unset(_output_idl_py) | ||
set(_output_stub_h ${_output_cpp_dir}/idl/${_idl_name}Stub.h) | ||
set(_output_skel_h ${_output_cpp_dir}/idl/${_idl_name}Skel.h) | ||
set(_output_stub_cpp ${_output_cpp_dir}/idl/${_idl_name}Stub.cpp) | ||
set(_output_skel_cpp ${_output_cpp_dir}/idl/${_idl_name}Skel.cpp) | ||
set(_output_stub_lib ${_output_lib_dir}/lib${_idl_name}Stub.so) | ||
set(_output_skel_lib ${_output_lib_dir}/lib${_idl_name}Skel.so) | ||
list(APPEND ${PROJECT_NAME}_IDLLIBRARY_DIRS lib${_idl_name}Stub.so lib${_idl_name}Skel.so) | ||
# call the rule to compile idl | ||
if(DEBUG_RTMBUILD_CMAKE) | ||
message("[rtmbuild_genidl_customed] ${_output_idl_hh}\n -> ${_idl_file} ${${_idl}_depends}") | ||
message("[rtmbuild_genidl_customed] ${_output_stub_cpp} ${_output_skel_cpp} ${_output_stub_h} ${_output_skel_h}\n -> ${_output_idl_hh}") | ||
message("[rtmbuild_genidl_customed] ${_output_stub_lib} ${_output_skel_lib}\n -> ${_output_stub_cpp} ${_output_stub_h} ${_output_skel_cpp} ${_output_skel_h}") | ||
endif() | ||
# cpp | ||
add_custom_command(OUTPUT ${_output_idl_hh} | ||
COMMAND ${rtm_idlc} ${rtm_idlflags} -C${_output_cpp_dir}/idl ${_idl_file} | ||
DEPENDS ${_idl_file}) | ||
add_custom_command(OUTPUT ${_output_stub_cpp} ${_output_skel_cpp} ${_output_stub_h} ${_output_skel_h} | ||
COMMAND cp ${_idl_file} ${_output_cpp_dir}/idl | ||
COMMAND rm -f ${_output_stub_cpp} ${_output_skel_cpp} ${_output_stub_h} ${_output_skel_h} | ||
COMMAND ${rtmskel_EXECUTABLE} --include-dir="" --skel-suffix=Skel --stub-suffix=Stub --idl-file=${_idl_file} | ||
WORKING_DIRECTORY ${_output_cpp_dir}/idl | ||
DEPENDS ${_output_idl_hh}) | ||
add_custom_command(OUTPUT ${_output_stub_lib} ${_output_skel_lib} | ||
COMMAND ${rtm_cxx} ${rtm_cflags} -I. -shared -o ${_output_stub_lib} ${_output_stub_cpp} ${rtm_libs} | ||
COMMAND ${rtm_cxx} ${rtm_cflags} -I. -shared -o ${_output_skel_lib} ${_output_skel_cpp} ${rtm_libs} | ||
DEPENDS ${_output_stub_cpp} ${_output_stub_h} ${_output_skel_cpp} ${_output_skel_h}) | ||
list(APPEND ${PROJECT_NAME}_IDLLIBRARY_DIRS ${_output_stub_lib} ${_output_skel_lib}) | ||
if(use_catkin) | ||
# don't overwrite lib of CORBA skeleton and stub from other pkgs to avoid compile error in those pkgs | ||
# install(PROGRAMS ${_output_stub_lib} ${_output_skel_lib} DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) | ||
install(PROGRAMS ${_output_stub_lib} ${_output_skel_lib} DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}/${PROJECT_NAME}) | ||
endif() | ||
# python | ||
# don't generate python | ||
# list(APPEND _output_idl_py_files ${_output_idl_py}) | ||
# cpp | ||
list(APPEND _output_idl_hh_files ${_output_idl_hh}) | ||
# | ||
# don't generate python | ||
# list(APPEND _autogen ${_output_stub_lib} ${_output_skel_lib} ${_output_idl_py}) | ||
list(APPEND _autogen ${_output_stub_lib} ${_output_skel_lib}) | ||
|
||
# add custom target | ||
add_custom_target(RTMBUILD_${PROJECT_NAME}_${_idl_name}_genrpc DEPENDS ${_output_stub_lib} ${_output_skel_lib}) | ||
add_dependencies(RTMBUILD_${PROJECT_NAME}_genrpc RTMBUILD_${PROJECT_NAME}_${_idl_name}_genrpc) | ||
# genrpc may depends on any idl (generate all .hh filesbefore compiling rpc https://github.com/fkanehiro/hrpsys-base/pull/886) | ||
add_dependencies(RTMBUILD_${PROJECT_NAME}_${_idl_name}_genrpc RTMBUILD_${PROJECT_NAME}_genhh) | ||
|
||
endforeach(_idl_file) | ||
# python | ||
# don't generate python | ||
# add_custom_target(RTMBUILD_${PROJECT_NAME}_genpy DEPENDS ${_output_idl_py_files}) | ||
# add_custom_command(OUTPUT ${_output_idl_py_files} | ||
# COMMAND mkdir -p ${_output_python_dir} | ||
# COMMAND echo \"${rtm_idlc} -bpython -I${rtm_idldir} -C${_output_python_dir} ${${PROJECT_NAME}_idl_files}\" | ||
# COMMAND ${rtm_idlc} -bpython -I${rtm_idldir} -C${_output_python_dir} ${${PROJECT_NAME}_idl_files} | ||
# COMMENT "Generating python/idl from ${${PROJECT_NAME}_idl_files}" | ||
# DEPENDS ${${PROJECT_NAME}_idl_files}) | ||
# add_dependencies(RTMBUILD_${PROJECT_NAME}_genrpc RTMBUILD_${PROJECT_NAME}_genpy) | ||
# cpp (generate all .hh filesbefore compiling rpc https://github.com/fkanehiro/hrpsys-base/pull/886) | ||
add_custom_target(RTMBUILD_${PROJECT_NAME}_genhh DEPENDS ${_output_idl_hh_files}) | ||
add_dependencies(RTMBUILD_${PROJECT_NAME}_genrpc RTMBUILD_${PROJECT_NAME}_genhh) | ||
## | ||
|
||
if(_autogen) | ||
if(DEBUG_RTMBUILD_CMAKE) | ||
message("[rtmbuild_genidl_customed] ADDITIONAL_MAKE_CLEAN_FILES : ${_autogen}") | ||
endif() | ||
# Also set up to clean the srv_gen directory | ||
get_directory_property(_old_clean_files ADDITIONAL_MAKE_CLEAN_FILES) | ||
list(APPEND _old_clean_files ${_autogen}) | ||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${_old_clean_files}") | ||
endif(_autogen) | ||
endmacro(rtmbuild_genidl_customed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @file AbsoluteForceSensorService.idl | ||
* @brief Services for the absolute force sensor interface | ||
*/ | ||
module OpenHRP | ||
{ | ||
interface AbsoluteForceSensorService | ||
{ | ||
typedef sequence<double, 3> DblSequence3; | ||
struct forcemomentOffsetParam { | ||
DblSequence3 force_offset; | ||
DblSequence3 moment_offset; | ||
DblSequence3 link_offset_centroid; | ||
double link_offset_mass; | ||
}; | ||
|
||
/** | ||
* @brief set offset parameters. | ||
* @param i_param new offset parameters | ||
* @return true if set successfully, false otherwise | ||
*/ | ||
boolean setForceMomentOffsetParam(in string name, in forcemomentOffsetParam i_param); | ||
|
||
/** | ||
* @brief get offset parameters. | ||
* @param name is name of the offset parameter set and i_param output offset parameters | ||
* @return true if set successfully, false otherwise | ||
*/ | ||
boolean getForceMomentOffsetParam(in string name, out forcemomentOffsetParam i_param); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* @file ImpedanceControllerService.idl | ||
* @brief Services for the impedance interface | ||
*/ | ||
module OpenHRP | ||
{ | ||
|
||
interface ImpedanceControllerService | ||
{ | ||
typedef sequence<double, 3> DblSequence3; | ||
|
||
struct impedanceParam { | ||
string name; | ||
string base_name; | ||
string target_name; | ||
double M_p; | ||
double D_p; | ||
double K_p; | ||
double M_r; | ||
double D_r; | ||
double K_r; | ||
DblSequence3 ref_force; | ||
DblSequence3 force_gain; | ||
DblSequence3 ref_moment; | ||
DblSequence3 moment_gain; | ||
double sr_gain; | ||
double avoid_gain; | ||
double reference_gain; | ||
double manipulability_limit; | ||
}; | ||
|
||
/** | ||
* @brief set impedance parameters. | ||
* @param i_param new impedance parameters | ||
* @return true if set successfully, false otherwise | ||
*/ | ||
boolean setImpedanceControllerParam(in impedanceParam i_param); | ||
|
||
/** | ||
* @brief get impedance parameters. | ||
* @param name is name of the impedance parameter set and i_param output impedance parameters | ||
* @return true if set successfully, false otherwise | ||
*/ | ||
boolean getImpedanceControllerParam(in string name, out impedanceParam i_param); | ||
|
||
/** | ||
* @brief remove impedance parameters. | ||
* @param name name of the impedance parameter set | ||
* @return true if set successfully, false otherwise | ||
*/ | ||
boolean deleteImpedanceController(in string name); | ||
|
||
/** | ||
* @brief wait to finish deleting the impedance param object. | ||
* @param name name of the impedance parameter set | ||
*/ | ||
void waitDeletingImpedanceController(in string name); | ||
|
||
/** | ||
* @brief remove impedance parameters and wait to finish deleting the impedance param object. | ||
* @param name name of the impedance parameter set | ||
* @return true if set successfully, false otherwise | ||
*/ | ||
boolean deleteImpedanceControllerAndWait(in string name); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- Launch ros bridge for old impedance controller in HiroNX --> | ||
<launch> | ||
<arg name="nameserver" default="localhost" /> | ||
<arg name="corbaport" default="15005" /> | ||
<arg name="SIMULATOR_NAME" default="RobotHardware0"/> | ||
<env name="SIMULATOR_NAME" value="$(arg SIMULATOR_NAME)" /> | ||
<env name="RTCTREE_NAMESERVERS" value="$(arg nameserver):$(arg corbaport)" /> | ||
|
||
<arg name="omniorb_args" default="-ORBInitRef NameService=corbaloc:iiop:$(arg nameserver):$(arg corbaport)/NameService" /> | ||
<arg name="openrtm_args" default='-o "corba.nameservers:$(arg nameserver):$(arg corbaport)" -o "naming.formats:%n.rtc" -o "exec_cxt.periodic.type:PeriodicExecutionContext" -o "exec_cxt.periodic.rate:2000" -o "logger.file_name:/tmp/rtc%p.log"' /> | ||
|
||
<!-- Launch ImpedanceController and AbsoluteForceSensor --> | ||
<node pkg="hironx_ros_bridge" name="ImpedanceControllerServiceROSBridge" type="ImpedanceControllerServiceROSBridgeComp" | ||
output="screen" args ="$(arg openrtm_args)" /> | ||
<node pkg="hironx_ros_bridge" name="AbsoluteForceSensorServiceROSBridge" type="AbsoluteForceSensorServiceROSBridgeComp" | ||
output="screen" args="$(arg openrtm_args)" /> | ||
<rtconnect from="ImpedanceControllerServiceROSBridge.rtc:ImpedanceControllerService" to="ic.rtc:ImpedanceControllerService" subscription_type="new"/> | ||
<rtactivate component="ImpedanceControllerServiceROSBridge.rtc" /> | ||
<rtconnect from="AbsoluteForceSensorServiceROSBridge.rtc:AbsoluteForceSensorService" to="rmfo.rtc:AbsoluteForceSensorService" subscription_type="new"/> | ||
<rtactivate component="AbsoluteForceSensorServiceROSBridge.rtc" /> | ||
<node name="rtmlaunch_impedance_controller" pkg="openrtm_tools" type="rtmlaunch.py" | ||
args="$(find hironx_ros_bridge)/launch/impedance_controller.launch" /> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized in #533