ROS nodes for ROHand. One bus, i.e. one port need one node.
cd ~
mkdir -p ros_ws/src
cd ros_ws/src
git clone ssh://[email protected]/oymotion/rohand_ros_pkg
Install pymodbus
cd /path/to/workspace # Should be ~/ros_ws
# Create a vertual env for python
virtualenv -p python3 ./venv
# Make sure that catkin doesn’t try to build the venv
touch ./venv/CATKIN_IGNORE
# Activate
source ./venv/bin/activate
# Install python module
python3 -m pip install pymodbus
Edit ~/bashrc
and add virtual env lib path to PYTHONPATH
export PYTHONPATH=$PYTHONPATH:~/ros_ws/venv/lib/python3.8/site-packages # Modify python3.8 to your actual versioni
source ~/.bashrc
cd /path/to/workspace
catkin_make
roscore
ROHand node for ModBus-RTU or ModBus-RTU & SerialCtrl Dual Protocol. Please confirm protocol type in OHandSetting. Listens to topic 'target_joint_state' and controls ROHand, reads current joint state and publish to 'current_joint_state'.
Topic | Description |
---|---|
"current_joint_state" | current joint state in message type JointState, frame_id in header distinguishes hand id |
"target_joint_state" | target joint state in message type JointState, frame_id in header distinguishes hand id |
# Open a new terminal to prepare package
source /path/to/workspace/devel/bash
# Insert USB-485 module to USB port then add permission to users
# Run following command every time you plug in your USB-485 module
sudo chmod o+rw /dev/ttyUSB0 # Modify ttyUSB0 to your actual device name
# Run node
rosrun rohand rohand.py _port_name:=/dev/ttyUSB0 _baudrate:=115200 _hand_ids:=[2,3] # Modify parameters according to your real case
ROHand node for SerialCtrl Protocol, Dual Protocol is NOT supported. Please confirm protocol type in OHandSetting. Listens to topic 'target_joint_state' and controls ROHand, reads current joint state and publish to 'current_joint_state'.
Topic | Description |
---|---|
"current_joint_state" | current joint state in message type JointState, frame_id in header distinguishes hand id |
"target_joint_state" | target joint state in message type JointState, frame_id in header distinguishes hand id |
"finger_state" | finger status in message type UInt8MultiArray |
# Open a new terminal to prepare package
source /path/to/workspace/devel/bash
# Insert USB-485 module to USB port then add permission to users
# Run following command every time you plug in your USB-485 module
sudo chmod o+rw /dev/ttyUSB0 # Modify ttyUSB0 to your actual device name
# Run node
rosrun rohand rohand_serial.py _port_name:=/dev/ttyUSB0 _baudrate:=115200 _hand_ids:=[2,3] # Modify parameters according to your real case
Finger status code:
Name | Code | Description |
---|---|---|
STATUS_OPENING | 0 | Spreading |
STATUS_CLOSING | 1 | Grasping |
STATUS_POS_REACHED | 2 | Position reached stop |
STATUS_OVER_CURRENT | 3 | Current protection stop |
STATUS_FORCE_REACHED | 4 | Force control reached stop |
STATUS_STUCK | 5 | Motor stuck stop |
Reads keys to modify target joint angles, then publish to 'target_joint_state'.
Topic | Description |
---|---|
"target_joint_state" | target joint state in message type JointState, frame_id in header distinguishes hand id |
# Open a new terminal to prepare package
source /path/to/workspace/devel/bash
# Run node
rosrun rohand rohand_teleop.py _rohand_teleop_node/target_joint_states:=/rohand_node/target_joint_states _hand_id:=2 # Modify parameters according to your real case
Press following keys to operate:
key | Description |
---|---|
q | quit |
a | thumb bends by step |
z | thumb relaxes by step |
s | index bends by step |
x | index relaxes by step |
d | middle bends by step |
c | middle relaxes by step |
f | ring bends by step |
v | ring relaxes by step |
g | little bends by step |
b | little relaxes by step |
h | thumb rotation +step |
n | thumb rotation -step |
Step is range / 10.