├── manipulator_h_base_module_msgs ├── msg │ ├── JointPose.msg │ └── KinematicsPose.msg ├── srv │ ├── GetKinematicsPose.srv │ └── GetJointPose.srv ├── package.xml ├── CHANGELOG.rst └── CMakeLists.txt ├── manipulator_h_gui ├── resources │ ├── images.qrc │ └── images │ │ └── icon.png ├── mainpage.dox ├── CHANGELOG.rst ├── package.xml ├── src │ ├── main.cpp │ ├── qnode.cpp │ └── main_window.cpp ├── CMakeLists.txt ├── include │ └── manipulator_h_gui │ │ ├── main_window.hpp │ │ └── qnode.hpp └── ui │ └── main_window.ui ├── manipulator_h ├── CMakeLists.txt ├── package.xml └── CHANGELOG.rst ├── manipulator_h_description ├── meshes │ ├── link_1.stl │ ├── link_2.stl │ ├── link_3.stl │ ├── link_4.stl │ ├── link_5.stl │ ├── link_6.stl │ └── end_link.stl ├── doc │ └── Robotis_ManipulatorH_Mass_Property.xlsx ├── launch │ ├── manipulator_h_rviz.launch │ └── manipulator_h.rviz ├── urdf │ ├── materials.xacro │ ├── manipulator_h.gazebo │ └── manipulator_h.xacro ├── CHANGELOG.rst ├── package.xml └── CMakeLists.txt ├── manipulator_h_manager ├── config │ ├── offset.yaml │ ├── ROBOTIS_MANIPULATOR_H.robot │ └── dxl_init.yaml ├── launch │ ├── manipulator_h_manager.launch │ └── manipulator_h_manager_gazebo.launch ├── package.xml ├── CHANGELOG.rst ├── src │ └── manipulator_h_manager.cpp └── CMakeLists.txt ├── manipulator_h_base_module ├── config │ └── ini_pose.yaml ├── CHANGELOG.rst ├── package.xml ├── include │ └── manipulator_h_base_module │ │ ├── robotis_state.h │ │ └── base_module.h ├── src │ ├── robotis_state.cpp │ └── base_module.cpp └── CMakeLists.txt ├── .gitignore ├── manipulator_h_gazebo ├── launch │ ├── effort_controller.launch │ ├── position_controller.launch │ └── manipulator_h_gazebo.launch ├── worlds │ └── empty.world ├── config │ ├── effort_controller.yaml │ └── position_controller.yaml ├── package.xml ├── CHANGELOG.rst └── CMakeLists.txt ├── .travis.yml ├── manipulator_h_bringup ├── package.xml ├── CHANGELOG.rst ├── launch │ └── robotis_manipulator.launch └── CMakeLists.txt ├── manipulator_h_kinematics_dynamics ├── CHANGELOG.rst ├── package.xml ├── include │ └── manipulator_h_kinematics_dynamics │ │ ├── manipulator_h_kinematics_dynamics_define.h │ │ ├── link_data.h │ │ └── manipulator_h_kinematics_dynamics.h ├── src │ ├── link_data.cpp │ └── manipulator_h_kinematics_dynamics.cpp └── CMakeLists.txt ├── README.md └── LICENSE /manipulator_h_base_module_msgs/msg/JointPose.msg: -------------------------------------------------------------------------------- 1 | string[] name 2 | float64[] value 3 | -------------------------------------------------------------------------------- /manipulator_h_base_module_msgs/msg/KinematicsPose.msg: -------------------------------------------------------------------------------- 1 | string name 2 | geometry_msgs/Pose pose 3 | -------------------------------------------------------------------------------- /manipulator_h_base_module_msgs/srv/GetKinematicsPose.srv: -------------------------------------------------------------------------------- 1 | string group_name 2 | --- 3 | geometry_msgs/Pose group_pose 4 | -------------------------------------------------------------------------------- /manipulator_h_base_module_msgs/srv/GetJointPose.srv: -------------------------------------------------------------------------------- 1 | string[] joint_name 2 | --- 3 | string[] joint_name 4 | float64[] joint_value 5 | -------------------------------------------------------------------------------- /manipulator_h_gui/resources/images.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/icon.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /manipulator_h/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(manipulator_h) 3 | find_package(catkin REQUIRED) 4 | catkin_metapackage() 5 | -------------------------------------------------------------------------------- /manipulator_h_description/meshes/link_1.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/link_1.stl -------------------------------------------------------------------------------- /manipulator_h_description/meshes/link_2.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/link_2.stl -------------------------------------------------------------------------------- /manipulator_h_description/meshes/link_3.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/link_3.stl -------------------------------------------------------------------------------- /manipulator_h_description/meshes/link_4.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/link_4.stl -------------------------------------------------------------------------------- /manipulator_h_description/meshes/link_5.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/link_5.stl -------------------------------------------------------------------------------- /manipulator_h_description/meshes/link_6.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/link_6.stl -------------------------------------------------------------------------------- /manipulator_h_gui/resources/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_gui/resources/images/icon.png -------------------------------------------------------------------------------- /manipulator_h_description/meshes/end_link.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/meshes/end_link.stl -------------------------------------------------------------------------------- /manipulator_h_description/doc/Robotis_ManipulatorH_Mass_Property.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/HEAD/manipulator_h_description/doc/Robotis_ManipulatorH_Mass_Property.xlsx -------------------------------------------------------------------------------- /manipulator_h_manager/config/offset.yaml: -------------------------------------------------------------------------------- 1 | offset: 2 | joint1: 0 3 | joint2: 0 4 | joint3: 0 5 | joint4: 0 6 | joint5: 0 7 | joint6: 0 8 | init_pose_for_offset_tuner: 9 | joint1: 0 10 | joint2: 0 11 | joint3: 0 12 | joint4: 0 13 | joint5: 0 14 | joint6: 0 15 | -------------------------------------------------------------------------------- /manipulator_h_base_module/config/ini_pose.yaml: -------------------------------------------------------------------------------- 1 | # time parameter 2 | 3 | mov_time : 3.0 # movement time 4 | 5 | # target pose [deg] 6 | 7 | tar_pose : 8 | 1 : 0.0 # joint 1 9 | 2 : -37.70 # joint 2 10 | 3 : 2.87 # joint 3 11 | 4 : 0.0 # joint 4 12 | 5 : 34.87 # joint 5 13 | 6 : 0.0 # joint 6 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | *.user 35 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/launch/effort_controller.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16 | 17 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/launch/position_controller.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 16 | 17 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/worlds/empty.world: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | model://ground_plane 8 | 9 | 10 | 11 | 12 | model://sun 13 | 14 | 15 | 16 | 17 | 18 | 2.0 -2.0 1.2 0.0 0.275643 2.356190 19 | orbit 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /manipulator_h_gui/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b manipulator_h_gui is ... 6 | 7 | 10 | 11 | 12 | \section codeapi Code API 13 | 14 | 24 | 25 | 26 | */ 27 | -------------------------------------------------------------------------------- /manipulator_h_manager/launch/manipulator_h_manager.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /manipulator_h_manager/launch/manipulator_h_manager_gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /manipulator_h_description/launch/manipulator_h_rviz.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /manipulator_h_description/urdf/materials.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # This config file for Travis CI utilizes ros-industrial/industrial_ci package. 2 | # For more info for the package, see https://github.com/ros-industrial/industrial_ci/blob/master/README.rst 3 | 4 | sudo: required 5 | dist: trusty 6 | services: 7 | - docker 8 | language: generic 9 | python: 10 | - "2.7" 11 | compiler: 12 | - gcc 13 | notifications: 14 | email: 15 | on_success: change 16 | on_failure: always 17 | recipients: 18 | - pyo@robotis.com 19 | env: 20 | matrix: 21 | - ROS_DISTRO=kinetic ROS_REPO=ros-shadow-fixed UPSTREAM_WORKSPACE=debian 22 | # - ROS_DISTRO=kinetic ROS_REPO=ros-shadow-fixed UPSTREAM_WORKSPACE=debian OS_NAME=debian OS_CODE_NAME=jessie 23 | branches: 24 | only: 25 | - master 26 | - develop 27 | - kinetic-devel 28 | install: 29 | - git clone https://github.com/ros-industrial/industrial_ci.git .ci_config 30 | script: 31 | - source .ci_config/travis.sh 32 | 33 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/config/effort_controller.yaml: -------------------------------------------------------------------------------- 1 | robotis_manipulator_h: 2 | # Publish all joint states ----------------------------------- 3 | joint_state_controller: 4 | type: joint_state_controller/JointStateController 5 | publish_rate: 125 6 | 7 | # Position Controllers --------------------------------------- 8 | joint1_effort: 9 | type: effort_controllers/JointEffortController 10 | joint: joint1 11 | 12 | joint2_effort: 13 | type: effort_controllers/JointEffortController 14 | joint: joint2 15 | 16 | joint3_effort: 17 | type: effort_controllers/JointEffortController 18 | joint: joint3 19 | 20 | joint4_effort: 21 | type: effort_controllers/JointEffortController 22 | joint: joint4 23 | 24 | joint5_effort: 25 | type: effort_controllers/JointEffortController 26 | joint: joint5 27 | 28 | joint6_effort: 29 | type: effort_controllers/JointEffortController 30 | joint: joint6 31 | -------------------------------------------------------------------------------- /manipulator_h_manager/config/ROBOTIS_MANIPULATOR_H.robot: -------------------------------------------------------------------------------- 1 | [ control info ] 2 | control_cycle = 8 # milliseconds 3 | 4 | [ port info ] 5 | # PORT NAME | BAUDRATE 6 | /dev/ttyUSB0 | 1000000 | joint1 7 | 8 | [ device info ] 9 | # TYPE | PORT NAME | ID | MODEL | PROTOCOL | DEV NAME | BULK READ ITEMS 10 | dynamixel | /dev/ttyUSB0 | 1 | H54-200-S500-R | 2.0 | joint1 | present_position, present_voltage 11 | dynamixel | /dev/ttyUSB0 | 2 | H54-200-S500-R | 2.0 | joint2 | present_position, present_voltage 12 | dynamixel | /dev/ttyUSB0 | 3 | H54-100-S500-R | 2.0 | joint3 | present_position, present_voltage 13 | dynamixel | /dev/ttyUSB0 | 4 | H54-100-S500-R | 2.0 | joint4 | present_position, present_voltage 14 | dynamixel | /dev/ttyUSB0 | 5 | H42-20-S300-R | 2.0 | joint5 | present_position, present_voltage 15 | dynamixel | /dev/ttyUSB0 | 6 | H42-20-S300-R | 2.0 | joint6 | present_position, present_voltage 16 | -------------------------------------------------------------------------------- /manipulator_h_gui/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_gui 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * none 8 | 9 | 0.3.0 (2018-03-23) 10 | ------------------ 11 | * modified build option and dependencies 12 | * changed license to Apache 2.0 13 | * changed package.xml format to v2 14 | * Contributors: Pyo 15 | 16 | 0.2.3 (2017-06-09) 17 | ------------------ 18 | * none 19 | 20 | 0.2.2 (2017-05-23) 21 | ------------------ 22 | * updated cmake file for ros install 23 | * deleted logs 24 | * Contributors: SCH 25 | 26 | 0.2.1 (2016-09-22) 27 | ------------------ 28 | * manipulator_h_gui: package.xml cmake_modules dependency added 29 | * manipulator_h_description: for indigo option 30 | * Contributors: SCH 31 | 32 | 0.2.0 (2016-08-19) 33 | ------------------- 34 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 35 | * Contributors: SCH, Pyo 36 | -------------------------------------------------------------------------------- /manipulator_h_manager/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_manager 4 | 0.3.1 5 | 6 | The manipulator_h_manager package 7 | This package describes robot manager to execute manipulator_h_base_module. 8 | 9 | Apache 2.0 10 | SCH 11 | Pyo 12 | http://wiki.ros.org/manipulator_h_manager 13 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 14 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 16 | catkin 17 | roscpp 18 | robotis_controller 19 | manipulator_h_base_module 20 | 21 | -------------------------------------------------------------------------------- /manipulator_h_bringup/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_bringup 4 | 0.3.1 5 | 6 | The manipulator_h_bringup package 7 | This package includes launch file to describe robotis in Rviz. 8 | 9 | Apache 2.0 10 | SCH 11 | Pyo 12 | http://wiki.ros.org/manipulator_h_bringup 13 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 14 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 16 | catkin 17 | joint_state_publisher 18 | robot_state_publisher 19 | rviz 20 | 21 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_gazebo 4 | 0.3.1 5 | 6 | The manipulator_h_gazebo package 7 | This package provides GAZEBO simulation environment for ROBOTIS MANIPULATOR-H. 8 | We provides two controllers such as position and effort controllers. 9 | 10 | Apache 2.0 11 | SCH 12 | Pyo 13 | http://wiki.ros.org/manipulator_h_gazebo 14 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 16 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 17 | catkin 18 | controller_manager 19 | gazebo_ros 20 | 21 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_gazebo 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * none 8 | 9 | 0.3.0 (2018-03-23) 10 | ------------------ 11 | * modified build option and dependencies 12 | * changed license to Apache 2.0 13 | * changed package.xml format to v2 14 | * Contributors: Pyo 15 | 16 | 0.2.3 (2017-06-09) 17 | ------------------ 18 | * none 19 | 20 | 0.2.2 (2017-05-23) 21 | ------------------ 22 | * updated cmake file for ros install 23 | * Contributors: SCH 24 | 25 | 0.2.1 (2016-09-22) 26 | ------------------ 27 | * manipulator_h_gui: package.xml cmake_modules dependency added 28 | * manipulator_h_description: for indigo option 29 | * Contributors: SCH 30 | 31 | 0.2.0 (2016-08-19) 32 | ------------------- 33 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 34 | * Contributors: SCH 35 | 36 | 0.1.1 (2016-08-11) 37 | ------------------- 38 | * first public release for Kinetic 39 | * Contributors: SCH, Pyo 40 | -------------------------------------------------------------------------------- /manipulator_h_bringup/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_bringup 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * none 8 | 9 | 0.3.0 (2018-03-23) 10 | ------------------ 11 | * modified build option and dependencies 12 | * changed license to Apache 2.0 13 | * changed package.xml format to v2 14 | * Contributors: Pyo 15 | 16 | 0.2.3 (2017-06-09) 17 | ------------------ 18 | * none 19 | 20 | 0.2.2 (2017-05-23) 21 | ------------------ 22 | * updated cmake file for ros install 23 | * Contributors: SCH 24 | 25 | 0.2.1 (2016-09-22) 26 | ------------------ 27 | * manipulator_h_gui: package.xml cmake_modules dependency added 28 | * manipulator_h_description: for indigo option 29 | * Contributors: SCH 30 | 31 | 0.2.0 (2016-08-19) 32 | ------------------- 33 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 34 | * Contributors: SCH 35 | 36 | 0.1.1 (2016-08-11) 37 | ------------------- 38 | * first public release for Kinetic 39 | * Contributors: SCH, Pyo 40 | -------------------------------------------------------------------------------- /manipulator_h_description/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_description 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * none 8 | 9 | 0.3.0 (2018-03-23) 10 | ------------------ 11 | * modified build option and dependencies 12 | * changed license to Apache 2.0 13 | * changed package.xml format to v2 14 | * Contributors: Pyo 15 | 16 | 0.2.3 (2017-06-09) 17 | ------------------ 18 | * none 19 | 20 | 0.2.2 (2017-05-23) 21 | ------------------ 22 | * updated cmake file for ros install 23 | * Contributors: SCH 24 | 25 | 0.2.1 (2016-09-22) 26 | ------------------ 27 | * manipulator_h_gui: package.xml cmake_modules dependency added 28 | * manipulator_h_description: for indigo option 29 | * Contributors: SCH 30 | 31 | 0.2.0 (2016-08-19) 32 | ------------------- 33 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 34 | * Contributors: SCH 35 | 36 | 0.1.1 (2016-08-11) 37 | ------------------- 38 | * first public release for Kinetic 39 | * Contributors: SCH, Pyo 40 | -------------------------------------------------------------------------------- /manipulator_h_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_description 4 | 0.3.1 5 | 6 | The manipulator_h_description package 7 | This package includes URDF model of ROBOTIS MANIPULATOR-H. 8 | Additionally, we provide full kinematics and dynamics information of each link. 9 | 10 | Apache 2.0 11 | SCH 12 | Pyo 13 | http://wiki.ros.org/manipulator_h_description 14 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 16 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 17 | catkin 18 | joint_state_publisher 19 | robot_state_publisher 20 | rviz 21 | 22 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_kinematics_dynamics 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * none 8 | 9 | 0.3.0 (2018-03-23) 10 | ------------------ 11 | * modified build option and dependencies 12 | * changed license to Apache 2.0 13 | * changed package.xml format to v2 14 | * Contributors: Pyo 15 | 16 | 0.2.3 (2017-06-09) 17 | ------------------ 18 | * none 19 | 20 | 0.2.2 (2017-05-23) 21 | ------------------ 22 | * updated cmake file for ros install 23 | * Contributors: SCH 24 | 25 | 0.2.1 (2016-09-22) 26 | ------------------ 27 | * manipulator_h_gui: package.xml cmake_modules dependency added 28 | * manipulator_h_description: for indigo option 29 | * Contributors: SCH 30 | 31 | 0.2.0 (2016-08-19) 32 | ------------------- 33 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 34 | * Contributors: SCH 35 | 36 | 0.1.1 (2016-08-11) 37 | ------------------- 38 | * first public release for Kinetic 39 | * Contributors: SCH, Pyo 40 | -------------------------------------------------------------------------------- /manipulator_h_base_module_msgs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_base_module_msgs 4 | 0.3.1 5 | 6 | The manipulator_h_base_module_msgs package 7 | This package includes ROS messages and services for manipulator_h_base_module_msgs 8 | 9 | Apache 2.0 10 | SCH 11 | Pyo 12 | http://wiki.ros.org/manipulator_h_base_module_msgs 13 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 14 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 16 | catkin 17 | std_msgs 18 | geometry_msgs 19 | message_generation 20 | message_runtime 21 | message_runtime 22 | 23 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_kinematics_dynamics 4 | 0.3.1 5 | 6 | The manipulator_h_kinematics_dynamics package 7 | This packages provides library of kinematics and dynamics information for ROBOTIS MANIPULATOR-H. 8 | Additionally, there are some function to calculate kinematics and dynamics. 9 | 10 | Apache 2.0 11 | SCH 12 | Pyo 13 | http://wiki.ros.org/manipulator_h_kinematics_dynamics 14 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 16 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 17 | catkin 18 | roscpp 19 | robotis_math 20 | cmake_modules 21 | eigen 22 | 23 | -------------------------------------------------------------------------------- /manipulator_h_base_module_msgs/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_base_module_msgs 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * added roslib for catkin dependencies 8 | * Contributors: Pyo 9 | 10 | 0.3.0 (2018-03-23) 11 | ------------------ 12 | * modified build option and dependencies 13 | * changed license to Apache 2.0 14 | * changed package.xml format to v2 15 | * Contributors: Pyo 16 | 17 | 0.2.3 (2017-06-09) 18 | ------------------- 19 | * none 20 | 21 | 0.2.2 (2017-05-23) 22 | ------------------- 23 | * updated cmake file for ros install 24 | * Contributors: SCH 25 | 26 | 0.2.1 (2016-09-22) 27 | ------------------- 28 | * manipulator_h_gui: package.xml cmake_modules dependency added 29 | * manipulator_h_description: for indigo option 30 | * Contributors: SCH 31 | 32 | 0.2.0 (2016-08-19) 33 | ------------------- 34 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 35 | * Contributors: SCH 36 | 37 | 0.1.1 (2016-08-11) 38 | ------------------- 39 | * first public release for Kinetic 40 | * Contributors: SCH, Pyo 41 | -------------------------------------------------------------------------------- /manipulator_h_manager/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_manager 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * none 8 | 9 | 0.3.0 (2018-03-23) 10 | ------------------ 11 | * modified build option and dependencies 12 | * changed license to Apache 2.0 13 | * changed package.xml format to v2 14 | * changed manager's default value 15 | * Contributors: Pyo, SCH 16 | 17 | 0.2.3 (2017-06-09) 18 | ------------------ 19 | * none 20 | 21 | 0.2.2 (2017-05-23) 22 | ------------------ 23 | * updated cmake file for ros install 24 | * added a control cycle in robot file 25 | * Contributors: SCH 26 | 27 | 0.2.1 (2016-09-22) 28 | ------------------ 29 | * manipulator_h_gui: package.xml cmake_modules dependency added 30 | * manipulator_h_description: for indigo option 31 | * Contributors: SCH 32 | 33 | 0.2.0 (2016-08-19) 34 | ------------------- 35 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 36 | * Contributors: SCH 37 | 38 | 0.1.1 (2016-08-11) 39 | ------------------- 40 | * first public release for Kinetic 41 | * Contributors: s-changhyun, pyo 42 | -------------------------------------------------------------------------------- /manipulator_h_gui/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_gui 4 | 0.3.1 5 | 6 | The manipulator_h_gui package 7 | This package provides simple GUI to control ROBOTIS MANIPULATOR-H. 8 | This GUI is connected to manipulator_h_base_module. 9 | 10 | Apache 2.0 11 | SCH 12 | Pyo 13 | http://wiki.ros.org/manipulator_h_gui 14 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 15 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 16 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 17 | catkin 18 | roscpp 19 | robotis_controller_msgs 20 | manipulator_h_base_module_msgs 21 | qt_build 22 | libqt4-dev 23 | cmake_modules 24 | eigen_conversions 25 | eigen 26 | 27 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/config/position_controller.yaml: -------------------------------------------------------------------------------- 1 | robotis_manipulator_h: 2 | # Publish all joint states ----------------------------------- 3 | joint_state_controller: 4 | type: joint_state_controller/JointStateController 5 | publish_rate: 125 6 | 7 | # Position Controllers --------------------------------------- 8 | joint1_position: 9 | type: effort_controllers/JointPositionController 10 | joint: joint1 11 | pid: {p: 9000.0, i: 0.1, d: 500.0} 12 | 13 | joint2_position: 14 | type: effort_controllers/JointPositionController 15 | joint: joint2 16 | pid: {p: 9000.0, i: 0.1, d: 500.0} 17 | 18 | joint3_position: 19 | type: effort_controllers/JointPositionController 20 | joint: joint3 21 | pid: {p: 6000.0, i: 0.1, d: 400.0} 22 | 23 | joint4_position: 24 | type: effort_controllers/JointPositionController 25 | joint: joint4 26 | pid: {p: 6000.0, i: 0.1, d: 400.0} 27 | 28 | joint5_position: 29 | type: effort_controllers/JointPositionController 30 | joint: joint5 31 | pid: {p: 6000.0, i: 0.1, d: 400.0} 32 | 33 | joint6_position: 34 | type: effort_controllers/JointPositionController 35 | joint: joint6 36 | pid: {p: 6000.0, i: 0.1, d: 400.0} 37 | -------------------------------------------------------------------------------- /manipulator_h_bringup/launch/robotis_manipulator.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ["robotis/present_joint_states"] 14 | ["robotis/goal_joint_states"] 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /manipulator_h/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h 4 | 0.3.1 5 | 6 | ROS packages for the ROBOTIS MANIPULATOR-H (metapackage) 7 | 8 | Apache 2.0 9 | SCH 10 | Pyo 11 | http://wiki.ros.org/manipulator_h 12 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 13 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 14 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 15 | catkin 16 | manipulator_h_base_module 17 | manipulator_h_base_module_msgs 18 | manipulator_h_bringup 19 | manipulator_h_description 20 | manipulator_h_gazebo 21 | manipulator_h_gui 22 | manipulator_h_kinematics_dynamics 23 | manipulator_h_manager 24 | 25 | 26 | -------------------------------------------------------------------------------- /manipulator_h_base_module/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h_base_module 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * added roslib for catkin dependencies 8 | * Contributors: Pyo 9 | 10 | 0.3.0 (2018-03-23) 11 | ------------------ 12 | * modified build option and dependencies 13 | * changed license to Apache 2.0 14 | * changed package.xml format to v2 15 | * changed cmake & package setting for yaml-cpp 16 | * Contributors: Pyo, SCH 17 | 18 | 0.2.3 (2017-06-09) 19 | ------------------ 20 | * updated CMakeLists.txt & package.yaml to release binary packages 21 | * Contributors: SCH 22 | 23 | 0.2.2 (2017-05-23) 24 | ------------------ 25 | * updated cmake file for ros install 26 | * Contributors: SCH 27 | 28 | 0.2.1 (2016-09-22) 29 | ------------------ 30 | * manipulator_h_gui: package.xml cmake_modules dependency added 31 | * manipulator_h_description: for indigo option 32 | * Contributors: SCH 33 | 34 | 0.2.0 (2016-08-19) 35 | ------------------ 36 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 37 | * Contributors: SCH 38 | 39 | 0.1.1 (2016-08-11) 40 | ------------------- 41 | * first public release for Kinetic 42 | * Contributors: SCH, Pyo 43 | -------------------------------------------------------------------------------- /manipulator_h/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package manipulator_h 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.3.1 (2018-03-26) 6 | ------------------ 7 | * added roslib for catkin dependencies 8 | * Contributors: Pyo 9 | 10 | 0.3.0 (2018-03-23) 11 | ------------------ 12 | * modified build option and dependencies 13 | * changed license to Apache 2.0 14 | * changed package.xml format to v2 15 | * changed cmake & package setting for yaml-cpp 16 | * changed manager's default value 17 | * Contributors: SCH, Pyo 18 | 19 | 0.2.3 (2017-06-09) 20 | ------------------ 21 | * updated CMakeLists.txt & package.yaml to release binary packages 22 | * Contributors: SCH 23 | 24 | 0.2.2 (2017-05-23) 25 | ------------------ 26 | * updated cmake file for ros install 27 | * Contributors: SCH 28 | 29 | 0.2.1 (2016-09-22) 30 | ------------------ 31 | * manipulator_h_gui: package.xml cmake_modules dependency added 32 | * manipulator_h_description: for indigo option 33 | * Contributors: SCH 34 | 35 | 0.2.0 (2016-08-19) 36 | ------------------- 37 | * added manipulator_h_gui package that GUI tool to control ROBOTIS MANIPULATOR-H 38 | * Contributors: SCH 39 | 40 | 0.1.1 (2016-08-11) 41 | ------------------- 42 | * first public release for Kinetic 43 | * applied the semantic versioning 44 | * add a meta-package 45 | * Contributors: SCH, Pyo 46 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/include/manipulator_h_kinematics_dynamics/manipulator_h_kinematics_dynamics_define.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | #ifndef MANIPULATOR_KINEMATICS_DYNAMICS_MANIPULATOR_KINEMATICS_DYNAMICS_DEFINE_H_ 18 | #define MANIPULATOR_KINEMATICS_DYNAMICS_MANIPULATOR_KINEMATICS_DYNAMICS_DEFINE_H_ 19 | 20 | namespace robotis_manipulator_h 21 | { 22 | 23 | #define MAX_JOINT_ID 6 24 | #define ALL_JOINT_ID 7 25 | 26 | #define MAX_ITER 10 27 | 28 | #define END_LINK 7 29 | 30 | #define PRINT_MAT(X) std::cout << #X << ":\n" << X << std::endl << std::endl 31 | 32 | } 33 | 34 | #endif /* MANIPULATOR_KINEMATICS_DYNAMICS_MANIPULATOR_KINEMATICS_DYNAMICS_DEFINE_H_ */ 35 | -------------------------------------------------------------------------------- /manipulator_h_base_module/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | manipulator_h_base_module 4 | 0.3.1 5 | 6 | The manipulator_h_base_module package 7 | This package describes basic function to control ROBOTIS MANIPULATOR-H. 8 | This module is based on position control. 9 | We provides joint space and task space control (forward kinematics, inverse kinematics). 10 | 11 | Apache 2.0 12 | SCH 13 | Pyo 14 | http://wiki.ros.org/manipulator_h_base_module 15 | http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/ 16 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H 17 | https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H/issues 18 | catkin 19 | roscpp 20 | roslib 21 | std_msgs 22 | geometry_msgs 23 | robotis_controller_msgs 24 | manipulator_h_base_module_msgs 25 | cmake_modules 26 | robotis_math 27 | robotis_framework_common 28 | manipulator_h_kinematics_dynamics 29 | boost 30 | eigen 31 | yaml-cpp 32 | 33 | -------------------------------------------------------------------------------- /manipulator_h_description/urdf/manipulator_h.gazebo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | /robotis_manipulator_h 8 | gazebo_ros_control/DefaultRobotHWSim 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 0.2 19 | 0.2 20 | Gazebo/Grey 21 | 22 | 23 | 24 | 25 | 0.2 26 | 0.2 27 | Gazebo/Grey 28 | 29 | 30 | 31 | 32 | 0.2 33 | 0.2 34 | Gazebo/Grey 35 | 36 | 37 | 38 | 39 | 0.2 40 | 0.2 41 | Gazebo/Grey 42 | 43 | 44 | 45 | 46 | 0.2 47 | 0.2 48 | Gazebo/Grey 49 | 50 | 51 | 52 | 53 | 0.2 54 | 0.2 55 | Gazebo/Grey 56 | 57 | 58 | 59 | 60 | 0.2 61 | 0.2 62 | Gazebo/Grey 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/launch/manipulator_h_gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /manipulator_h_gui/src/main.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /** 18 | * @file /src/main.cpp 19 | * 20 | * @brief Qt based gui. 21 | * 22 | * @date November 2010 23 | **/ 24 | /***************************************************************************** 25 | ** Includes 26 | *****************************************************************************/ 27 | 28 | #include 29 | #include 30 | #include "manipulator_h_gui/main_window.hpp" 31 | 32 | /***************************************************************************** 33 | ** Main 34 | *****************************************************************************/ 35 | 36 | int main(int argc, char **argv) { 37 | 38 | /********************* 39 | ** Qt 40 | **********************/ 41 | QApplication app(argc, argv); 42 | manipulator_h_gui::MainWindow w(argc,argv); 43 | w.show(); 44 | app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); 45 | int result = app.exec(); 46 | 47 | return result; 48 | } 49 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/include/manipulator_h_kinematics_dynamics/link_data.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | #ifndef MANIPULATOR_KINEMATICS_DYNAMICS_LINK_DATA_H_ 18 | #define MANIPULATOR_KINEMATICS_DYNAMICS_LINK_DATA_H_ 19 | 20 | #include "robotis_math/robotis_math.h" 21 | 22 | namespace robotis_manipulator_h 23 | { 24 | 25 | class LinkData 26 | { 27 | public: 28 | LinkData(); 29 | ~LinkData(); 30 | 31 | std::string name_; 32 | 33 | int parent_; 34 | int sibling_; 35 | int child_; 36 | 37 | double mass_; 38 | 39 | Eigen::MatrixXd relative_position_; 40 | Eigen::MatrixXd joint_axis_; 41 | Eigen::MatrixXd center_of_mass_; 42 | Eigen::MatrixXd inertia_; 43 | 44 | double joint_limit_max_; 45 | double joint_limit_min_; 46 | 47 | double joint_angle_; 48 | double joint_velocity_; 49 | double joint_acceleration_; 50 | 51 | Eigen::MatrixXd position_; 52 | Eigen::MatrixXd orientation_; 53 | Eigen::MatrixXd transformation_; 54 | }; 55 | 56 | } 57 | 58 | #endif /* MANIPULATOR_KINEMATICS_DYNAMICS_LINK_DATA_H_ */ 59 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/src/link_data.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * Link.cpp 19 | * 20 | * Created on: Jan 11, 2016 21 | * Author: SCH 22 | */ 23 | 24 | #include "manipulator_h_kinematics_dynamics/link_data.h" 25 | 26 | namespace robotis_manipulator_h 27 | { 28 | 29 | LinkData::LinkData() 30 | { 31 | name_ = ""; 32 | 33 | parent_ = -1; 34 | sibling_ = -1; 35 | child_ = -1; 36 | 37 | mass_ = 0.0; 38 | 39 | relative_position_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 40 | joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 41 | center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 42 | inertia_ = robotis_framework::getInertiaXYZ(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 43 | 44 | joint_limit_max_ = 100.0; 45 | joint_limit_min_ = -100.0; 46 | 47 | joint_angle_ = 0.0; 48 | joint_velocity_ = 0.0; 49 | joint_acceleration_ = 0.0; 50 | 51 | position_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 52 | orientation_ = robotis_framework::convertRPYToRotation(0.0, 0.0, 0.0); 53 | transformation_ = robotis_framework::getTransformationXYZRPY(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 54 | } 55 | 56 | LinkData::~LinkData() 57 | { 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /manipulator_h_gazebo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_gazebo) 6 | 7 | ################################################################################ 8 | # Packages 9 | ################################################################################ 10 | find_package(catkin REQUIRED) 11 | 12 | ################################################################################ 13 | # Setup for python modules and scripts 14 | ################################################################################ 15 | 16 | ################################################################################ 17 | # Declare ROS messages, services and actions 18 | ################################################################################ 19 | 20 | ################################################################################ 21 | # Declare ROS dynamic reconfigure parameters 22 | ################################################################################ 23 | 24 | ################################################################################ 25 | # Declare catkin specific configuration to be passed to dependent projects 26 | ################################################################################ 27 | catkin_package() 28 | 29 | ################################################################################ 30 | # Build 31 | ################################################################################ 32 | 33 | ################################################################################ 34 | # Install 35 | ################################################################################ 36 | install(DIRECTORY config launch worlds 37 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 38 | ) 39 | 40 | ################################################################################ 41 | # Test 42 | ################################################################################ 43 | -------------------------------------------------------------------------------- /manipulator_h_bringup/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_bringup) 6 | 7 | ################################################################################ 8 | # Find catkin packages and libraries for catkin and system dependencies 9 | ################################################################################ 10 | find_package(catkin REQUIRED) 11 | 12 | ################################################################################ 13 | # Setup for python modules and scripts 14 | ################################################################################ 15 | 16 | ################################################################################ 17 | # Declare ROS messages, services and actions 18 | ################################################################################ 19 | 20 | ################################################################################ 21 | # Declare ROS dynamic reconfigure parameters 22 | ################################################################################ 23 | 24 | ################################################################################ 25 | # Declare catkin specific configuration to be passed to dependent projects 26 | ################################################################################ 27 | catkin_package() 28 | 29 | ################################################################################ 30 | # Build 31 | ################################################################################ 32 | 33 | ################################################################################ 34 | # Install 35 | ################################################################################ 36 | install(DIRECTORY launch 37 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 38 | ) 39 | 40 | ################################################################################ 41 | # Test 42 | ################################################################################ 43 | -------------------------------------------------------------------------------- /manipulator_h_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_description) 6 | 7 | ################################################################################ 8 | # Find catkin packages and libraries for catkin and system dependencies 9 | ################################################################################ 10 | find_package(catkin REQUIRED) 11 | 12 | ################################################################################ 13 | # Setup for python modules and scripts 14 | ################################################################################ 15 | 16 | ################################################################################ 17 | # Declare ROS messages, services and actions 18 | ################################################################################ 19 | 20 | ################################################################################ 21 | # Declare ROS dynamic reconfigure parameters 22 | ################################################################################ 23 | 24 | ################################################################################ 25 | # Declare catkin specific configuration to be passed to dependent projects 26 | ################################################################################ 27 | catkin_package() 28 | 29 | ################################################################################ 30 | # Build 31 | ################################################################################ 32 | 33 | ################################################################################ 34 | # Install 35 | ################################################################################ 36 | install(DIRECTORY doc launch meshes urdf 37 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 38 | ) 39 | 40 | ################################################################################ 41 | # Test 42 | ################################################################################ 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ROBOTIS MANIPULATOR-H 2 | ![](http://emanual.robotis.com/assets/images/platform/manipulator/manipulator_product.gif) 3 | 4 | ## ROS Packages for ROBOTIS MANIPULATOR-H 5 | 6 | |Version|Kinetic + Ubuntu Xenial|Melodic + Ubuntu Bionic| 7 | |:---:|:---:|:---:| 8 | |[![GitHub version](https://badge.fury.io/gh/ROBOTIS-GIT%2FROBOTIS-MANIPULATOR-H.svg)](https://badge.fury.io/gh/ROBOTIS-GIT%2FROBOTIS-MANIPULATOR-H)|[![Build Status](https://travis-ci.org/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H.svg?branch=kinetic-devel)](https://travis-ci.org/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H)|-| 9 | 10 | ## ROBOTIS e-Manual for ROBOTIS MANIPULATOR-H 11 | - [ROBOTIS e-Manual for ROBOTIS MANIPULATOR-H](http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/) 12 | 13 | ## Wiki for manipulator_h Packages 14 | - http://wiki.ros.org/manipulator_h (metapackage) 15 | - http://wiki.ros.org/manipulator_h_base_module 16 | - http://wiki.ros.org/manipulator_h_base_module_msgs 17 | - http://wiki.ros.org/manipulator_h_bringup 18 | - http://wiki.ros.org/manipulator_h_description 19 | - http://wiki.ros.org/manipulator_h_gazebo 20 | - http://wiki.ros.org/manipulator_h_gui 21 | - http://wiki.ros.org/manipulator_h_kinematics_dynamics 22 | - http://wiki.ros.org/manipulator_h_manager 23 | 24 | ## Open Source related to ROBOTIS-MANIPULATOR-H 25 | - [manipulator_h](https://github.com/ROBOTIS-GIT/ROBOTIS-MANIPULATOR-H) 26 | - [rh_p12_rn](https://github.com/ROBOTIS-GIT/RH-P12-RN) 27 | - [robotis_framework](https://github.com/ROBOTIS-GIT/ROBOTIS-Framework) 28 | - [robotis_controller_msgs](https://github.com/ROBOTIS-GIT/ROBOTIS-Framework-msgs) 29 | - [robotis_math](https://github.com/ROBOTIS-GIT/ROBOTIS-Math) 30 | - [dynamixel_sdk](https://github.com/ROBOTIS-GIT/DynamixelSDK) 31 | 32 | ## Documents and Videos related to ROBOTIS-MANIPULATOR-H 33 | - [ROBOTIS e-Manual for ROBOTIS MANIPULATOR-H](http://emanual.robotis.com/docs/en/platform/manipulator_h/introduction/) 34 | - [ROBOTIS e-Manual for RH-P12-RN](http://emanual.robotis.com/docs/en/platform/rh_p12_rn/) 35 | - [ROBOTIS e-Manual for ROBOTIS Framework](http://emanual.robotis.com/docs/en/software/robotis_framework_packages/) 36 | - [ROBOTIS e-Manual for Dynamixel SDK](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/overview/) 37 | -------------------------------------------------------------------------------- /manipulator_h_base_module/include/manipulator_h_base_module/robotis_state.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | #ifndef MANIPULATOR_BASE_MODULE_ROBOTIS_STATE_H_ 18 | #define MANIPULATOR_BASE_MODULE_ROBOTIS_STATE_H_ 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include "robotis_math/robotis_math.h" 26 | 27 | #include "manipulator_h_base_module_msgs/JointPose.h" 28 | #include "manipulator_h_base_module_msgs/KinematicsPose.h" 29 | #include "manipulator_h_kinematics_dynamics/manipulator_h_kinematics_dynamics.h" 30 | 31 | namespace robotis_manipulator_h 32 | { 33 | 34 | class RobotisState 35 | { 36 | public: 37 | RobotisState(); 38 | ~RobotisState(); 39 | 40 | bool is_moving_; 41 | 42 | // trajectory 43 | int cnt_; 44 | int all_time_steps_; 45 | double mov_time_; 46 | double smp_time_; 47 | 48 | Eigen::MatrixXd calc_joint_tra_; 49 | Eigen::MatrixXd calc_task_tra_; 50 | 51 | Eigen::MatrixXd joint_ini_pose_; 52 | 53 | // msgs 54 | manipulator_h_base_module_msgs::JointPose joint_pose_msg_; 55 | manipulator_h_base_module_msgs::KinematicsPose kinematics_pose_msg_; 56 | 57 | // inverse kinematics 58 | bool ik_solve_; 59 | Eigen::MatrixXd ik_target_position_; 60 | Eigen::MatrixXd ik_start_rotation_, ik_target_rotation_; 61 | int ik_id_start_, ik_id_end_; 62 | 63 | void setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation); 64 | }; 65 | 66 | } 67 | 68 | #endif /* MANIPULATOR_BASE_MODULE_ROBOTIS_STATE_H_ */ 69 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/include/manipulator_h_kinematics_dynamics/manipulator_h_kinematics_dynamics.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | #ifndef MANIPULATOR_KINEMATICS_DYNAMICS_MANIPULATOR_KINEMATICS_DYNAMICS_H_ 18 | #define MANIPULATOR_KINEMATICS_DYNAMICS_MANIPULATOR_KINEMATICS_DYNAMICS_H_ 19 | 20 | #include 21 | 22 | #include "link_data.h" 23 | #include "manipulator_h_kinematics_dynamics_define.h" 24 | 25 | namespace robotis_manipulator_h 26 | { 27 | 28 | enum TreeSelect 29 | { 30 | ARM 31 | }; 32 | 33 | class ManipulatorKinematicsDynamics 34 | { 35 | public: 36 | ManipulatorKinematicsDynamics(); 37 | ManipulatorKinematicsDynamics(TreeSelect tree); 38 | ~ManipulatorKinematicsDynamics(); 39 | 40 | LinkData *manipulator_link_data_[ ALL_JOINT_ID + 1]; 41 | 42 | std::vector findRoute(int to); 43 | std::vector findRoute(int from, int to); 44 | 45 | double totalMass(int joint_ID); 46 | Eigen::MatrixXd calcMC(int joint_ID); 47 | Eigen::MatrixXd calcCOM(Eigen::MatrixXd MC); 48 | 49 | void forwardKinematics(int joint_ID); 50 | 51 | Eigen::MatrixXd calcJacobian(std::vector idx); 52 | Eigen::MatrixXd calcJacobianCOM(std::vector idx); 53 | Eigen::MatrixXd calcVWerr(Eigen::MatrixXd tar_position, Eigen::MatrixXd curr_position, 54 | Eigen::MatrixXd tar_orientation, Eigen::MatrixXd curr_orientation); 55 | 56 | bool inverseKinematics(int to, Eigen::MatrixXd tar_position, Eigen::MatrixXd tar_orientation, 57 | int max_iter, double ik_err); 58 | bool inverseKinematics(int from, int to, Eigen::MatrixXd tar_position, Eigen::MatrixXd tar_orientation, 59 | int max_iter, double ik_err); 60 | }; 61 | 62 | } 63 | 64 | #endif /* MANIPULATOR_KINEMATICS_DYNAMICS_MANIPULATOR_KINEMATICS_DYNAMICS_H_ */ 65 | -------------------------------------------------------------------------------- /manipulator_h_base_module_msgs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_base_module_msgs) 6 | 7 | ################################################################################ 8 | # Find catkin packages and libraries for catkin and system dependencies 9 | ################################################################################ 10 | find_package(catkin REQUIRED COMPONENTS 11 | std_msgs 12 | geometry_msgs 13 | message_generation 14 | ) 15 | 16 | ################################################################################ 17 | # Setup for python modules and scripts 18 | ################################################################################ 19 | 20 | ################################################################################ 21 | # Declare ROS messages, services and actions 22 | ################################################################################ 23 | add_message_files( 24 | FILES 25 | JointPose.msg 26 | KinematicsPose.msg 27 | ) 28 | 29 | add_service_files( 30 | FILES 31 | GetJointPose.srv 32 | GetKinematicsPose.srv 33 | ) 34 | 35 | generate_messages( 36 | DEPENDENCIES 37 | std_msgs 38 | geometry_msgs 39 | ) 40 | 41 | ################################################################################ 42 | # Declare ROS dynamic reconfigure parameters 43 | ################################################################################ 44 | 45 | ################################################################################ 46 | # Declare catkin specific configuration to be passed to dependent projects 47 | ################################################################################ 48 | catkin_package( 49 | CATKIN_DEPENDS std_msgs geometry_msgs message_runtime 50 | ) 51 | 52 | ################################################################################ 53 | # Build 54 | ################################################################################ 55 | include_directories( 56 | ${catkin_INCLUDE_DIRS} 57 | ) 58 | 59 | ################################################################################ 60 | # Install 61 | ################################################################################ 62 | 63 | ################################################################################ 64 | # Test 65 | ################################################################################ 66 | -------------------------------------------------------------------------------- /manipulator_h_manager/src/manipulator_h_manager.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * RobotisManager.cpp 19 | * 20 | * Created on: 2016. 1. 21. 21 | * Author: Zerom 22 | */ 23 | 24 | #include "manipulator_h_base_module/base_module.h" 25 | #include "robotis_controller/robotis_controller.h" 26 | 27 | /* Motion Module Header */ 28 | 29 | using namespace robotis_manipulator_h; 30 | 31 | int main(int argc, char **argv) 32 | { 33 | ros::init(argc, argv, "Robotis_Manipulator_H_Manager"); 34 | ros::NodeHandle nh; 35 | 36 | ROS_INFO("manager->init"); 37 | robotis_framework::RobotisController *controller = robotis_framework::RobotisController::getInstance(); 38 | 39 | /* Load ROS Parameter */ 40 | std::string offset_file = nh.param("offset_table", ""); 41 | std::string robot_file = nh.param("robot_file_path", ""); 42 | 43 | std::string init_file = nh.param("init_file_path", ""); 44 | 45 | /* gazebo simulation */ 46 | controller->gazebo_mode_ = nh.param("gazebo", false); 47 | if (controller->gazebo_mode_ == true) 48 | { 49 | std::string robot_name = nh.param("gazebo_robot_name", ""); 50 | if (robot_name != "") 51 | controller->gazebo_robot_name_ = robot_name; 52 | } 53 | 54 | if (robot_file == "") 55 | { 56 | ROS_ERROR("NO robot file path in the ROS parameters."); 57 | return -1; 58 | } 59 | 60 | if (controller->initialize(robot_file, init_file) == false) 61 | { 62 | ROS_ERROR("ROBOTIS Controller Initialize Fail!"); 63 | return -1; 64 | } 65 | 66 | if (offset_file != "") 67 | controller->loadOffset(offset_file); 68 | 69 | sleep(1); 70 | 71 | /* Add Motion Module */ 72 | controller->addMotionModule((robotis_framework::MotionModule*) BaseModule::getInstance()); 73 | 74 | controller->startTimer(); 75 | 76 | while (ros::ok()) 77 | { 78 | usleep(100); 79 | } 80 | 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /manipulator_h_base_module/src/robotis_state.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * Link.cpp 19 | * 20 | * Created on: Jan 11, 2016 21 | * Author: SCH 22 | */ 23 | 24 | #include "manipulator_h_base_module/robotis_state.h" 25 | 26 | using namespace robotis_manipulator_h; 27 | 28 | RobotisState::RobotisState() 29 | { 30 | is_moving_ = false; 31 | 32 | cnt_ = 0; 33 | mov_time_ = 1.0; 34 | smp_time_ = 0.008; 35 | all_time_steps_ = int(mov_time_ / smp_time_) + 1; 36 | 37 | calc_joint_tra_ = Eigen::MatrixXd::Zero(all_time_steps_, MAX_JOINT_ID + 1); 38 | calc_task_tra_ = Eigen::MatrixXd::Zero(all_time_steps_, 3); 39 | 40 | joint_ini_pose_ = Eigen::MatrixXd::Zero( MAX_JOINT_ID + 1, 1); 41 | 42 | // for inverse kinematics; 43 | ik_solve_ = false; 44 | 45 | ik_target_position_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 46 | 47 | ik_start_rotation_ = robotis_framework::convertRPYToRotation(0.0, 0.0, 0.0); 48 | ik_target_rotation_ = robotis_framework::convertRPYToRotation(0.0, 0.0, 0.0); 49 | 50 | ik_id_start_ = 0; 51 | ik_id_end_ = 0; 52 | } 53 | 54 | RobotisState::~RobotisState() 55 | { 56 | } 57 | 58 | void RobotisState::setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation) 59 | { 60 | for (int dim = 0; dim < 3; dim++) 61 | ik_target_position_.coeffRef(dim, 0) = calc_task_tra_.coeff(cnt, dim); 62 | 63 | Eigen::Quaterniond start_quaternion = robotis_framework::convertRotationToQuaternion(start_rotation); 64 | 65 | Eigen::Quaterniond target_quaternion(kinematics_pose_msg_.pose.orientation.w, 66 | kinematics_pose_msg_.pose.orientation.x, 67 | kinematics_pose_msg_.pose.orientation.y, 68 | kinematics_pose_msg_.pose.orientation.z); 69 | 70 | double count = (double) cnt / (double) all_time_steps_; 71 | 72 | Eigen::Quaterniond quaternion = start_quaternion.slerp(count, target_quaternion); 73 | 74 | ik_target_rotation_ = robotis_framework::convertQuaternionToRotation(quaternion); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /manipulator_h_manager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_manager) 6 | 7 | ## Compile as C++11, supported in ROS Kinetic and newer 8 | set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") 9 | 10 | ################################################################################ 11 | # Find catkin packages and libraries for catkin and system dependencies 12 | ################################################################################ 13 | find_package(catkin REQUIRED COMPONENTS 14 | roscpp 15 | robotis_controller 16 | manipulator_h_base_module 17 | ) 18 | 19 | ################################################################################ 20 | # Setup for python modules and scripts 21 | ################################################################################ 22 | 23 | ################################################################################ 24 | # Declare ROS messages, services and actions 25 | ################################################################################ 26 | 27 | ################################################################################ 28 | # Declare ROS dynamic reconfigure parameters 29 | ################################################################################ 30 | 31 | ################################################################################ 32 | ## Declare catkin specific configuration to be passed to dependent projects 33 | ################################################################################ 34 | catkin_package( 35 | CATKIN_DEPENDS roscpp robotis_controller manipulator_h_base_module 36 | ) 37 | 38 | ################################################################################ 39 | # Build 40 | ################################################################################ 41 | include_directories( 42 | ${catkin_INCLUDE_DIRS} 43 | ) 44 | 45 | add_executable(${PROJECT_NAME} src/manipulator_h_manager.cpp) 46 | add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 47 | target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES}) 48 | 49 | ################################################################################ 50 | # Install 51 | ################################################################################ 52 | install(TARGETS ${PROJECT_NAME} 53 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 54 | ) 55 | 56 | install(DIRECTORY config launch 57 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 58 | ) 59 | 60 | ################################################################################ 61 | # Test 62 | ################################################################################ 63 | -------------------------------------------------------------------------------- /manipulator_h_manager/config/dxl_init.yaml: -------------------------------------------------------------------------------- 1 | joint1 : # H54-200-S500-R 2 | return_delay_time : 10 3 | operating_mode : 3 4 | shutdown : 58 5 | homing_offset : 0 6 | torque_limit : 1240 7 | max_position_limit : 250950 8 | min_position_limit : -250950 9 | goal_torque : 1240 10 | goal_velocity : 0 11 | goal_acceleration : 0 12 | position_p_gain : 32 13 | velocity_p_gain : 399 14 | velocity_i_gain : 14 15 | 16 | joint2 : # H54-200-S500-R 17 | return_delay_time : 10 18 | operating_mode : 3 19 | shutdown : 58 20 | homing_offset : 0 21 | torque_limit : 1240 22 | max_position_limit : 250950 23 | min_position_limit : -250950 24 | goal_torque : 1240 25 | goal_velocity : 0 26 | goal_acceleration : 0 27 | position_p_gain : 32 28 | velocity_p_gain : 399 29 | velocity_i_gain : 14 30 | 31 | joint3 : # H54-100-S500-R 32 | return_delay_time : 10 # item name : value 33 | operating_mode : 3 34 | shutdown : 58 35 | homing_offset : -62738 # 45 deg 36 | torque_limit : 310 37 | max_position_limit : 250950 38 | min_position_limit : -250950 39 | goal_torque : 310 40 | goal_velocity : 0 41 | goal_acceleration : 0 42 | position_p_gain : 32 43 | velocity_p_gain : 256 44 | velocity_i_gain : 16 45 | 46 | joint4 : # H54-100-S500-R 47 | return_delay_time : 10 # item name : value 48 | operating_mode : 3 49 | shutdown : 58 50 | homing_offset : 0 51 | torque_limit : 310 52 | max_position_limit : 250950 53 | min_position_limit : -250950 54 | goal_torque : 310 55 | goal_velocity : 0 56 | goal_acceleration : 0 57 | position_p_gain : 32 58 | velocity_p_gain : 256 59 | velocity_i_gain : 16 60 | 61 | joint5 : # H42-20-S300-R 62 | return_delay_time : 10 63 | operating_mode : 3 64 | shutdown : 58 65 | homing_offset : 0 66 | torque_limit : 372 67 | max_position_limit : 151900 68 | min_position_limit : -151900 69 | goal_torque : 372 70 | goal_velocity : 0 71 | goal_acceleration : 0 72 | position_p_gain : 32 73 | velocity_p_gain : 440 74 | velocity_i_gain : 40 75 | 76 | joint6 : # H42-20-S300-R 77 | return_delay_time : 10 78 | operating_mode : 3 79 | shutdown : 58 80 | homing_offset : 0 81 | torque_limit : 372 82 | max_position_limit : 151900 83 | min_position_limit : -151900 84 | goal_torque : 372 85 | goal_velocity : 0 86 | goal_acceleration : 0 87 | position_p_gain : 32 88 | velocity_p_gain : 440 89 | velocity_i_gain : 40 90 | 91 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_kinematics_dynamics) 6 | 7 | ## Compile as C++11, supported in ROS Kinetic and newer 8 | add_compile_options(-std=c++11) 9 | 10 | ################################################################################ 11 | # Find catkin packages and libraries for catkin and system dependencies 12 | ################################################################################ 13 | find_package(catkin REQUIRED COMPONENTS 14 | roscpp 15 | robotis_math 16 | cmake_modules 17 | ) 18 | 19 | find_package(Eigen3 REQUIRED) 20 | 21 | ################################################################################ 22 | # Setup for python modules and scripts 23 | ################################################################################ 24 | 25 | ################################################################################ 26 | # Declare ROS messages, services and actions 27 | ################################################################################ 28 | 29 | ################################################################################ 30 | # Declare ROS dynamic reconfigure parameters 31 | ################################################################################ 32 | 33 | ################################################################################ 34 | ## Declare catkin specific configuration to be passed to dependent projects 35 | ################################################################################ 36 | catkin_package( 37 | INCLUDE_DIRS include 38 | LIBRARIES ${PROJECT_NAME} 39 | CATKIN_DEPENDS roscpp robotis_math cmake_modules 40 | DEPENDS EIGEN3 41 | ) 42 | 43 | ################################################################################ 44 | # Build 45 | ################################################################################ 46 | include_directories( 47 | include 48 | ${catkin_INCLUDE_DIRS} 49 | ${EIGEN3_INCLUDE_DIRS} 50 | ) 51 | 52 | add_library(${PROJECT_NAME} src/link_data.cpp src/manipulator_h_kinematics_dynamics.cpp) 53 | add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 54 | target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES}) 55 | 56 | ################################################################################ 57 | # Install 58 | ################################################################################ 59 | install(TARGETS ${PROJECT_NAME} 60 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 61 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 62 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 63 | ) 64 | 65 | install(DIRECTORY include/${PROJECT_NAME}/ 66 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 67 | ) 68 | 69 | ################################################################################ 70 | # Test 71 | ################################################################################ 72 | -------------------------------------------------------------------------------- /manipulator_h_gui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.0) 5 | project(manipulator_h_gui) 6 | 7 | ## Compile as C++11, supported in ROS Kinetic and newer 8 | add_compile_options(-std=c++11) 9 | 10 | ################################################################################ 11 | # Find catkin packages and libraries for catkin and system dependencies 12 | ################################################################################ 13 | find_package(catkin REQUIRED COMPONENTS 14 | roscpp 15 | robotis_controller_msgs 16 | manipulator_h_base_module_msgs 17 | qt_build 18 | cmake_modules 19 | eigen_conversions 20 | ) 21 | 22 | find_package(Eigen3 REQUIRED) 23 | 24 | ################################################################################ 25 | # Setup for python modules and scripts 26 | ################################################################################ 27 | 28 | ################################################################################ 29 | # Declare ROS messages, services and actions 30 | ################################################################################ 31 | 32 | ################################################################################ 33 | # Declare ROS dynamic reconfigure parameters 34 | ################################################################################ 35 | 36 | ################################################################################ 37 | # Declare catkin specific configuration to be passed to dependent projects 38 | ################################################################################ 39 | catkin_package( 40 | INCLUDE_DIRS include 41 | CATKIN_DEPENDS roscpp robotis_controller_msgs manipulator_h_base_module_msgs qt_build cmake_modules eigen_conversions 42 | DEPENDS EIGEN3 43 | ) 44 | 45 | ################################################################################ 46 | # Build 47 | ################################################################################ 48 | include_directories( 49 | include 50 | ${catkin_INCLUDE_DIRS} 51 | ${EIGEN3_INCLUDE_DIRS} 52 | ) 53 | 54 | ################################################################################ 55 | # Build 56 | ################################################################################ 57 | rosbuild_prepare_qt4(QtCore QtGui) 58 | 59 | file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp) 60 | file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/manipulator_h_gui/*.hpp) 61 | file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc) 62 | file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui) 63 | 64 | QT4_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES}) 65 | QT4_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) 66 | QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS}) 67 | 68 | add_executable(manipulator_h_gui ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP}) 69 | add_dependencies(manipulator_h_gui ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 70 | target_link_libraries(manipulator_h_gui ${catkin_LIBRARIES} ${QT_LIBRARIES} ${Eigen3_LIBRARIES}) 71 | 72 | ################################################################################ 73 | # Install 74 | ################################################################################ 75 | install(TARGETS manipulator_h_gui 76 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 77 | ) 78 | 79 | install(DIRECTORY include/${PROJECT_NAME}/ 80 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 81 | ) 82 | 83 | install(DIRECTORY resources ui 84 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 85 | ) 86 | 87 | ################################################################################ 88 | # Test 89 | ################################################################################ 90 | -------------------------------------------------------------------------------- /manipulator_h_gui/include/manipulator_h_gui/main_window.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /** 18 | * @file /include/manipulator_h_gui/main_window.hpp 19 | * 20 | * @brief Qt based gui for manipulator_h_gui. 21 | * 22 | * @date November 2010 23 | **/ 24 | #ifndef manipulator_h_gui_MAIN_WINDOW_H 25 | #define manipulator_h_gui_MAIN_WINDOW_H 26 | 27 | /***************************************************************************** 28 | ** Includes 29 | *****************************************************************************/ 30 | 31 | #ifndef Q_MOC_RUN 32 | 33 | #include 34 | #include 35 | #include "ui_main_window.h" 36 | #include "qnode.hpp" 37 | 38 | #endif 39 | 40 | /***************************************************************************** 41 | ** Namespace 42 | *****************************************************************************/ 43 | 44 | namespace manipulator_h_gui { 45 | 46 | /***************************************************************************** 47 | ** Interface [MainWindow] 48 | *****************************************************************************/ 49 | /** 50 | * @brief Qt central, all operations relating to the view part here. 51 | */ 52 | class MainWindow : public QMainWindow { 53 | Q_OBJECT 54 | 55 | public: 56 | MainWindow(int argc, char** argv, QWidget *parent = 0); 57 | ~MainWindow(); 58 | 59 | void closeEvent(QCloseEvent *event); // Overloaded function 60 | 61 | /****************************************** 62 | ** Transformation 63 | *******************************************/ 64 | Eigen::MatrixXd rotationX( double angle ); 65 | Eigen::MatrixXd rotationY( double angle ); 66 | Eigen::MatrixXd rotationZ( double angle ); 67 | 68 | Eigen::MatrixXd rotation2rpy( Eigen::MatrixXd rotation ); 69 | Eigen::MatrixXd rpy2rotation( double roll, double pitch, double yaw ); 70 | 71 | Eigen::Quaterniond rpy2quaternion( double roll, double pitch, double yaw ); 72 | Eigen::Quaterniond rotation2quaternion( Eigen::MatrixXd rotation ); 73 | 74 | Eigen::MatrixXd quaternion2rpy( Eigen::Quaterniond quaternion ); 75 | Eigen::MatrixXd quaternion2rotation( Eigen::Quaterniond quaternion ); 76 | 77 | public Q_SLOTS: 78 | /****************************************** 79 | ** Auto-connections (connectSlotsByName()) 80 | *******************************************/ 81 | void on_actionAbout_triggered(); 82 | 83 | void on_curr_joint_button_clicked( bool check ); 84 | void on_des_joint_button_clicked( bool check ); 85 | 86 | void on_curr_pos_button_clicked( bool check ); 87 | void on_des_pos_button_clicked( bool check ); 88 | 89 | void on_ini_pose_button_clicked( bool check ); 90 | void on_set_mode_button_clicked( bool check ); 91 | 92 | /****************************************** 93 | ** Manual connections 94 | *******************************************/ 95 | void updateLoggingView(); // no idea why this can't connect automatically 96 | 97 | void updateCurrJointPoseSpinbox( manipulator_h_base_module_msgs::JointPose msg ); 98 | void updateCurrKinematicsPoseSpinbox( manipulator_h_base_module_msgs::KinematicsPose msg ); 99 | 100 | private: 101 | Ui::MainWindowDesign ui; 102 | QNode qnode; 103 | 104 | std::vector joint_name; 105 | 106 | QList joint_spinbox; 107 | }; 108 | 109 | } // namespace manipulator_h_gui 110 | 111 | #endif // manipulator_h_gui_MAIN_WINDOW_H 112 | -------------------------------------------------------------------------------- /manipulator_h_base_module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(manipulator_h_base_module) 6 | 7 | ## Compile as C++11, supported in ROS Kinetic and newer 8 | add_compile_options(-std=c++11) 9 | 10 | ################################################################################ 11 | # Find catkin packages and libraries for catkin and system dependencies 12 | ################################################################################ 13 | find_package(catkin REQUIRED COMPONENTS 14 | roscpp 15 | roslib 16 | std_msgs 17 | geometry_msgs 18 | robotis_controller_msgs 19 | manipulator_h_base_module_msgs 20 | cmake_modules 21 | robotis_math 22 | robotis_framework_common 23 | manipulator_h_kinematics_dynamics 24 | ) 25 | 26 | find_package(Boost REQUIRED COMPONENTS thread) 27 | find_package(Eigen3 REQUIRED) 28 | 29 | # Resolve system dependency on yaml-cpp, which apparently does not 30 | # provide a CMake find_package() module. 31 | find_package(PkgConfig REQUIRED) 32 | pkg_check_modules(YAML_CPP REQUIRED yaml-cpp) 33 | find_path(YAML_CPP_INCLUDE_DIR 34 | NAMES yaml_cpp.h 35 | PATHS ${YAML_CPP_INCLUDE_DIRS} 36 | ) 37 | find_library(YAML_CPP_LIBRARY 38 | NAMES YAML_CPP 39 | PATHS ${YAML_CPP_LIBRARY_DIRS} 40 | ) 41 | link_directories(${YAML_CPP_LIBRARY_DIRS}) 42 | 43 | if(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5") 44 | add_definitions(-DHAVE_NEW_YAMLCPP) 45 | endif(NOT ${YAML_CPP_VERSION} VERSION_LESS "0.5") 46 | 47 | ################################################################################ 48 | # Setup for python modules and scripts 49 | ################################################################################ 50 | 51 | ################################################################################ 52 | # Declare ROS messages, services and actions 53 | ################################################################################ 54 | 55 | ################################################################################ 56 | # Declare ROS dynamic reconfigure parameters 57 | ################################################################################ 58 | 59 | ################################################################################ 60 | # Declare catkin specific configuration to be passed to dependent projects 61 | ################################################################################ 62 | catkin_package( 63 | INCLUDE_DIRS include 64 | LIBRARIES ${PROJECT_NAME} 65 | CATKIN_DEPENDS roscpp roslib std_msgs geometry_msgs robotis_controller_msgs manipulator_h_base_module_msgs cmake_modules robotis_math robotis_framework_common manipulator_h_kinematics_dynamics 66 | DEPENDS Boost EIGEN3 67 | ) 68 | 69 | ################################################################################ 70 | # Build 71 | ################################################################################ 72 | include_directories( 73 | include 74 | ${catkin_INCLUDE_DIRS} 75 | ${Boost_INCLUDE_DIRS} 76 | ${EIGEN3_INCLUDE_DIRS} 77 | ${YAML_CPP_INCLUDE_DIRS} 78 | ) 79 | 80 | add_library(${PROJECT_NAME} src/base_module.cpp src/robotis_state.cpp) 81 | add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 82 | target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${Eigen3_LIBRARIES} ${YAML_CPP_LIBRARIES}) 83 | 84 | ################################################################################ 85 | # Install 86 | ################################################################################ 87 | install(TARGETS ${PROJECT_NAME} 88 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 89 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 90 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 91 | ) 92 | 93 | install(DIRECTORY include/${PROJECT_NAME}/ 94 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 95 | ) 96 | 97 | install(DIRECTORY config 98 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 99 | ) 100 | 101 | ################################################################################ 102 | # Test 103 | ################################################################################ 104 | -------------------------------------------------------------------------------- /manipulator_h_gui/include/manipulator_h_gui/qnode.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /** 18 | * @file /include/manipulator_h_gui/qnode.hpp 19 | * 20 | * @brief Communications central! 21 | * 22 | * @date February 2011 23 | **/ 24 | /***************************************************************************** 25 | ** Ifdefs 26 | *****************************************************************************/ 27 | 28 | #ifndef manipulator_h_gui_QNODE_HPP_ 29 | #define manipulator_h_gui_QNODE_HPP_ 30 | 31 | /***************************************************************************** 32 | ** Includes 33 | *****************************************************************************/ 34 | 35 | #ifndef Q_MOC_RUN 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | #include 45 | 46 | #include "robotis_controller_msgs/JointCtrlModule.h" 47 | #include "robotis_controller_msgs/StatusMsg.h" 48 | 49 | #include 50 | #include 51 | 52 | #include 53 | #include 54 | 55 | #endif 56 | 57 | #define DEGREE2RADIAN (M_PI / 180.0) 58 | #define RADIAN2DEGREE (180.0 / M_PI) 59 | 60 | #define PRINT_MAT(X) std::cout << #X << ":\n" << X << std::endl << std::endl 61 | 62 | /***************************************************************************** 63 | ** Namespaces 64 | *****************************************************************************/ 65 | 66 | namespace manipulator_h_gui 67 | { 68 | 69 | /***************************************************************************** 70 | ** Class 71 | *****************************************************************************/ 72 | 73 | class QNode: public QThread 74 | { 75 | Q_OBJECT 76 | public: 77 | QNode(int argc, char** argv); 78 | virtual ~QNode(); 79 | bool init(); 80 | void run(); 81 | 82 | /********************* 83 | ** Logging 84 | **********************/ 85 | enum LogLevel 86 | { 87 | Debug, Info, Warn, Error, Fatal 88 | }; 89 | 90 | QStringListModel* loggingModel() 91 | { 92 | return &logging_model_; 93 | } 94 | void log(const LogLevel &level, const std::string &msg, std::string sender = "GUI"); 95 | void statusMsgCallback(const robotis_controller_msgs::StatusMsg::ConstPtr &msg); 96 | 97 | void sendIniPoseMsg(std_msgs::String msg); 98 | void sendSetModeMsg(std_msgs::String msg); 99 | 100 | void sendJointPoseMsg(manipulator_h_base_module_msgs::JointPose msg); 101 | void sendKinematicsPoseMsg(manipulator_h_base_module_msgs::KinematicsPose msg); 102 | 103 | public Q_SLOTS: 104 | void getJointPose( std::vector joint_name ); 105 | void getKinematicsPose(std::string group_name); 106 | 107 | Q_SIGNALS: 108 | void loggingUpdated(); 109 | void rosShutdown(); 110 | 111 | void updateCurrentJointPose(manipulator_h_base_module_msgs::JointPose); 112 | void updateCurrentKinematicsPose(manipulator_h_base_module_msgs::KinematicsPose); 113 | 114 | private: 115 | int init_argc_; 116 | char** init_argv_; 117 | 118 | ros::Publisher chatter_publisher_; 119 | QStringListModel logging_model_; 120 | 121 | ros::Publisher ini_pose_msg_pub_; 122 | ros::Publisher set_mode_msg_pub_; 123 | 124 | ros::Publisher joint_pose_msg_pub_; 125 | ros::Publisher kinematics_pose_msg_pub_; 126 | 127 | ros::ServiceClient get_joint_pose_client_; 128 | ros::ServiceClient get_kinematics_pose_client_; 129 | 130 | ros::Subscriber status_msg_sub_; 131 | 132 | }; 133 | 134 | } // namespace manipulator_h_gui 135 | 136 | #endif /* manipulator_h_gui_QNODE_HPP_ */ 137 | -------------------------------------------------------------------------------- /manipulator_h_base_module/include/manipulator_h_base_module/base_module.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * DemoModule.h 19 | * 20 | * Created on: 2016. 3. 9. 21 | * Author: SCH 22 | */ 23 | 24 | #ifndef MANIPULATOR_BASE_MODULE_BASE_MODULE_H_ 25 | #define MANIPULATOR_BASE_MODULE_BASE_MODULE_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "robotis_framework_common/motion_module.h" 39 | #include "robotis_math/robotis_math.h" 40 | 41 | #include "robotis_controller_msgs/JointCtrlModule.h" 42 | #include "robotis_controller_msgs/StatusMsg.h" 43 | 44 | #include "manipulator_h_base_module_msgs/JointPose.h" 45 | #include "manipulator_h_base_module_msgs/KinematicsPose.h" 46 | 47 | #include "manipulator_h_base_module_msgs/GetJointPose.h" 48 | #include "manipulator_h_base_module_msgs/GetKinematicsPose.h" 49 | 50 | #include "manipulator_h_kinematics_dynamics/manipulator_h_kinematics_dynamics.h" 51 | #include "robotis_state.h" 52 | 53 | namespace robotis_manipulator_h 54 | { 55 | 56 | //using namespace ROBOTIS_DEMO; 57 | 58 | class BaseJointData 59 | { 60 | public: 61 | double position_; 62 | double velocity_; 63 | double effort_; 64 | 65 | int p_gain_; 66 | int i_gain_; 67 | int d_gain_; 68 | }; 69 | 70 | class BaseJointState 71 | { 72 | public: 73 | BaseJointData curr_joint_state_[ MAX_JOINT_ID + 1]; 74 | BaseJointData goal_joint_state_[ MAX_JOINT_ID + 1]; 75 | BaseJointData fake_joint_state_[ MAX_JOINT_ID + 1]; 76 | }; 77 | 78 | class BaseModule 79 | : public robotis_framework::MotionModule, 80 | public robotis_framework::Singleton 81 | { 82 | private: 83 | int control_cycle_msec_; 84 | boost::thread queue_thread_; 85 | boost::thread *tra_gene_thread_; 86 | 87 | ros::Publisher status_msg_pub_; 88 | ros::Publisher set_ctrl_module_pub_; 89 | 90 | std::map joint_name_to_id_; 91 | 92 | void queueThread(); 93 | 94 | void parseIniPoseData(const std::string &path); 95 | void publishStatusMsg(unsigned int type, std::string msg); 96 | 97 | public: 98 | BaseModule(); 99 | virtual ~BaseModule(); 100 | 101 | /* ROS Topic Callback Functions */ 102 | void initPoseMsgCallback(const std_msgs::String::ConstPtr& msg); 103 | void setModeMsgCallback(const std_msgs::String::ConstPtr& msg); 104 | 105 | void jointPoseMsgCallback(const manipulator_h_base_module_msgs::JointPose::ConstPtr& msg); 106 | void kinematicsPoseMsgCallback(const manipulator_h_base_module_msgs::KinematicsPose::ConstPtr& msg); 107 | 108 | bool getJointPoseCallback(manipulator_h_base_module_msgs::GetJointPose::Request &req, 109 | manipulator_h_base_module_msgs::GetJointPose::Response &res); 110 | bool getKinematicsPoseCallback(manipulator_h_base_module_msgs::GetKinematicsPose::Request &req, 111 | manipulator_h_base_module_msgs::GetKinematicsPose::Response &res); 112 | 113 | /* ROS Calculation Functions */ 114 | void generateInitPoseTrajProcess(); 115 | void generateJointTrajProcess(); 116 | void generateTaskTrajProcess(); 117 | 118 | /* ROS Framework Functions */ 119 | void initialize(const int control_cycle_msec, robotis_framework::Robot *robot); 120 | void process(std::map dxls, std::map sensors); 121 | 122 | void stop(); 123 | bool isRunning(); 124 | 125 | /* Parameter */ 126 | BaseJointState *joint_state_; 127 | RobotisState *robotis_; 128 | ManipulatorKinematicsDynamics *manipulator_; 129 | }; 130 | 131 | } 132 | 133 | #endif /* MANIPULATOR_BASE_MODULE_BASE_MODULE_H_ */ 134 | -------------------------------------------------------------------------------- /manipulator_h_description/launch/manipulator_h.rviz: -------------------------------------------------------------------------------- 1 | Panels: 2 | - Class: rviz/Displays 3 | Help Height: 78 4 | Name: Displays 5 | Property Tree Widget: 6 | Expanded: 7 | - /Global Options1 8 | - /Status1 9 | - /RobotModel1/Links1 10 | - /TF1 11 | - /TF1/Frames1 12 | - /TF1/Tree1 13 | Splitter Ratio: 0.56793499 14 | Tree Height: 775 15 | - Class: rviz/Selection 16 | Name: Selection 17 | - Class: rviz/Tool Properties 18 | Expanded: 19 | - /2D Pose Estimate1 20 | - /2D Nav Goal1 21 | - /Publish Point1 22 | Name: Tool Properties 23 | Splitter Ratio: 0.588679016 24 | - Class: rviz/Views 25 | Expanded: 26 | - /Current View1 27 | Name: Views 28 | Splitter Ratio: 0.5 29 | - Class: rviz/Time 30 | Experimental: false 31 | Name: Time 32 | SyncMode: 0 33 | SyncSource: "" 34 | Visualization Manager: 35 | Class: "" 36 | Displays: 37 | - Alpha: 0.5 38 | Cell Size: 1 39 | Class: rviz/Grid 40 | Color: 160; 160; 164 41 | Enabled: true 42 | Line Style: 43 | Line Width: 0.0299999993 44 | Value: Lines 45 | Name: Grid 46 | Normal Cell Count: 0 47 | Offset: 48 | X: 0 49 | Y: 0 50 | Z: 0 51 | Plane: XY 52 | Plane Cell Count: 10 53 | Reference Frame: 54 | Value: true 55 | - Alpha: 1 56 | Class: rviz/RobotModel 57 | Collision Enabled: false 58 | Enabled: true 59 | Links: 60 | All Links Enabled: true 61 | Expand Joint Details: false 62 | Expand Link Details: false 63 | Expand Tree: false 64 | Link Tree Style: Links in Alphabetic Order 65 | end_link: 66 | Alpha: 1 67 | Show Axes: false 68 | Show Trail: false 69 | Value: true 70 | link1: 71 | Alpha: 1 72 | Show Axes: false 73 | Show Trail: false 74 | Value: true 75 | link2: 76 | Alpha: 1 77 | Show Axes: false 78 | Show Trail: false 79 | Value: true 80 | link3: 81 | Alpha: 1 82 | Show Axes: false 83 | Show Trail: false 84 | Value: true 85 | link4: 86 | Alpha: 1 87 | Show Axes: false 88 | Show Trail: false 89 | Value: true 90 | link5: 91 | Alpha: 1 92 | Show Axes: false 93 | Show Trail: false 94 | Value: true 95 | link6: 96 | Alpha: 1 97 | Show Axes: false 98 | Show Trail: false 99 | Value: true 100 | world: 101 | Alpha: 1 102 | Show Axes: false 103 | Show Trail: false 104 | Name: RobotModel 105 | Robot Description: robot_description 106 | TF Prefix: "" 107 | Update Interval: 0 108 | Value: true 109 | Visual Enabled: true 110 | - Class: rviz/TF 111 | Enabled: true 112 | Frame Timeout: 15 113 | Frames: 114 | All Enabled: false 115 | end_link: 116 | Value: true 117 | link1: 118 | Value: true 119 | link2: 120 | Value: true 121 | link3: 122 | Value: true 123 | link4: 124 | Value: true 125 | link5: 126 | Value: true 127 | link6: 128 | Value: true 129 | world: 130 | Value: true 131 | Marker Scale: 0.5 132 | Name: TF 133 | Show Arrows: false 134 | Show Axes: false 135 | Show Names: false 136 | Tree: 137 | world: 138 | link1: 139 | link2: 140 | link3: 141 | link4: 142 | link5: 143 | link6: 144 | end_link: 145 | {} 146 | Update Interval: 0 147 | Value: true 148 | Enabled: true 149 | Global Options: 150 | Background Color: 48; 48; 48 151 | Fixed Frame: world 152 | Frame Rate: 30 153 | Name: root 154 | Tools: 155 | - Class: rviz/Interact 156 | Hide Inactive Objects: true 157 | - Class: rviz/MoveCamera 158 | - Class: rviz/Select 159 | - Class: rviz/FocusCamera 160 | - Class: rviz/Measure 161 | - Class: rviz/SetInitialPose 162 | Topic: /initialpose 163 | - Class: rviz/SetGoal 164 | Topic: /move_base_simple/goal 165 | - Class: rviz/PublishPoint 166 | Single click: true 167 | Topic: /clicked_point 168 | Value: true 169 | Views: 170 | Current: 171 | Class: rviz/Orbit 172 | Distance: 2.08372235 173 | Enable Stereo Rendering: 174 | Stereo Eye Separation: 0.0599999987 175 | Stereo Focal Distance: 1 176 | Swap Stereo Eyes: false 177 | Value: false 178 | Focal Point: 179 | X: 0.0826560035 180 | Y: -0.150808007 181 | Z: 0.203446001 182 | Name: Current View 183 | Near Clip Distance: 0.00999999978 184 | Pitch: 0.345398009 185 | Target Frame: 186 | Value: Orbit (rviz) 187 | Yaw: 0.85039866 188 | Saved: ~ 189 | Window Geometry: 190 | Displays: 191 | collapsed: false 192 | Height: 1056 193 | Hide Left Dock: false 194 | Hide Right Dock: false 195 | QMainWindow State: 000000ff00000000fd00000004000000000000017200000396fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006400fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002800000396000000dd00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000396fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000002800000396000000b000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073f0000003efc0100000002fb0000000800540069006d006501000000000000073f0000030000fffffffb0000000800540069006d00650100000000000004500000000000000000000004b20000039600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 196 | Selection: 197 | collapsed: false 198 | Time: 199 | collapsed: false 200 | Tool Properties: 201 | collapsed: false 202 | Views: 203 | collapsed: false 204 | Width: 1855 205 | X: 65 206 | Y: 24 207 | -------------------------------------------------------------------------------- /manipulator_h_gui/src/qnode.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /** 18 | * @file /src/qnode.cpp 19 | * 20 | * @brief Ros communication central! 21 | * 22 | * @date February 2011 23 | **/ 24 | 25 | /***************************************************************************** 26 | ** Includes 27 | *****************************************************************************/ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include "manipulator_h_gui/qnode.hpp" 34 | 35 | /***************************************************************************** 36 | ** Namespaces 37 | *****************************************************************************/ 38 | 39 | namespace manipulator_h_gui { 40 | 41 | /***************************************************************************** 42 | ** Implementation 43 | *****************************************************************************/ 44 | 45 | QNode::QNode(int argc, char** argv ) : 46 | init_argc_(argc), 47 | init_argv_(argv) 48 | {} 49 | 50 | QNode::~QNode() { 51 | if(ros::isStarted()) { 52 | ros::shutdown(); // explicitly needed since we use ros::start(); 53 | ros::waitForShutdown(); 54 | } 55 | wait(); 56 | } 57 | 58 | bool QNode::init() { 59 | ros::init(init_argc_,init_argv_,"manipulator_h_gui"); 60 | 61 | ros::start(); // explicitly needed since our nodehandle is going out of scope. 62 | ros::NodeHandle n; 63 | 64 | // Add your ros communications here. 65 | ini_pose_msg_pub_ = n.advertise("/robotis/base/ini_pose_msg", 0); 66 | set_mode_msg_pub_ = n.advertise("/robotis/base/set_mode_msg", 0); 67 | 68 | joint_pose_msg_pub_ = n.advertise("/robotis/base/joint_pose_msg", 0); 69 | kinematics_pose_msg_pub_ = n.advertise("/robotis/base/kinematics_pose_msg", 0); 70 | 71 | get_joint_pose_client_ = n.serviceClient("/robotis/base/get_joint_pose", 0); 72 | get_kinematics_pose_client_ = n.serviceClient("/robotis/base/get_kinematics_pose", 0); 73 | 74 | status_msg_sub_ = n.subscribe("/robotis/status", 10, &QNode::statusMsgCallback, this); 75 | 76 | start(); 77 | return true; 78 | } 79 | 80 | void QNode::run() { 81 | 82 | ros::Rate loop_rate(50); 83 | 84 | while ( ros::ok() ) 85 | { 86 | ros::spinOnce(); 87 | 88 | loop_rate.sleep(); 89 | } 90 | std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; 91 | Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) 92 | } 93 | 94 | 95 | void QNode::statusMsgCallback(const robotis_controller_msgs::StatusMsg::ConstPtr &msg) 96 | { 97 | log((LogLevel) msg->type, msg->status_msg, msg->module_name); 98 | } 99 | 100 | void QNode::log( const LogLevel &level, const std::string &msg, std::string sender) 101 | { 102 | logging_model_.insertRows(logging_model_.rowCount(),1); 103 | std::stringstream logging_model_msg; 104 | 105 | std::stringstream _sender; 106 | _sender << "[" << sender << "] "; 107 | 108 | switch ( level ) { 109 | case(Debug) : { 110 | ROS_DEBUG_STREAM(msg); 111 | logging_model_msg << "[DEBUG] [" << ros::Time::now() << "]: " << _sender.str() << msg; 112 | break; 113 | } 114 | case(Info) : { 115 | ROS_INFO_STREAM(msg); 116 | logging_model_msg << "[INFO] [" << ros::Time::now() << "]: " << _sender.str() << msg; 117 | break; 118 | } 119 | case(Warn) : { 120 | ROS_WARN_STREAM(msg); 121 | logging_model_msg << "[WARN] [" << ros::Time::now() << "]: " << _sender.str() < [" << ros::Time::now() << "]: " << _sender.str() < joint_name ) 169 | { 170 | log( Info , "Get Current Joint Pose" ); 171 | 172 | manipulator_h_base_module_msgs::GetJointPose _get_joint_pose; 173 | 174 | // request 175 | for ( int _id = 0; _id < joint_name.size(); _id++ ) 176 | _get_joint_pose.request.joint_name.push_back( joint_name[ _id ] ); 177 | 178 | // response 179 | if ( get_joint_pose_client_.call ( _get_joint_pose ) ) 180 | { 181 | manipulator_h_base_module_msgs::JointPose _joint_pose; 182 | 183 | for ( int _id = 0; _id < _get_joint_pose.response.joint_name.size(); _id++ ) 184 | { 185 | _joint_pose.name.push_back( _get_joint_pose.response.joint_name[ _id ] ); 186 | _joint_pose.value.push_back( _get_joint_pose.response.joint_value[ _id ]); 187 | } 188 | 189 | Q_EMIT updateCurrentJointPose( _joint_pose ); 190 | } 191 | else 192 | log(Error, "fail to get joint pose."); 193 | } 194 | 195 | void QNode::getKinematicsPose ( std::string group_name ) 196 | { 197 | log( Info , "Get Current Kinematics Pose" ); 198 | 199 | manipulator_h_base_module_msgs::GetKinematicsPose _get_kinematics_pose; 200 | 201 | // request 202 | _get_kinematics_pose.request.group_name = group_name; 203 | 204 | // response 205 | if ( get_kinematics_pose_client_.call( _get_kinematics_pose ) ) 206 | { 207 | manipulator_h_base_module_msgs::KinematicsPose _kinematcis_pose; 208 | 209 | _kinematcis_pose.name = _get_kinematics_pose.request.group_name; 210 | _kinematcis_pose.pose = _get_kinematics_pose.response.group_pose; 211 | 212 | Q_EMIT updateCurrentKinematicsPose( _kinematcis_pose ); 213 | } 214 | else 215 | log(Error, "fail to get kinematcis pose."); 216 | } 217 | 218 | } // namespace manipulator_h_gui 219 | -------------------------------------------------------------------------------- /manipulator_h_gui/src/main_window.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /** 18 | * @file /src/main_window.cpp 19 | * 20 | * @brief Implementation for the qt gui. 21 | * 22 | * @date February 2011 23 | **/ 24 | 25 | /***************************************************************************** 26 | ** Includes 27 | *****************************************************************************/ 28 | 29 | #include 30 | #include 31 | #include 32 | #include "manipulator_h_gui/main_window.hpp" 33 | 34 | /***************************************************************************** 35 | ** Namespaces 36 | *****************************************************************************/ 37 | 38 | namespace manipulator_h_gui { 39 | 40 | using namespace Qt; 41 | 42 | /***************************************************************************** 43 | ** Implementation [MainWindow] 44 | *****************************************************************************/ 45 | 46 | MainWindow::MainWindow(int argc, char** argv, QWidget *parent) 47 | : QMainWindow(parent) 48 | , qnode(argc,argv) 49 | { 50 | ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class. 51 | QObject::connect(ui.actionAbout_Qt, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); // qApp is a global variable for the application 52 | 53 | setWindowIcon(QIcon(":/images/icon.png")); 54 | ui.tab_manager->setCurrentIndex(0); // ensure the first tab is showing - qt-designer should have this already hardwired, but often loses it (settings?). 55 | QObject::connect(&qnode, SIGNAL(rosShutdown()), this, SLOT(close())); 56 | 57 | joint_name.push_back("joint1"); 58 | joint_name.push_back("joint2"); 59 | joint_name.push_back("joint3"); 60 | joint_name.push_back("joint4"); 61 | joint_name.push_back("joint5"); 62 | joint_name.push_back("joint6"); 63 | 64 | /********************* 65 | ** Logging 66 | **********************/ 67 | ui.view_logging->setModel(qnode.loggingModel()); 68 | QObject::connect(&qnode, SIGNAL(loggingUpdated()), this, SLOT(updateLoggingView())); 69 | 70 | joint_spinbox.append( ui.joint1_spinbox ); 71 | joint_spinbox.append( ui.joint2_spinbox ); 72 | joint_spinbox.append( ui.joint3_spinbox ); 73 | joint_spinbox.append( ui.joint4_spinbox ); 74 | joint_spinbox.append( ui.joint5_spinbox ); 75 | joint_spinbox.append( ui.joint6_spinbox ); 76 | 77 | /**************************** 78 | ** Connect 79 | ****************************/ 80 | 81 | qRegisterMetaType("manipulator_h_base_module_msgs::JointPose"); 82 | QObject::connect(&qnode, SIGNAL(updateCurrentJointPose(manipulator_h_base_module_msgs::JointPose)), this, SLOT(updateCurrJointPoseSpinbox(manipulator_h_base_module_msgs::JointPose))); 83 | 84 | qRegisterMetaType("manipulator_h_base_module_msgs::KinematicsPose"); 85 | QObject::connect(&qnode, SIGNAL(updateCurrentKinematicsPose(manipulator_h_base_module_msgs::KinematicsPose)), this, SLOT(updateCurrKinematicsPoseSpinbox(manipulator_h_base_module_msgs::KinematicsPose))); 86 | 87 | /********************* 88 | ** Auto Start 89 | **********************/ 90 | qnode.init(); 91 | } 92 | 93 | MainWindow::~MainWindow() {} 94 | 95 | /***************************************************************************** 96 | ** Implementation [Slots] 97 | *****************************************************************************/ 98 | 99 | void MainWindow::on_curr_joint_button_clicked( bool check ) 100 | { 101 | qnode.getJointPose( joint_name ); 102 | } 103 | 104 | void MainWindow::on_des_joint_button_clicked( bool check ) 105 | { 106 | manipulator_h_base_module_msgs::JointPose msg; 107 | 108 | for ( int _id = 0; _id < joint_spinbox.size(); _id++ ) 109 | { 110 | msg.name.push_back( joint_name[ _id ] ); 111 | msg.value.push_back( ((QDoubleSpinBox *) joint_spinbox[ _id ])->value() * M_PI / 180.0 ); 112 | } 113 | 114 | qnode.sendJointPoseMsg( msg ); 115 | } 116 | 117 | void MainWindow::on_curr_pos_button_clicked( bool check ) 118 | { 119 | std::string group_name = "arm"; 120 | 121 | qnode.getKinematicsPose( group_name ); 122 | } 123 | 124 | void MainWindow::on_des_pos_button_clicked( bool check ) 125 | { 126 | manipulator_h_base_module_msgs::KinematicsPose msg; 127 | 128 | msg.name = "arm"; 129 | 130 | msg.pose.position.x = ui.pos_x_spinbox->value(); 131 | msg.pose.position.y = ui.pos_y_spinbox->value(); 132 | msg.pose.position.z = ui.pos_z_spinbox->value(); 133 | 134 | double roll = ui.ori_roll_spinbox->value() * M_PI / 180.0; 135 | double pitch = ui.ori_pitch_spinbox->value() * M_PI / 180.0; 136 | double yaw = ui.ori_yaw_spinbox->value() * M_PI / 180.0; 137 | 138 | Eigen::Quaterniond QR = rpy2quaternion( roll, pitch, yaw ); 139 | 140 | msg.pose.orientation.x = QR.x(); 141 | msg.pose.orientation.y = QR.y(); 142 | msg.pose.orientation.z = QR.z(); 143 | msg.pose.orientation.w = QR.w(); 144 | 145 | qnode.sendKinematicsPoseMsg( msg ); 146 | } 147 | 148 | void MainWindow::on_ini_pose_button_clicked( bool check ) 149 | { 150 | std_msgs::String msg; 151 | 152 | msg.data ="ini_pose"; 153 | 154 | qnode.sendIniPoseMsg( msg ); 155 | } 156 | 157 | void MainWindow::on_set_mode_button_clicked( bool check ) 158 | { 159 | std_msgs::String msg; 160 | 161 | msg.data ="set_mode"; 162 | 163 | qnode.sendSetModeMsg( msg ); 164 | } 165 | 166 | void MainWindow::updateCurrJointPoseSpinbox( manipulator_h_base_module_msgs::JointPose msg ) 167 | { 168 | for ( int _name_index = 0; _name_index < msg.name.size(); _name_index++ ) 169 | { 170 | for ( int _id = 0; _id < joint_name.size(); _id++ ) 171 | { 172 | if ( msg.name[ _id ] == joint_name[ _name_index ] ) 173 | { 174 | ((QDoubleSpinBox *) joint_spinbox[ _name_index ])->setValue( msg.value[ _id ] * 180.0 / M_PI ); 175 | break; 176 | } 177 | } 178 | } 179 | } 180 | 181 | void MainWindow::updateCurrKinematicsPoseSpinbox( manipulator_h_base_module_msgs::KinematicsPose msg ) 182 | { 183 | ui.pos_x_spinbox->setValue( msg.pose.position.x ); 184 | ui.pos_y_spinbox->setValue( msg.pose.position.y ); 185 | ui.pos_z_spinbox->setValue( msg.pose.position.z ); 186 | 187 | Eigen::Quaterniond QR( msg.pose.orientation.w , msg.pose.orientation.x , msg.pose.orientation.y , msg.pose.orientation.z ); 188 | 189 | Eigen::MatrixXd rpy = quaternion2rpy( QR ); 190 | 191 | double roll = rpy.coeff( 0 , 0 ) * 180.0 / M_PI; 192 | double pitch = rpy.coeff( 1 , 0 ) * 180.0 / M_PI; 193 | double yaw = rpy.coeff( 2, 0 ) * 180.0 /M_PI; 194 | 195 | ui.ori_roll_spinbox->setValue( roll ); 196 | ui.ori_pitch_spinbox->setValue( pitch ); 197 | ui.ori_yaw_spinbox->setValue( yaw ); 198 | } 199 | 200 | Eigen::MatrixXd MainWindow::rotationX( double angle ) 201 | { 202 | Eigen::MatrixXd _rotation( 3 , 3 ); 203 | 204 | _rotation << 1.0, 0.0, 0.0, 205 | 0.0, cos( angle ), -sin( angle ), 206 | 0.0, sin( angle ), cos( angle ); 207 | 208 | return _rotation; 209 | } 210 | 211 | Eigen::MatrixXd MainWindow::rotationY( double angle ) 212 | { 213 | Eigen::MatrixXd _rotation( 3 , 3 ); 214 | 215 | _rotation << cos( angle ), 0.0, sin( angle ), 216 | 0.0, 1.0, 0.0, 217 | -sin( angle ), 0.0, cos( angle ); 218 | 219 | return _rotation; 220 | } 221 | 222 | Eigen::MatrixXd MainWindow::rotationZ( double angle ) 223 | { 224 | Eigen::MatrixXd _rotation(3,3); 225 | 226 | _rotation << cos( angle ), -sin( angle ), 0.0, 227 | sin( angle ), cos( angle ), 0.0, 228 | 0.0, 0.0, 1.0; 229 | 230 | return _rotation; 231 | } 232 | 233 | Eigen::MatrixXd MainWindow::rotation2rpy( Eigen::MatrixXd rotation ) 234 | { 235 | Eigen::MatrixXd _rpy = Eigen::MatrixXd::Zero( 3 , 1 ); 236 | 237 | _rpy.coeffRef( 0 , 0 ) = atan2( rotation.coeff( 2 , 1 ), rotation.coeff( 2 , 2 ) ); 238 | _rpy.coeffRef( 1 , 0 ) = atan2( -rotation.coeff( 2 , 0 ), sqrt( pow( rotation.coeff( 2 , 1 ) , 2 ) + pow( rotation.coeff( 2 , 2 ) , 2 ) ) ); 239 | _rpy.coeffRef( 2 , 0 ) = atan2 ( rotation.coeff( 1 , 0 ) , rotation.coeff( 0 , 0 ) ); 240 | 241 | return _rpy; 242 | } 243 | 244 | Eigen::MatrixXd MainWindow::rpy2rotation( double roll, double pitch, double yaw ) 245 | { 246 | Eigen::MatrixXd _rotation = rotationZ( yaw ) * rotationY( pitch ) * rotationX( roll ); 247 | 248 | return _rotation; 249 | } 250 | 251 | Eigen::Quaterniond MainWindow::rpy2quaternion( double roll, double pitch, double yaw ) 252 | { 253 | Eigen::MatrixXd _rotation = rpy2rotation( roll, pitch, yaw ); 254 | 255 | Eigen::Matrix3d _rotation3d; 256 | _rotation3d = _rotation.block( 0 , 0 , 3 , 3 ); 257 | 258 | Eigen::Quaterniond _quaternion; 259 | 260 | _quaternion = _rotation3d; 261 | 262 | return _quaternion; 263 | } 264 | 265 | Eigen::Quaterniond MainWindow::rotation2quaternion( Eigen::MatrixXd rotation ) 266 | { 267 | Eigen::Matrix3d _rotation3d; 268 | 269 | _rotation3d = rotation.block( 0 , 0 , 3 , 3 ); 270 | 271 | Eigen::Quaterniond _quaternion; 272 | _quaternion = _rotation3d; 273 | 274 | return _quaternion; 275 | } 276 | 277 | Eigen::MatrixXd MainWindow::quaternion2rpy( Eigen::Quaterniond quaternion ) 278 | { 279 | Eigen::MatrixXd _rpy = rotation2rpy( quaternion.toRotationMatrix() ); 280 | 281 | return _rpy; 282 | } 283 | 284 | Eigen::MatrixXd MainWindow::quaternion2rotation( Eigen::Quaterniond quaternion ) 285 | { 286 | Eigen::MatrixXd _rotation = quaternion.toRotationMatrix(); 287 | 288 | return _rotation; 289 | } 290 | 291 | /***************************************************************************** 292 | ** Implemenation [Slots][manually connected] 293 | *****************************************************************************/ 294 | 295 | /** 296 | * This function is signalled by the underlying model. When the model changes, 297 | * this will drop the cursor down to the last line in the QListview to ensure 298 | * the user can always see the latest log message. 299 | */ 300 | void MainWindow::updateLoggingView() { 301 | ui.view_logging->scrollToBottom(); 302 | } 303 | 304 | /***************************************************************************** 305 | ** Implementation [Menu] 306 | *****************************************************************************/ 307 | 308 | void MainWindow::on_actionAbout_triggered() { 309 | QMessageBox::about(this, tr("About ..."),tr("

PACKAGE_NAME Test Program 0.10

Copyright Robotis

This package needs an about description.

")); 310 | } 311 | 312 | /***************************************************************************** 313 | ** Implementation [Configuration] 314 | *****************************************************************************/ 315 | 316 | void MainWindow::closeEvent(QCloseEvent *event) 317 | { 318 | QMainWindow::closeEvent(event); 319 | } 320 | 321 | } // namespace manipulator_h_gui 322 | 323 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /manipulator_h_description/urdf/manipulator_h.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | transmission_interface/SimpleTransmission 64 | 65 | EffortJointInterface 66 | 67 | 68 | EffortJointInterface 69 | 1 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | transmission_interface/SimpleTransmission 111 | 112 | EffortJointInterface 113 | 114 | 115 | EffortJointInterface 116 | 1 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | transmission_interface/SimpleTransmission 158 | 159 | EffortJointInterface 160 | 161 | 162 | EffortJointInterface 163 | 1 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | transmission_interface/SimpleTransmission 205 | 206 | EffortJointInterface 207 | 208 | 209 | EffortJointInterface 210 | 1 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | transmission_interface/SimpleTransmission 252 | 253 | EffortJointInterface 254 | 255 | 256 | EffortJointInterface 257 | 1 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | transmission_interface/SimpleTransmission 299 | 300 | EffortJointInterface 301 | 302 | 303 | EffortJointInterface 304 | 1 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | -------------------------------------------------------------------------------- /manipulator_h_kinematics_dynamics/src/manipulator_h_kinematics_dynamics.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * Link.cpp 19 | * 20 | * Created on: Jan 11, 2016 21 | * Author: SCH 22 | */ 23 | 24 | #include 25 | #include "manipulator_h_kinematics_dynamics/manipulator_h_kinematics_dynamics.h" 26 | 27 | namespace robotis_manipulator_h 28 | { 29 | 30 | ManipulatorKinematicsDynamics::ManipulatorKinematicsDynamics() 31 | { 32 | } 33 | ManipulatorKinematicsDynamics::~ManipulatorKinematicsDynamics() 34 | { 35 | } 36 | 37 | ManipulatorKinematicsDynamics::ManipulatorKinematicsDynamics(TreeSelect tree) 38 | { 39 | for (int id = 0; id <= ALL_JOINT_ID; id++) 40 | manipulator_link_data_[id] = new LinkData(); 41 | 42 | if (tree == ARM) 43 | { 44 | manipulator_link_data_[0]->name_ = "base"; 45 | manipulator_link_data_[0]->parent_ = -1; 46 | manipulator_link_data_[0]->sibling_ = -1; 47 | manipulator_link_data_[0]->child_ = 1; 48 | manipulator_link_data_[0]->mass_ = 0.0; 49 | manipulator_link_data_[0]->relative_position_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 50 | manipulator_link_data_[0]->joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 51 | manipulator_link_data_[0]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 52 | manipulator_link_data_[0]->joint_limit_max_ = 100.0; 53 | manipulator_link_data_[0]->joint_limit_min_ = -100.0; 54 | manipulator_link_data_[0]->inertia_ = robotis_framework::getInertiaXYZ(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 55 | 56 | manipulator_link_data_[1]->name_ = "joint1"; 57 | manipulator_link_data_[1]->parent_ = 0; 58 | manipulator_link_data_[1]->sibling_ = -1; 59 | manipulator_link_data_[1]->child_ = 2; 60 | manipulator_link_data_[1]->mass_ = 0.85644; 61 | manipulator_link_data_[1]->relative_position_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.126); 62 | manipulator_link_data_[1]->joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 1.0); 63 | manipulator_link_data_[1]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 64 | manipulator_link_data_[1]->joint_limit_max_ = 0.5 * M_PI; 65 | manipulator_link_data_[1]->joint_limit_min_ = -0.5 * M_PI; 66 | manipulator_link_data_[1]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 67 | 68 | manipulator_link_data_[2]->name_ = "joint2"; 69 | manipulator_link_data_[2]->parent_ = 1; 70 | manipulator_link_data_[2]->sibling_ = -1; 71 | manipulator_link_data_[2]->child_ = 3; 72 | manipulator_link_data_[2]->mass_ = 0.94658; 73 | manipulator_link_data_[2]->relative_position_ = robotis_framework::getTransitionXYZ(0.0, 0.06900, 0.033); 74 | manipulator_link_data_[2]->joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 1.0, 0.0); 75 | manipulator_link_data_[2]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 76 | manipulator_link_data_[2]->joint_limit_max_ = 0.5 * M_PI; 77 | manipulator_link_data_[2]->joint_limit_min_ = -0.5 * M_PI; 78 | manipulator_link_data_[2]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 79 | 80 | manipulator_link_data_[3]->name_ = "joint3"; 81 | manipulator_link_data_[3]->parent_ = 2; 82 | manipulator_link_data_[3]->sibling_ = -1; 83 | manipulator_link_data_[3]->child_ = 4; 84 | manipulator_link_data_[3]->mass_ = 1.30260; 85 | manipulator_link_data_[3]->relative_position_ = robotis_framework::getTransitionXYZ(0.03000, -0.01150, 0.26400); 86 | manipulator_link_data_[3]->joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 1.0, 0.0); 87 | manipulator_link_data_[3]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 88 | manipulator_link_data_[3]->joint_limit_max_ = 0.5 * M_PI; 89 | manipulator_link_data_[3]->joint_limit_min_ = -0.5 * M_PI; 90 | manipulator_link_data_[3]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 91 | 92 | manipulator_link_data_[4]->name_ = "joint4"; 93 | manipulator_link_data_[4]->parent_ = 3; 94 | manipulator_link_data_[4]->sibling_ = -1; 95 | manipulator_link_data_[4]->child_ = 5; 96 | manipulator_link_data_[4]->mass_ = 1.236; 97 | manipulator_link_data_[4]->relative_position_ = robotis_framework::getTransitionXYZ(0.19500, -0.05750, 0.03000); 98 | manipulator_link_data_[4]->joint_axis_ = robotis_framework::getTransitionXYZ(1.0, 0.0, 0.0); 99 | manipulator_link_data_[4]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 100 | manipulator_link_data_[4]->joint_limit_max_ = 0.5 * M_PI; 101 | manipulator_link_data_[4]->joint_limit_min_ = -0.5 * M_PI; 102 | manipulator_link_data_[4]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 103 | 104 | manipulator_link_data_[5]->name_ = "joint5"; 105 | manipulator_link_data_[5]->parent_ = 4; 106 | manipulator_link_data_[5]->sibling_ = -1; 107 | manipulator_link_data_[5]->child_ = 6; 108 | manipulator_link_data_[5]->mass_ = 0.491; 109 | manipulator_link_data_[5]->relative_position_ = robotis_framework::getTransitionXYZ(0.06300, 0.04500, 0.00000); 110 | manipulator_link_data_[5]->joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 1.0, 0.0); 111 | manipulator_link_data_[5]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 112 | manipulator_link_data_[5]->joint_limit_max_ = 0.5 * M_PI; 113 | manipulator_link_data_[5]->joint_limit_min_ = -0.5 * M_PI; 114 | manipulator_link_data_[5]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 115 | 116 | manipulator_link_data_[6]->name_ = "joint6"; 117 | manipulator_link_data_[6]->parent_ = 5; 118 | manipulator_link_data_[6]->sibling_ = -1; 119 | manipulator_link_data_[6]->child_ = 7; 120 | manipulator_link_data_[6]->mass_ = 0.454; 121 | manipulator_link_data_[6]->relative_position_ = robotis_framework::getTransitionXYZ(0.12300, -0.04500, 0.00000); 122 | manipulator_link_data_[6]->joint_axis_ = robotis_framework::getTransitionXYZ(1.0, 0.0, 0.0); 123 | manipulator_link_data_[6]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 124 | manipulator_link_data_[6]->joint_limit_max_ = 0.5 * M_PI; 125 | manipulator_link_data_[6]->joint_limit_min_ = -0.5 * M_PI; 126 | manipulator_link_data_[6]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 127 | 128 | manipulator_link_data_[7]->name_ = "end"; 129 | manipulator_link_data_[7]->parent_ = 6; 130 | manipulator_link_data_[7]->sibling_ = -1; 131 | manipulator_link_data_[7]->child_ = -1; 132 | manipulator_link_data_[7]->mass_ = 0.0; 133 | manipulator_link_data_[7]->relative_position_ = robotis_framework::getTransitionXYZ(0.0115, 0.0, 0.0); 134 | manipulator_link_data_[7]->joint_axis_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 135 | manipulator_link_data_[7]->center_of_mass_ = robotis_framework::getTransitionXYZ(0.0, 0.0, 0.0); 136 | manipulator_link_data_[7]->joint_limit_max_ = 100.0; 137 | manipulator_link_data_[7]->joint_limit_min_ = -100.0; 138 | manipulator_link_data_[7]->inertia_ = robotis_framework::getInertiaXYZ(1.0, 0.0, 0.0, 1.0, 0.0, 1.0); 139 | } 140 | } 141 | 142 | std::vector ManipulatorKinematicsDynamics::findRoute(int to) 143 | { 144 | int id = manipulator_link_data_[to]->parent_; 145 | 146 | std::vector idx; 147 | 148 | if (id == 0) 149 | { 150 | idx.push_back(0); 151 | idx.push_back(to); 152 | } 153 | else 154 | { 155 | idx = findRoute(id); 156 | idx.push_back(to); 157 | } 158 | 159 | return idx; 160 | } 161 | 162 | std::vector ManipulatorKinematicsDynamics::findRoute(int from, int to) 163 | { 164 | int id = manipulator_link_data_[to]->parent_; 165 | 166 | std::vector idx; 167 | 168 | if (id == from) 169 | { 170 | idx.push_back(from); 171 | idx.push_back(to); 172 | } 173 | else if (id != 0) 174 | { 175 | idx = findRoute(from, id); 176 | idx.push_back(to); 177 | } 178 | 179 | return idx; 180 | } 181 | 182 | double ManipulatorKinematicsDynamics::totalMass(int joint_ID) 183 | { 184 | double mass; 185 | 186 | if (joint_ID == -1) 187 | mass = 0.0; 188 | else 189 | mass = manipulator_link_data_[joint_ID]->mass_ + totalMass(manipulator_link_data_[joint_ID]->sibling_) 190 | + totalMass(manipulator_link_data_[joint_ID]->child_); 191 | 192 | return mass; 193 | } 194 | 195 | Eigen::MatrixXd ManipulatorKinematicsDynamics::calcMC(int joint_ID) 196 | { 197 | Eigen::MatrixXd mc(3, 1); 198 | 199 | if (joint_ID == -1) 200 | mc = Eigen::MatrixXd::Zero(3, 1); 201 | else 202 | { 203 | mc = manipulator_link_data_[joint_ID]->mass_ * (manipulator_link_data_[joint_ID]->orientation_ 204 | * manipulator_link_data_[joint_ID]->center_of_mass_ + manipulator_link_data_[joint_ID]->position_); 205 | mc = mc + calcMC(manipulator_link_data_[joint_ID]->sibling_) + calcMC(manipulator_link_data_[joint_ID]->child_); 206 | } 207 | 208 | return mc; 209 | } 210 | 211 | Eigen::MatrixXd ManipulatorKinematicsDynamics::calcCOM(Eigen::MatrixXd MC) 212 | { 213 | double mass; 214 | Eigen::MatrixXd COM(3, 1); 215 | 216 | mass = totalMass(0); 217 | 218 | COM = MC / mass; 219 | 220 | return COM; 221 | } 222 | 223 | void ManipulatorKinematicsDynamics::forwardKinematics(int joint_ID) 224 | { 225 | if (joint_ID == -1) 226 | return; 227 | 228 | manipulator_link_data_[0]->position_ = Eigen::MatrixXd::Zero(3, 1); 229 | manipulator_link_data_[0]->orientation_ = robotis_framework::calcRodrigues( 230 | robotis_framework::calcHatto(manipulator_link_data_[0]->joint_axis_), 231 | manipulator_link_data_[0]->joint_angle_ 232 | ); 233 | 234 | if (joint_ID != 0) 235 | { 236 | int parent = manipulator_link_data_[joint_ID]->parent_; 237 | 238 | manipulator_link_data_[joint_ID]->position_ = manipulator_link_data_[parent]->orientation_ 239 | * manipulator_link_data_[joint_ID]->relative_position_ 240 | + manipulator_link_data_[parent]->position_; 241 | manipulator_link_data_[joint_ID]->orientation_ = manipulator_link_data_[parent]->orientation_ 242 | * robotis_framework::calcRodrigues(robotis_framework::calcHatto(manipulator_link_data_[joint_ID]->joint_axis_), 243 | manipulator_link_data_[joint_ID]->joint_angle_); 244 | 245 | manipulator_link_data_[joint_ID]->transformation_.block<3, 1>(0, 3) = manipulator_link_data_[joint_ID]->position_; 246 | manipulator_link_data_[joint_ID]->transformation_.block<3, 3>(0, 0) = manipulator_link_data_[joint_ID]->orientation_; 247 | } 248 | 249 | forwardKinematics(manipulator_link_data_[joint_ID]->sibling_); 250 | forwardKinematics(manipulator_link_data_[joint_ID]->child_); 251 | } 252 | 253 | Eigen::MatrixXd ManipulatorKinematicsDynamics::calcJacobian(std::vector idx) 254 | { 255 | int idx_size = idx.size(); 256 | int end = idx_size - 1; 257 | 258 | Eigen::MatrixXd tar_position = manipulator_link_data_[idx[end]]->position_; 259 | Eigen::MatrixXd Jacobian = Eigen::MatrixXd::Zero(6, idx_size); 260 | 261 | for (int index = 0; index < idx_size; index++) 262 | { 263 | int id = idx[index]; 264 | 265 | Eigen::MatrixXd tar_orientation = manipulator_link_data_[id]->orientation_ * manipulator_link_data_[id]->joint_axis_; 266 | 267 | Jacobian.block(0, index, 3, 1) = robotis_framework::calcCross(tar_orientation, 268 | tar_position - manipulator_link_data_[id]->position_); 269 | Jacobian.block(3, index, 3, 1) = tar_orientation; 270 | } 271 | 272 | return Jacobian; 273 | } 274 | 275 | Eigen::MatrixXd ManipulatorKinematicsDynamics::calcJacobianCOM(std::vector idx) 276 | { 277 | int idx_size = idx.size(); 278 | int end = idx_size - 1; 279 | 280 | Eigen::MatrixXd target_position = manipulator_link_data_[idx[end]]->position_; 281 | Eigen::MatrixXd jacobianCOM = Eigen::MatrixXd::Zero(6, idx_size); 282 | 283 | for (int index = 0; index < idx_size; index++) 284 | { 285 | int id = idx[index]; 286 | double mass = totalMass(id); 287 | 288 | Eigen::MatrixXd og = calcMC(id) / mass - manipulator_link_data_[id]->position_; 289 | Eigen::MatrixXd target_orientation = manipulator_link_data_[id]->orientation_ * manipulator_link_data_[id]->joint_axis_; 290 | 291 | jacobianCOM.block(0, index, 3, 1) = robotis_framework::calcCross(target_orientation, og); 292 | jacobianCOM.block(3, index, 3, 1) = target_orientation; 293 | } 294 | 295 | return jacobianCOM; 296 | } 297 | 298 | Eigen::MatrixXd ManipulatorKinematicsDynamics::calcVWerr(Eigen::MatrixXd tar_position, Eigen::MatrixXd curr_position, 299 | Eigen::MatrixXd tar_orientation, Eigen::MatrixXd curr_orientation) 300 | { 301 | Eigen::MatrixXd pos_err = tar_position - curr_position; 302 | Eigen::MatrixXd ori_err1 = curr_orientation.inverse() * tar_orientation; 303 | Eigen::MatrixXd ori_err2 = curr_orientation * robotis_framework::convertRotToOmega(ori_err1); 304 | 305 | Eigen::MatrixXd err = Eigen::MatrixXd::Zero(6, 1); 306 | err.block(0, 0, 3, 1) = pos_err; 307 | err.block(3, 0, 3, 1) = ori_err2; 308 | 309 | return err; 310 | } 311 | 312 | bool ManipulatorKinematicsDynamics::inverseKinematics(int to, Eigen::MatrixXd tar_position, 313 | Eigen::MatrixXd tar_orientation, int max_iter, double ik_err) 314 | { 315 | bool ik_success = false; 316 | bool limit_success = false; 317 | 318 | forwardKinematics(0); 319 | 320 | std::vector idx = findRoute(to); 321 | 322 | for (int iter = 0; iter < max_iter; iter++) 323 | { 324 | Eigen::MatrixXd jacobian = calcJacobian(idx); 325 | 326 | Eigen::MatrixXd curr_position = manipulator_link_data_[to]->position_; 327 | Eigen::MatrixXd curr_orientation = manipulator_link_data_[to]->orientation_; 328 | 329 | Eigen::MatrixXd err = calcVWerr(tar_position, curr_position, tar_orientation, curr_orientation); 330 | 331 | if (err.norm() < ik_err) 332 | { 333 | ik_success = true; 334 | break; 335 | } 336 | else 337 | ik_success = false; 338 | 339 | Eigen::MatrixXd jacobian2 = jacobian * jacobian.transpose(); 340 | Eigen::MatrixXd jacobian3 = jacobian.transpose() * jacobian2.inverse(); 341 | 342 | Eigen::MatrixXd _delta_angle = jacobian3 * err; 343 | 344 | for (int id = 0; id < idx.size(); id++) 345 | { 346 | int joint_num = idx[id]; 347 | manipulator_link_data_[joint_num]->joint_angle_ += _delta_angle.coeff(id); 348 | } 349 | 350 | forwardKinematics(0); 351 | } 352 | 353 | for (int id = 0; id < idx.size(); id++) 354 | { 355 | int joint_num = idx[id]; 356 | 357 | if (manipulator_link_data_[joint_num]->joint_angle_ >= manipulator_link_data_[joint_num]->joint_limit_max_) 358 | { 359 | limit_success = false; 360 | break; 361 | } 362 | else if (manipulator_link_data_[joint_num]->joint_angle_ <= manipulator_link_data_[joint_num]->joint_limit_min_) 363 | { 364 | limit_success = false; 365 | break; 366 | } 367 | else 368 | limit_success = true; 369 | } 370 | 371 | if (ik_success == true && limit_success == true) 372 | return true; 373 | else 374 | return false; 375 | } 376 | 377 | bool ManipulatorKinematicsDynamics::inverseKinematics(int from, int to, Eigen::MatrixXd tar_position, 378 | Eigen::MatrixXd tar_orientation, int max_iter, double ik_err) 379 | { 380 | bool ik_success = false; 381 | bool limit_success = false; 382 | 383 | forwardKinematics(0); 384 | 385 | std::vector idx = findRoute(from, to); 386 | 387 | for (int iter = 0; iter < max_iter; iter++) 388 | { 389 | Eigen::MatrixXd jacobian = calcJacobian(idx); 390 | 391 | Eigen::MatrixXd curr_position = manipulator_link_data_[to]->position_; 392 | Eigen::MatrixXd curr_orientation = manipulator_link_data_[to]->orientation_; 393 | 394 | Eigen::MatrixXd err = calcVWerr(tar_position, curr_position, tar_orientation, curr_orientation); 395 | 396 | if (err.norm() < ik_err) 397 | { 398 | ik_success = true; 399 | break; 400 | } 401 | else 402 | { 403 | ik_success = false; 404 | } 405 | 406 | Eigen::MatrixXd jacobian2 = jacobian * jacobian.transpose(); 407 | Eigen::MatrixXd jacobian3 = jacobian.transpose() * jacobian2.inverse(); 408 | 409 | Eigen::MatrixXd delta_angle = jacobian3 * err; 410 | 411 | for (int id = 0; id < idx.size(); id++) 412 | { 413 | int joint_num = idx[id]; 414 | manipulator_link_data_[joint_num]->joint_angle_ += delta_angle.coeff(id); 415 | } 416 | 417 | forwardKinematics(0); 418 | } 419 | 420 | for (int id = 0; id < idx.size(); id++) 421 | { 422 | int joint_num = idx[id]; 423 | 424 | if (manipulator_link_data_[joint_num]->joint_angle_ >= manipulator_link_data_[joint_num]->joint_limit_max_) 425 | { 426 | limit_success = false; 427 | break; 428 | } 429 | else if (manipulator_link_data_[joint_num]->joint_angle_ <= manipulator_link_data_[joint_num]->joint_limit_min_) 430 | { 431 | limit_success = false; 432 | break; 433 | } 434 | else 435 | limit_success = true; 436 | } 437 | 438 | if (ik_success == true && limit_success == true) 439 | return true; 440 | else 441 | return false; 442 | } 443 | 444 | } 445 | -------------------------------------------------------------------------------- /manipulator_h_base_module/src/base_module.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2018 ROBOTIS CO., LTD. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * ThorManipulation.cpp 19 | * 20 | * Created on: 2016. 1. 18. 21 | * Author: Zerom 22 | */ 23 | 24 | #include 25 | 26 | #include "manipulator_h_base_module/base_module.h" 27 | 28 | using namespace robotis_manipulator_h; 29 | 30 | BaseModule::BaseModule() 31 | : control_cycle_msec_(0) 32 | { 33 | enable_ = false; 34 | module_name_ = "base_module"; 35 | control_mode_ = robotis_framework::PositionControl; 36 | 37 | tra_gene_thread_ = NULL; 38 | 39 | result_["joint1"] = new robotis_framework::DynamixelState(); 40 | result_["joint2"] = new robotis_framework::DynamixelState(); 41 | result_["joint3"] = new robotis_framework::DynamixelState(); 42 | result_["joint4"] = new robotis_framework::DynamixelState(); 43 | result_["joint5"] = new robotis_framework::DynamixelState(); 44 | result_["joint6"] = new robotis_framework::DynamixelState(); 45 | 46 | joint_name_to_id_["joint1"] = 1; 47 | joint_name_to_id_["joint2"] = 2; 48 | joint_name_to_id_["joint3"] = 3; 49 | joint_name_to_id_["joint4"] = 4; 50 | joint_name_to_id_["joint5"] = 5; 51 | joint_name_to_id_["joint6"] = 6; 52 | 53 | robotis_ = new RobotisState(); 54 | joint_state_ = new BaseJointState(); 55 | manipulator_ = new ManipulatorKinematicsDynamics(ARM); 56 | } 57 | 58 | BaseModule::~BaseModule() 59 | { 60 | queue_thread_.join(); 61 | } 62 | 63 | void BaseModule::initialize(const int control_cycle_msec, robotis_framework::Robot *robot) 64 | { 65 | control_cycle_msec_ = control_cycle_msec; 66 | queue_thread_ = boost::thread(boost::bind(&BaseModule::queueThread, this)); 67 | } 68 | 69 | void BaseModule::parseIniPoseData(const std::string &path) 70 | { 71 | YAML::Node doc; 72 | try 73 | { 74 | // load yaml 75 | doc = YAML::LoadFile(path.c_str()); 76 | } catch (const std::exception& e) 77 | { 78 | ROS_ERROR("Fail to load yaml file."); 79 | return; 80 | } 81 | 82 | // parse movement time 83 | double _mov_time; 84 | _mov_time = doc["mov_time"].as(); 85 | 86 | robotis_->mov_time_ = _mov_time; 87 | 88 | // parse target pose 89 | YAML::Node _tar_pose_node = doc["tar_pose"]; 90 | for (YAML::iterator _it = _tar_pose_node.begin(); _it != _tar_pose_node.end(); ++_it) 91 | { 92 | int _id; 93 | double _value; 94 | 95 | _id = _it->first.as(); 96 | _value = _it->second.as(); 97 | 98 | robotis_->joint_ini_pose_.coeffRef(_id, 0) = _value * DEGREE2RADIAN; 99 | } 100 | 101 | robotis_->all_time_steps_ = int(robotis_->mov_time_ / robotis_->smp_time_) + 1; 102 | robotis_->calc_joint_tra_.resize(robotis_->all_time_steps_, MAX_JOINT_ID + 1); 103 | } 104 | 105 | void BaseModule::queueThread() 106 | { 107 | ros::NodeHandle ros_node; 108 | ros::CallbackQueue callback_queue; 109 | 110 | ros_node.setCallbackQueue(&callback_queue); 111 | 112 | /* publish topics */ 113 | status_msg_pub_ = ros_node.advertise("/robotis/status", 1); 114 | set_ctrl_module_pub_ = ros_node.advertise("/robotis/enable_ctrl_module", 1); 115 | 116 | /* subscribe topics */ 117 | ros::Subscriber ini_pose_msg_sub = ros_node.subscribe("/robotis/base/ini_pose_msg", 5, 118 | &BaseModule::initPoseMsgCallback, this); 119 | ros::Subscriber set_mode_msg_sub = ros_node.subscribe("/robotis/base/set_mode_msg", 5, 120 | &BaseModule::setModeMsgCallback, this); 121 | 122 | ros::Subscriber joint_pose_msg_sub = ros_node.subscribe("/robotis/base/joint_pose_msg", 5, 123 | &BaseModule::jointPoseMsgCallback, this); 124 | ros::Subscriber kinematics_pose_msg_sub = ros_node.subscribe("/robotis/base/kinematics_pose_msg", 5, 125 | &BaseModule::kinematicsPoseMsgCallback, this); 126 | 127 | ros::ServiceServer get_joint_pose_server = ros_node.advertiseService("/robotis/base/get_joint_pose", 128 | &BaseModule::getJointPoseCallback, this); 129 | ros::ServiceServer get_kinematics_pose_server = ros_node.advertiseService("/robotis/base/get_kinematics_pose", 130 | &BaseModule::getKinematicsPoseCallback, this); 131 | 132 | while (ros_node.ok()) 133 | { 134 | callback_queue.callAvailable(); 135 | usleep(1000); 136 | } 137 | } 138 | 139 | void BaseModule::initPoseMsgCallback(const std_msgs::String::ConstPtr& msg) 140 | { 141 | if (enable_ == false) 142 | return; 143 | 144 | if (robotis_->is_moving_ == false) 145 | { 146 | if (msg->data == "ini_pose") 147 | { 148 | // parse initial pose 149 | std::string ini_pose_path = ros::package::getPath("manipulator_h_base_module") + "/config/ini_pose.yaml"; 150 | parseIniPoseData(ini_pose_path); 151 | 152 | tra_gene_thread_ = new boost::thread(boost::bind(&BaseModule::generateInitPoseTrajProcess, this)); 153 | delete tra_gene_thread_; 154 | } 155 | } 156 | else 157 | { 158 | ROS_INFO("previous task is alive"); 159 | } 160 | 161 | return; 162 | } 163 | 164 | void BaseModule::setModeMsgCallback(const std_msgs::String::ConstPtr& msg) 165 | { 166 | std_msgs::String str_msg; 167 | str_msg.data = "base_module"; 168 | 169 | set_ctrl_module_pub_.publish(str_msg); 170 | 171 | return; 172 | } 173 | 174 | bool BaseModule::getJointPoseCallback(manipulator_h_base_module_msgs::GetJointPose::Request &req, 175 | manipulator_h_base_module_msgs::GetJointPose::Response &res) 176 | { 177 | if (enable_ == false) 178 | return false; 179 | 180 | for (int id = 1; id <= MAX_JOINT_ID; id++) 181 | { 182 | for (int name_index = 0; name_index < req.joint_name.size(); name_index++) 183 | { 184 | if (manipulator_->manipulator_link_data_[id]->name_ == req.joint_name[name_index]) 185 | { 186 | res.joint_name.push_back(manipulator_->manipulator_link_data_[id]->name_); 187 | res.joint_value.push_back(joint_state_->goal_joint_state_[id].position_); 188 | 189 | break; 190 | } 191 | } 192 | } 193 | 194 | return true; 195 | } 196 | 197 | bool BaseModule::getKinematicsPoseCallback(manipulator_h_base_module_msgs::GetKinematicsPose::Request &req, 198 | manipulator_h_base_module_msgs::GetKinematicsPose::Response &res) 199 | { 200 | if (enable_ == false) 201 | return false; 202 | 203 | res.group_pose.position.x = manipulator_->manipulator_link_data_[END_LINK]->position_.coeff(0, 0); 204 | res.group_pose.position.y = manipulator_->manipulator_link_data_[END_LINK]->position_.coeff(1, 0); 205 | res.group_pose.position.z = manipulator_->manipulator_link_data_[END_LINK]->position_.coeff(2, 0); 206 | 207 | Eigen::Quaterniond quaternion = robotis_framework::convertRotationToQuaternion(manipulator_->manipulator_link_data_[END_LINK]->orientation_); 208 | 209 | res.group_pose.orientation.w = quaternion.w(); 210 | res.group_pose.orientation.x = quaternion.x(); 211 | res.group_pose.orientation.y = quaternion.y(); 212 | res.group_pose.orientation.z = quaternion.z(); 213 | 214 | return true; 215 | } 216 | 217 | void BaseModule::kinematicsPoseMsgCallback(const manipulator_h_base_module_msgs::KinematicsPose::ConstPtr& msg) 218 | { 219 | if (enable_ == false) 220 | return; 221 | 222 | robotis_->kinematics_pose_msg_ = *msg; 223 | 224 | robotis_->ik_id_start_ = 0; 225 | robotis_->ik_id_end_ = END_LINK; 226 | 227 | if (robotis_->is_moving_ == false) 228 | { 229 | tra_gene_thread_ = new boost::thread(boost::bind(&BaseModule::generateTaskTrajProcess, this)); 230 | delete tra_gene_thread_; 231 | } 232 | else 233 | { 234 | ROS_INFO("previous task is alive"); 235 | } 236 | 237 | return; 238 | } 239 | 240 | void BaseModule::jointPoseMsgCallback(const manipulator_h_base_module_msgs::JointPose::ConstPtr& msg) 241 | { 242 | if (enable_ == false) 243 | return; 244 | 245 | robotis_->joint_pose_msg_ = *msg; 246 | 247 | if (robotis_->is_moving_ == false) 248 | { 249 | tra_gene_thread_ = new boost::thread(boost::bind(&BaseModule::generateJointTrajProcess, this)); 250 | delete tra_gene_thread_; 251 | } 252 | else 253 | { 254 | ROS_INFO("previous task is alive"); 255 | } 256 | 257 | return; 258 | } 259 | 260 | void BaseModule::generateInitPoseTrajProcess() 261 | { 262 | if (enable_ == false) 263 | return; 264 | 265 | for (int id = 1; id <= MAX_JOINT_ID; id++) 266 | { 267 | double ini_value = joint_state_->goal_joint_state_[id].position_; 268 | double tar_value = robotis_->joint_ini_pose_.coeff(id, 0); 269 | 270 | Eigen::MatrixXd tra = robotis_framework::calcMinimumJerkTra(ini_value, 0.0, 0.0, tar_value, 0.0, 0.0, 271 | robotis_->smp_time_, robotis_->mov_time_); 272 | 273 | robotis_->calc_joint_tra_.block(0, id, robotis_->all_time_steps_, 1) = tra; 274 | } 275 | 276 | robotis_->cnt_ = 0; 277 | robotis_->is_moving_ = true; 278 | 279 | ROS_INFO("[start] send trajectory"); 280 | publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, "Start Trajectory"); 281 | } 282 | 283 | void BaseModule::generateJointTrajProcess() 284 | { 285 | if (enable_ == false) 286 | return; 287 | 288 | /* set movement time */ 289 | double tol = 35 * DEGREE2RADIAN; // rad per sec 290 | double mov_time = 2.0; 291 | 292 | double max_diff, abs_diff; 293 | max_diff = 0.0; 294 | 295 | for (int name_index = 0; name_index < robotis_->joint_pose_msg_.name.size(); name_index++) 296 | { 297 | double ini_value; 298 | double tar_value; 299 | 300 | for (int id = 1; id <= MAX_JOINT_ID; id++) 301 | { 302 | if (manipulator_->manipulator_link_data_[id]->name_ == robotis_->joint_pose_msg_.name[name_index]) 303 | { 304 | ini_value = joint_state_->goal_joint_state_[id].position_; 305 | tar_value = robotis_->joint_pose_msg_.value[name_index]; 306 | 307 | break; 308 | } 309 | } 310 | 311 | abs_diff = fabs(tar_value - ini_value); 312 | 313 | if (max_diff < abs_diff) 314 | max_diff = abs_diff; 315 | } 316 | 317 | robotis_->mov_time_ = max_diff / tol; 318 | int all_time_steps = int(floor((robotis_->mov_time_ / robotis_->smp_time_) + 1.0)); 319 | robotis_->mov_time_ = double(all_time_steps - 1) * robotis_->smp_time_; 320 | 321 | if (robotis_->mov_time_ < mov_time) 322 | robotis_->mov_time_ = mov_time; 323 | 324 | robotis_->all_time_steps_ = int(robotis_->mov_time_ / robotis_->smp_time_) + 1; 325 | 326 | robotis_->calc_joint_tra_.resize(robotis_->all_time_steps_, MAX_JOINT_ID + 1); 327 | 328 | /* calculate joint trajectory */ 329 | for (int id = 1; id <= MAX_JOINT_ID; id++) 330 | { 331 | double ini_value = joint_state_->goal_joint_state_[id].position_; 332 | double tar_value; 333 | 334 | for (int name_index = 0; name_index < robotis_->joint_pose_msg_.name.size(); name_index++) 335 | { 336 | if (manipulator_->manipulator_link_data_[id]->name_ == robotis_->joint_pose_msg_.name[name_index]) 337 | { 338 | tar_value = robotis_->joint_pose_msg_.value[name_index]; 339 | break; 340 | } 341 | } 342 | 343 | Eigen::MatrixXd tra = robotis_framework::calcMinimumJerkTra(ini_value, 0.0, 0.0, tar_value, 0.0, 0.0, 344 | robotis_->smp_time_, robotis_->mov_time_); 345 | 346 | robotis_->calc_joint_tra_.block(0, id, robotis_->all_time_steps_, 1) = tra; 347 | } 348 | 349 | robotis_->cnt_ = 0; 350 | robotis_->is_moving_ = true; 351 | 352 | ROS_INFO("[start] send trajectory"); 353 | publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, "Start Trajectory"); 354 | } 355 | 356 | void BaseModule::generateTaskTrajProcess() 357 | { 358 | /* set movement time */ 359 | double tol = 0.1; // m per sec 360 | double mov_time = 2.0; 361 | 362 | double diff = sqrt( 363 | pow(manipulator_->manipulator_link_data_[robotis_->ik_id_end_]->position_.coeff(0, 0) 364 | - robotis_->kinematics_pose_msg_.pose.position.x, 2) 365 | + pow(manipulator_->manipulator_link_data_[robotis_->ik_id_end_]->position_.coeff(1, 0) 366 | - robotis_->kinematics_pose_msg_.pose.position.y, 2) 367 | + pow(manipulator_->manipulator_link_data_[robotis_->ik_id_end_]->position_.coeff(2, 0) 368 | - robotis_->kinematics_pose_msg_.pose.position.z, 2) 369 | ); 370 | 371 | robotis_->mov_time_ = diff / tol; 372 | int all_time_steps = int(floor((robotis_->mov_time_ / robotis_->smp_time_) + 1.0)); 373 | robotis_->mov_time_ = double(all_time_steps - 1) * robotis_->smp_time_; 374 | 375 | if (robotis_->mov_time_ < mov_time) 376 | robotis_->mov_time_ = mov_time; 377 | 378 | robotis_->all_time_steps_ = int(robotis_->mov_time_ / robotis_->smp_time_) + 1; 379 | 380 | robotis_->calc_task_tra_.resize(robotis_->all_time_steps_, 3); 381 | 382 | /* calculate trajectory */ 383 | for (int dim = 0; dim < 3; dim++) 384 | { 385 | double ini_value = manipulator_->manipulator_link_data_[robotis_->ik_id_end_]->position_.coeff(dim, 0); 386 | double tar_value; 387 | 388 | if (dim == 0) 389 | tar_value = robotis_->kinematics_pose_msg_.pose.position.x; 390 | else if (dim == 1) 391 | tar_value = robotis_->kinematics_pose_msg_.pose.position.y; 392 | else if (dim == 2) 393 | tar_value = robotis_->kinematics_pose_msg_.pose.position.z; 394 | 395 | Eigen::MatrixXd tra = robotis_framework::calcMinimumJerkTra(ini_value, 0.0, 0.0, tar_value, 0.0, 0.0, 396 | robotis_->smp_time_, robotis_->mov_time_); 397 | 398 | robotis_->calc_task_tra_.block(0, dim, robotis_->all_time_steps_, 1) = tra; 399 | } 400 | 401 | robotis_->cnt_ = 0; 402 | robotis_->is_moving_ = true; 403 | robotis_->ik_solve_ = true; 404 | 405 | ROS_INFO("[start] send trajectory"); 406 | publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, "Start Trajectory"); 407 | } 408 | 409 | void BaseModule::process(std::map dxls, 410 | std::map sensors) 411 | { 412 | if (enable_ == false) 413 | return; 414 | 415 | /*----- write curr position -----*/ 416 | 417 | for (std::map::iterator state_iter = result_.begin(); 418 | state_iter != result_.end(); state_iter++) 419 | { 420 | std::string joint_name = state_iter->first; 421 | 422 | robotis_framework::Dynamixel *dxl = NULL; 423 | std::map::iterator dxl_it = dxls.find(joint_name); 424 | if (dxl_it != dxls.end()) 425 | dxl = dxl_it->second; 426 | else 427 | continue; 428 | 429 | double joint_curr_position = dxl->dxl_state_->present_position_; 430 | double joint_goal_position = dxl->dxl_state_->goal_position_; 431 | 432 | joint_state_->curr_joint_state_[joint_name_to_id_[joint_name]].position_ = joint_curr_position; 433 | joint_state_->goal_joint_state_[joint_name_to_id_[joint_name]].position_ = joint_goal_position; 434 | } 435 | 436 | /*----- forward kinematics -----*/ 437 | 438 | for (int id = 1; id <= MAX_JOINT_ID; id++) 439 | manipulator_->manipulator_link_data_[id]->joint_angle_ = joint_state_->goal_joint_state_[id].position_; 440 | 441 | manipulator_->forwardKinematics(0); 442 | 443 | /* ----- send trajectory ----- */ 444 | 445 | // ros::Time time = ros::Time::now(); 446 | if (robotis_->is_moving_ == true) 447 | { 448 | if (robotis_->cnt_ == 0) 449 | robotis_->ik_start_rotation_ = manipulator_->manipulator_link_data_[robotis_->ik_id_end_]->orientation_; 450 | 451 | if (robotis_->ik_solve_ == true) 452 | { 453 | robotis_->setInverseKinematics(robotis_->cnt_, robotis_->ik_start_rotation_); 454 | 455 | int max_iter = 30; 456 | double ik_tol = 1e-3; 457 | bool ik_success = manipulator_->inverseKinematics(robotis_->ik_id_start_, robotis_->ik_id_end_, 458 | robotis_->ik_target_position_, robotis_->ik_target_rotation_, max_iter, ik_tol); 459 | 460 | if (ik_success == true) 461 | { 462 | for (int id = 1; id <= MAX_JOINT_ID; id++) 463 | joint_state_->goal_joint_state_[id].position_ = manipulator_->manipulator_link_data_[id]->joint_angle_; 464 | } 465 | else 466 | { 467 | ROS_INFO("[end] send trajectory (ik failed)"); 468 | publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, "End Trajectory (IK Failed)"); 469 | 470 | robotis_->is_moving_ = false; 471 | robotis_->ik_solve_ = false; 472 | robotis_->cnt_ = 0; 473 | } 474 | } 475 | else 476 | { 477 | for (int id = 1; id <= MAX_JOINT_ID; id++) 478 | joint_state_->goal_joint_state_[id].position_ = robotis_->calc_joint_tra_(robotis_->cnt_, id); 479 | } 480 | 481 | robotis_->cnt_++; 482 | } 483 | 484 | /*----- set joint data -----*/ 485 | 486 | for (std::map::iterator state_iter = result_.begin(); 487 | state_iter != result_.end(); state_iter++) 488 | { 489 | std::string joint_name = state_iter->first; 490 | result_[joint_name]->goal_position_ = joint_state_->goal_joint_state_[joint_name_to_id_[joint_name]].position_; 491 | } 492 | 493 | /*---------- initialize count number ----------*/ 494 | 495 | if (robotis_->cnt_ >= robotis_->all_time_steps_ && robotis_->is_moving_ == true) 496 | { 497 | ROS_INFO("[end] send trajectory"); 498 | publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO, "End Trajectory"); 499 | 500 | robotis_->is_moving_ = false; 501 | robotis_->ik_solve_ = false; 502 | robotis_->cnt_ = 0; 503 | } 504 | } 505 | 506 | void BaseModule::stop() 507 | { 508 | robotis_->is_moving_ = false; 509 | robotis_->ik_solve_ = false; 510 | robotis_->cnt_ = 0; 511 | 512 | return; 513 | } 514 | 515 | bool BaseModule::isRunning() 516 | { 517 | return robotis_->is_moving_; 518 | } 519 | 520 | void BaseModule::publishStatusMsg(unsigned int type, std::string msg) 521 | { 522 | robotis_controller_msgs::StatusMsg status; 523 | status.header.stamp = ros::Time::now(); 524 | status.type = type; 525 | status.module_name = "Base"; 526 | status.status_msg = msg; 527 | 528 | status_msg_pub_.publish(status); 529 | } 530 | -------------------------------------------------------------------------------- /manipulator_h_gui/ui/main_window.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindowDesign 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1047 10 | 612 11 | 12 | 13 | 14 | QRosApp 15 | 16 | 17 | 18 | :/images/icon.png:/images/icon.png 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 100 30 | 0 31 | 32 | 33 | 34 | 35 | 36 | 37 | 0 38 | 39 | 40 | 41 | Ros Communications 42 | 43 | 44 | 45 | 46 | 47 | 48 | 0 49 | 0 50 | 51 | 52 | 53 | Logging 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 0 72 | 0 73 | 1047 74 | 19 75 | 76 | 77 | 78 | 79 | &App 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 0 95 | 0 96 | 97 | 98 | 99 | 100 | 500 101 | 560 102 | 103 | 104 | 105 | 106 | 524287 107 | 10000 108 | 109 | 110 | 111 | Qt::RightDockWidgetArea 112 | 113 | 114 | Command Panel 115 | 116 | 117 | 2 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 0 126 | 0 127 | 128 | 129 | 130 | 131 | 16777215 132 | 600 133 | 134 | 135 | 136 | QFrame::StyledPanel 137 | 138 | 139 | QFrame::Raised 140 | 141 | 142 | 143 | 144 | 145 | Task Space Control 146 | 147 | 148 | 149 | 150 | 151 | Get current pose 152 | 153 | 154 | 155 | 156 | 157 | 158 | position x [m] 159 | 160 | 161 | 162 | 163 | 164 | 165 | 3 166 | 167 | 168 | -10.000000000000000 169 | 170 | 171 | 10.000000000000000 172 | 173 | 174 | 0.010000000000000 175 | 176 | 177 | 178 | 179 | 180 | 181 | position y [m] 182 | 183 | 184 | 185 | 186 | 187 | 188 | 3 189 | 190 | 191 | -10.000000000000000 192 | 193 | 194 | 10.000000000000000 195 | 196 | 197 | 0.010000000000000 198 | 199 | 200 | 201 | 202 | 203 | 204 | position z [m] 205 | 206 | 207 | 208 | 209 | 210 | 211 | 3 212 | 213 | 214 | -10.000000000000000 215 | 216 | 217 | 10.000000000000000 218 | 219 | 220 | 0.010000000000000 221 | 222 | 223 | 224 | 225 | 226 | 227 | orientation roll [deg] 228 | 229 | 230 | 231 | 232 | 233 | 234 | 3 235 | 236 | 237 | -360.000000000000000 238 | 239 | 240 | 360.000000000000000 241 | 242 | 243 | 0.500000000000000 244 | 245 | 246 | 247 | 248 | 249 | 250 | orientation pitch [deg] 251 | 252 | 253 | 254 | 255 | 256 | 257 | 3 258 | 259 | 260 | -360.000000000000000 261 | 262 | 263 | 360.000000000000000 264 | 265 | 266 | 0.500000000000000 267 | 268 | 269 | 270 | 271 | 272 | 273 | orientation yaw [deg] 274 | 275 | 276 | 277 | 278 | 279 | 280 | 3 281 | 282 | 283 | -360.000000000000000 284 | 285 | 286 | 360.000000000000000 287 | 288 | 289 | 0.500000000000000 290 | 291 | 292 | 293 | 294 | 295 | 296 | Send Des Pos. 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | Joint Space Control 307 | 308 | 309 | 310 | 311 | 312 | Get current joint values 313 | 314 | 315 | 316 | 317 | 318 | 319 | Joint 1 [deg] 320 | 321 | 322 | 323 | 324 | 325 | 326 | -180.000000000000000 327 | 328 | 329 | 180.000000000000000 330 | 331 | 332 | 0.500000000000000 333 | 334 | 335 | 336 | 337 | 338 | 339 | Joint 2 [deg] 340 | 341 | 342 | 343 | 344 | 345 | 346 | -180.000000000000000 347 | 348 | 349 | 180.000000000000000 350 | 351 | 352 | 0.500000000000000 353 | 354 | 355 | 356 | 357 | 358 | 359 | Joint 3 [deg] 360 | 361 | 362 | 363 | 364 | 365 | 366 | -180.000000000000000 367 | 368 | 369 | 180.000000000000000 370 | 371 | 372 | 0.500000000000000 373 | 374 | 375 | 376 | 377 | 378 | 379 | Joint 4 [deg] 380 | 381 | 382 | 383 | 384 | 385 | 386 | -180.000000000000000 387 | 388 | 389 | 180.000000000000000 390 | 391 | 392 | 0.500000000000000 393 | 394 | 395 | 396 | 397 | 398 | 399 | Joint 5 [deg] 400 | 401 | 402 | 403 | 404 | 405 | 406 | -180.000000000000000 407 | 408 | 409 | 180.000000000000000 410 | 411 | 412 | 0.500000000000000 413 | 414 | 415 | 416 | 417 | 418 | 419 | Joint 6 [deg] 420 | 421 | 422 | 423 | 424 | 425 | 426 | -360.000000000000000 427 | 428 | 429 | 360.000000000000000 430 | 431 | 432 | 0.500000000000000 433 | 434 | 435 | 436 | 437 | 438 | 439 | Send Des Joint Val. 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | true 453 | 454 | 455 | 456 | 50 457 | 50 458 | 459 | 460 | 461 | QFrame::StyledPanel 462 | 463 | 464 | QFrame::Raised 465 | 466 | 467 | 468 | 469 | 470 | Set Mode 471 | 472 | 473 | 474 | 475 | 476 | 477 | Go to Initial Pose 478 | 479 | 480 | 481 | 482 | 483 | 484 | Quit 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | &Quit 497 | 498 | 499 | Ctrl+Q 500 | 501 | 502 | Qt::ApplicationShortcut 503 | 504 | 505 | 506 | 507 | &Preferences 508 | 509 | 510 | 511 | 512 | &About 513 | 514 | 515 | 516 | 517 | About &Qt 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | action_Quit 527 | triggered() 528 | MainWindowDesign 529 | close() 530 | 531 | 532 | -1 533 | -1 534 | 535 | 536 | 399 537 | 299 538 | 539 | 540 | 541 | 542 | quit_button 543 | clicked() 544 | MainWindowDesign 545 | close() 546 | 547 | 548 | 859 549 | 552 550 | 551 | 552 | 469 553 | 299 554 | 555 | 556 | 557 | 558 | 559 | --------------------------------------------------------------------------------