Fix bhand description to handle mimic joints in Gazebo.
Create bhand_bringup.
Change gazebo.launch in wam_node_sim to use bhand as default.
--- /dev/null
+cmake_minimum_required(VERSION 2.8.3)
+project(bhand_bringup)
+
+## Compile as C++11, supported in ROS Kinetic and newer
+# add_compile_options(-std=c++11)
+
+## Find catkin macros and libraries
+## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
+## is used, also find other catkin packages
+find_package(catkin REQUIRED COMPONENTS
+ bhand_description
+ control_msgs
+ controller_manager
+ position_controllers
+ urdf
+)
+
+## System dependencies are found with CMake's conventions
+# find_package(Boost REQUIRED COMPONENTS system)
+
+
+## Uncomment this if the package has a setup.py. This macro ensures
+## modules and global scripts declared therein get installed
+## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
+# catkin_python_setup()
+
+################################################
+## Declare ROS messages, services and actions ##
+################################################
+
+## To declare and build messages, services or actions from within this
+## package, follow these steps:
+## * Let MSG_DEP_SET be the set of packages whose message types you use in
+## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
+## * In the file package.xml:
+## * add a build_depend tag for "message_generation"
+## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
+## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
+## but can be declared for certainty nonetheless:
+## * add a run_depend tag for "message_runtime"
+## * In this file (CMakeLists.txt):
+## * add "message_generation" and every package in MSG_DEP_SET to
+## find_package(catkin REQUIRED COMPONENTS ...)
+## * add "message_runtime" and every package in MSG_DEP_SET to
+## catkin_package(CATKIN_DEPENDS ...)
+## * uncomment the add_*_files sections below as needed
+## and list every .msg/.srv/.action file to be processed
+## * uncomment the generate_messages entry below
+## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
+
+## Generate messages in the 'msg' folder
+# add_message_files(
+# FILES
+# Message1.msg
+# Message2.msg
+# )
+
+## Generate services in the 'srv' folder
+# add_service_files(
+# FILES
+# Service1.srv
+# Service2.srv
+# )
+
+## Generate actions in the 'action' folder
+# add_action_files(
+# FILES
+# Action1.action
+# Action2.action
+# )
+
+## Generate added messages and services with any dependencies listed here
+# generate_messages(
+# DEPENDENCIES
+# control_msgs
+# )
+
+################################################
+## Declare ROS dynamic reconfigure parameters ##
+################################################
+
+## To declare and build dynamic reconfigure parameters within this
+## package, follow these steps:
+## * In the file package.xml:
+## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
+## * In this file (CMakeLists.txt):
+## * add "dynamic_reconfigure" to
+## find_package(catkin REQUIRED COMPONENTS ...)
+## * uncomment the "generate_dynamic_reconfigure_options" section below
+## and list every .cfg file to be processed
+
+## Generate dynamic reconfigure parameters in the 'cfg' folder
+# generate_dynamic_reconfigure_options(
+# cfg/DynReconf1.cfg
+# cfg/DynReconf2.cfg
+# )
+
+###################################
+## catkin specific configuration ##
+###################################
+## The catkin_package macro generates cmake config files for your package
+## Declare things to be passed to dependent projects
+## INCLUDE_DIRS: uncomment this if you package contains header files
+## LIBRARIES: libraries you create in this project that dependent projects also need
+## CATKIN_DEPENDS: catkin_packages dependent projects also need
+## DEPENDS: system dependencies of this project that dependent projects also need
+catkin_package(
+# INCLUDE_DIRS include
+# LIBRARIES bhand_bringup
+# CATKIN_DEPENDS bhand_description control_msgs controller_manager position_controllers urdf
+# DEPENDS system_lib
+)
+
+###########
+## Build ##
+###########
+
+## Specify additional locations of header files
+## Your package locations should be listed before other locations
+include_directories(
+# include
+ ${catkin_INCLUDE_DIRS}
+)
+
+## Declare a C++ library
+# add_library(${PROJECT_NAME}
+# src/${PROJECT_NAME}/bhand_bringup.cpp
+# )
+
+## Add cmake target dependencies of the library
+## as an example, code may need to be generated before libraries
+## either from message generation or dynamic reconfigure
+# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
+## Declare a C++ executable
+## With catkin_make all packages are built within a single CMake context
+## The recommended prefix ensures that target names across packages don't collide
+# add_executable(${PROJECT_NAME}_node src/bhand_bringup_node.cpp)
+
+## Rename C++ executable without prefix
+## The above recommended prefix causes long target names, the following renames the
+## target back to the shorter version for ease of user use
+## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
+# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
+
+## Add cmake target dependencies of the executable
+## same as for the library above
+# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
+## Specify libraries to link a library or executable target against
+# target_link_libraries(${PROJECT_NAME}_node
+# ${catkin_LIBRARIES}
+# )
+
+#############
+## Install ##
+#############
+
+# all install targets should use catkin DESTINATION variables
+# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
+
+## Mark executable scripts (Python etc.) for installation
+## in contrast to setup.py, you can choose the destination
+# install(PROGRAMS
+# scripts/my_python_script
+# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+# )
+
+## Mark executables and/or libraries for installation
+# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
+# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+# )
+
+## Mark cpp header files for installation
+# install(DIRECTORY include/${PROJECT_NAME}/
+# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
+# FILES_MATCHING PATTERN "*.h"
+# PATTERN ".svn" EXCLUDE
+# )
+
+## Mark other files for installation (e.g. launch and bag files, etc.)
+# install(FILES
+# # myfile1
+# # myfile2
+# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+# )
+
+#############
+## Testing ##
+#############
+
+## Add gtest based cpp test target and link libraries
+# catkin_add_gtest(${PROJECT_NAME}-test test/test_bhand_bringup.cpp)
+# if(TARGET ${PROJECT_NAME}-test)
+# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
+# endif()
+
+## Add folders to be run by python nosetests
+# catkin_add_nosetests(test)
--- /dev/null
+bhand_controller:
+ type: position_controllers/JointGroupPositionController
+ joints:
+ - bhand_finger1_joint_2
+ - bhand_finger2_joint_2
+ - bhand_finger3_joint_2
+ - bhand_spread
+
+joint_state_controller:
+ type: joint_state_controller/JointStateController
+ publish_rate: 1000
--- /dev/null
+<launch>
+ <arg name="paused" default="true"/>
+ <arg name="headless" default="false"/>
+ <arg name="use_sim_time" default="true"/>
+ <arg name="table" default="true"/>
+
+
+ <include file="$(find bhand_description)/launch/gazebo.launch" >
+ <arg name="paused" value="$(arg paused)"/>
+ <arg name="headless" value="$(arg headless)"/>
+ <arg name="use_sim_time" value="$(arg use_sim_time)"/>
+ </include>
+
+ <rosparam file="$(find bhand_bringup)/config/bhand_controller.yaml" command="load"/>
+
+ <node name="bhand_controller_spawner" pkg="controller_manager" type="spawner"
+ respawn="false" output="screen"
+ args="bhand_controller joint_state_controller" />
+</launch>
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <name>bhand_bringup</name>
+ <version>0.0.0</version>
+ <description>The bhand_bringup package</description>
+
+ <!-- One maintainer tag required, multiple allowed, one person per tag -->
+ <!-- Example: -->
+ <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
+ <maintainer email="fetter@ece.ufrgs.br">Walter Fetter Lages</maintainer>
+
+
+ <!-- One license tag required, multiple allowed, one license per tag -->
+ <!-- Commonly used license strings: -->
+ <!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
+ <license>GPLv3</license>
+
+
+ <!-- Url tags are optional, but multiple are allowed, one per tag -->
+ <!-- Optional attribute type can be: website, bugtracker, or repository -->
+ <!-- Example: -->
+ <!-- <url type="website">http://wiki.ros.org/bhand_bringup</url> -->
+
+
+ <!-- Author tags are optional, multiple are allowed, one per tag -->
+ <!-- Authors do not have to be maintainers, but could be -->
+ <!-- Example: -->
+ <!-- <author email="jane.doe@example.com">Jane Doe</author> -->
+ <author email="fetter@ece.ufrgs.br">Walter Fetter Lages</author>
+
+
+ <!-- The *_depend tags are used to specify dependencies -->
+ <!-- Dependencies can be catkin packages or system dependencies -->
+ <!-- Examples: -->
+ <!-- Use build_depend for packages you need at compile time: -->
+ <!-- <build_depend>message_generation</build_depend> -->
+ <!-- Use buildtool_depend for build tool packages: -->
+ <!-- <buildtool_depend>catkin</buildtool_depend> -->
+ <!-- Use run_depend for packages you need at runtime: -->
+ <!-- <run_depend>message_runtime</run_depend> -->
+ <!-- Use test_depend for packages you need only for testing: -->
+ <!-- <test_depend>gtest</test_depend> -->
+ <buildtool_depend>catkin</buildtool_depend>
+ <build_depend>bhand_description</build_depend>
+ <build_depend>control_msgs</build_depend>
+ <build_depend>controller_manager</build_depend>
+ <build_depend>position_controllers</build_depend>
+ <build_depend>urdf</build_depend>
+ <run_depend>bhand_description</run_depend>
+ <run_depend>control_msgs</run_depend>
+ <run_depend>controller_manager</run_depend>
+ <run_depend>position_controllers</run_depend>
+ <run_depend>urdf</run_depend>
+
+
+ <!-- The export tag contains other, unspecified, tags -->
+ <export>
+ <!-- Other tools can request additional information be placed here -->
+
+ </export>
+</package>
<arg name="world" value="$(arg world)" />
</include>
- <node name="wam_spawner" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model bhand" respawn="false" output="screen" />
+ <node name="bhand_spawner" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model bhand" respawn="false" output="screen" />
</launch>
<inertial>
<!--
Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
-
Finger spread frame
-->
<mass value="0.14109"/>
<origin xyz="0.030616 -7.3219e-5 -0.011201"/>
- <inertia ixx="2.0672e-5" ixy="2.6024e-7" ixz="6.3481e-6" iyy="7.4105e-5" iyz="1.7118e-8" izz="6.8207e-5"/>
+ <!--inertia ixx="2.0672e-5" ixy="2.6024e-7" ixz="6.3481e-6" iyy="7.4105e-5" iyz="1.7118e-8" izz="6.8207e-5"/-->
+ <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
</inertial>
</inertial_attr>
- <origin xyz="0.02475 0.0 ${0.1325-0.06}" rpy="0.0 0 ${M_PI}" />
+ <origin xyz="0.02475 0.0 ${0.1325-0.06}" rpy="0.0 0.0 ${M_PI}" />
<limit effort="30" velocity="1.5" lower="0.0" upper="${M_PI}" />
<mimic_attr/>
</xacro:bhand_link1>
<xacro:bhand_link1 parent="base_link" link="finger2_link_1" joint="spread_finger2" type="revolute">
<inertial_attr>
- <inertial>
+ <inertial>
+
<!--
Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
-
Finger spread frame
-->
+
<mass value="0.14109"/>
<origin xyz="0.030616 -7.3219e-5 -0.011201"/>
- <inertia ixx="2.0672e-5" ixy="2.6024e-7" ixz="6.3481e-6" iyy="7.4105e-5" iyz="1.7118e-8" izz="6.8207e-5"/>
+ <!--inertia ixx="2.0672e-5" ixy="2.6024e-7" ixz="6.3481e-6" iyy="7.4105e-5" iyz="1.7118e-8" izz="6.8207e-5"/ -->
+ <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
</inertial>
</inertial_attr>
- <origin xyz="-0.02475 0.0 ${0.1325-0.06}" rpy="0.0 0 ${M_PI}" />
- <limit effort="30" velocity="1.5" lower="-${M_PI}" upper="0.0" />
+ <origin xyz="-0.02475 0.0 ${0.1325-0.06}" rpy="0.0 0.0 ${M_PI}" />
+ <limit effort="30.0" velocity="1.5" lower="-${M_PI}" upper="0.0" />
<mimic_attr>
- <mimic joint="bhand_spread" multiplier="-1.0" offset="0" />
+ <mimic joint="bhand_spread" multiplier="-1.0" offset="0.0" />
</mimic_attr>
+
</xacro:bhand_link1>
+ <xacro:bhand_transmission joint="spread_finger2" />
+
+ <gazebo>
+ <plugin name="mimic_plugin" filename="libroboticsgroup_gazebo_mimic_joint_plugin.so">
+ <joint>bhand_spread</joint>
+ <mimicJoint>bhand_spread_finger2</mimicJoint>
+ <multiplier>-1.0</multiplier>
+ <offset>0.0</offset>
+ <maxEffor>30.0</maxEffor>
+ <sensitiveness>0.1</sensitiveness>
+ </plugin>
+ </gazebo>
+
<xacro:bhand_link1 parent="base_link" link="finger3_link_1" joint="finger3_joint_1" type="fixed">
- <inertial_attr/>
- <origin xyz="0.0 0.0 ${0.1325-0.06}" rpy="0.0 0 ${M_PI}" />
- <limit effort="30" velocity="0.0" lower="0.0" upper="0.0" />
+ <inertial_attr>
+ <inertial>
+
+<!--
+ Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
+ Finger spread frame
+ Is this included in base? Fix this...
+-->
+
+ <mass value="0.14109"/>
+ <origin xyz="0.030616 -7.3219e-5 -0.011201"/>
+ <!--inertia ixx="2.0672e-5" ixy="2.6024e-7" ixz="6.3481e-6" iyy="7.4105e-5" iyz="1.7118e-8" izz="6.8207e-5"/-->
+ <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
+ </inertial>
+ </inertial_attr>
+ <!--inertial_attr/-->
+ <origin xyz="0.0 0.0 ${0.1325-0.06}" rpy="0.0 0.0 ${M_PI}" />
+ <limit effort="0.0" velocity="0.0" lower="0.0" upper="0.0" />
<mimic_attr/>
</xacro:bhand_link1>
<xacro:include filename="$(find bhand_description)/xacro/bhand.urdf.xacro" />
- <joint name="bhand_origin" type="fixed">
+ <joint name="bhand_origin_joint" type="fixed">
<parent link="world"/>
<child link="bhand_origin" />
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
</joint>
+
+ <gazebo>
+ <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so" >
+ <!--robotNamespace>bhand</robotNamespace-->
+
+ <!-- Custom plugin -->
+ <!-- robotSimType>bhand_gazebo_ros_control/BhandRobotHWSim</robotSimType -->
+
+ <!-- Default plugin -->
+ <!-- robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType -->
+
+ <controlPeriod>0.001</controlPeriod>
+ </plugin>
+ </gazebo>
</robot>
<inertial>
<!--
Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
-
Hand base frame without palm pad. Mass and inertia of finger 3 link
1 are included.
-->
<xacro:macro name="bhand_link1" params="parent link joint type **inertial_attr *origin *limit **mimic_attr">
<link name="bhand_${link}">
-
<xacro:insert_block name="inertial_attr"/>
- <inertial>
-<!--
- Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
-
- Finger spread frame
--->
- <mass value="0.14109"/>
- <origin xyz="0.030616 -7.3219e-5 -0.011201"/>
- <inertia ixx="2.0672e-5" ixy="2.6024e-7" ixz="6.3481e-6" iyy="7.4105e-5" iyz="1.7118e-8" izz="6.8207e-5"/>
- </inertial>
<visual>
<origin rpy="0 0 ${M_PI/2}" xyz="0 0 0"/>
<geometry>
<xacro:insert_block name="limit" />
- <!--joint_properties damping="100.0" friction="1000.0" /-->
- <dynamics damping="1000"/>
+ <dynamics damping="10" friction="1"/>
<xacro:insert_block name="mimic_attr"/>
<inertial>
<!--
Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
-
Finger inner link frame with fingertip torque sensor
-->
<mass value="0.062139"/>
<axis xyz="0 0 1"/>
<limit effort="30" velocity="1.5" lower="0.0" upper="${140 * M_PI / 180}" />
- <!--joint_properties damping="100.0" friction="1000.0" /-->
- <dynamics damping="1000"/>
+ <dynamics damping="10" friction="1"/>
</joint >
<inertial>
<!--
Inertia parameters from http://support.barrett.com/wiki/Hand/280/MassProperties
-
Fingertip frame without fingertip pressure pad
-->
<mass value="0.041377"/>
<!--origin xyz="0.0 0.02475 0.1325" rpy="0.0 0 0" /-->
<!--origin xyz="0.070 0 0" rpy="0 0 ${42 * M_PI / 180}" /-->
- <origin xyz="0.070 0.0 0.0" rpy="0.0 0 0.0" />
+ <origin xyz="0.070 0.0 0.0" rpy="0.0 0.0 ${40 * M_PI / 180}" />
<parent link="bhand_${parent}"/>
<child link="bhand_${link}" />
<axis xyz="0 0 1"/>
<!--limit lower="0" upper="${48 * M_PI / 180}" effort="30" velocity="2.0"/-->
- <limit effort="30" velocity="1.5" lower="${40 * M_PI / 180}" upper="2.44346095" />
+ <limit effort="30" velocity="1.5" lower="0" upper="${2.44346095 - 40 * M_PI / 180}" />
- <!--joint_properties damping="100.0" friction="1000.0" /-->
- <dynamics damping="1000"/>
+ <dynamics damping="10" friction="1"/>
- <mimic joint="bhand_${mimic_joint}" multiplier="${48 / 140}" offset="${40 * M_PI / 180}"/>
+ <mimic joint="bhand_${mimic_joint}" multiplier="${48 / 140}" offset="0.0"/>
</joint >
-
- </xacro:macro>
-
- <xacro:macro name="bhand_transmission" params="joint">
-
+
<transmission name="bhand_${joint}_transmission">
<type>transmission_interface/SimpleTransmission</type>
<joint name="bhand_${joint}">
</actuator>
</transmission>
+ <gazebo>
+ <plugin name="bhand_${joint}_mimic_plugin" filename="libroboticsgroup_gazebo_mimic_joint_plugin.so">
+ <joint>bhand_${mimic_joint}</joint>
+ <mimicJoint>bhand_${joint}</mimicJoint>
+ <multiplier>${48 / 140}</multiplier>
+ <offset>0.0</offset>
+ <maxEffor>30.0</maxEffor>
+ <sensitiveness>0.0</sensitiveness>
+ </plugin>
+ </gazebo>
+
+
</xacro:macro>
</robot>
<node name="controller_spawner" pkg="controller_manager" type="spawner"
respawn="false" output="screen"
- args="$(arg controller) joint_state_controller" />
+ args="$(arg controller)" />
+
+ <node name="joint_state_controller_spawner" pkg="controller_manager" type="spawner"
+ respawn="false" output="screen"
+ args="joint_state_controller" />
+
+ <rosparam if="$(arg bhand)" file="$(find bhand_bringup)/config/bhand_controller.yaml" command="load"/>
+
+ <node if="$(arg bhand)" name="bhand_controller_spawner" pkg="controller_manager" type="spawner"
+ respawn="false" output="screen"
+ args="bhand_controller" />
+
</launch>
rosservice call /gazebo/set_model_configuration wam joint \
"['wam_joint_1','wam_joint_2','wam_joint_3','wam_joint_4','wam_joint_5','wam_joint_6','wam_joint_7']" \
-"[0.0,-2.0,0.0,3.1,0.0,0.0,0.0]"
+"[0.0, -2.0, 0.0, 3.1, 0.0, 0.0, 0.0]"
rostopic pub /wam/controller/command \
trajectory_msgs/JointTrajectoryPoint \
-"[0.0,-2.0,0.0,3.1,0.0,0.0,0.0]" \
+"[0.0, -2.0, 0.0, 3.1, 0.0, 0.0, 0.0]" \
"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]" \
"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]" \
"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]" \
rostopic pub /controller/command \
trajectory_msgs/JointTrajectoryPoint \
-"[0.0,-2.0,0.0,3.1,0.0,0.0,0.0]" \
+"[0.0, -2.0, 0.0, 3.1, 0.0, 0.0, 0.0]" \
"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]" \
"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]" \
"[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]" \
<arg name="headless" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="table" default="true"/>
- <arg name="bhand" default="false"/>
+ <arg name="bhand" default="true"/>
<!-- This is the default Barrett WAM Controller, used by libbarrett -->
<arg name="controller" default="pid_plus_gravity_controller"/>