Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Controlling the hand motors #7

Open
Robotawi opened this issue Apr 14, 2017 · 6 comments
Open

Controlling the hand motors #7

Robotawi opened this issue Apr 14, 2017 · 6 comments

Comments

@Robotawi
Copy link

Robotawi commented Apr 14, 2017

Hello,
I am working with BarrettHand BH8-282 model.
Firstly, I tried installing the barrett_hand package with apt-get install ros-indigo-barrett-hand, but when I tried to launch the bhand_controller.launch an error saying that the file doesn't exist appeared. I found that the installed package actually doesn't have a launch directory, so I turned to clone it from git into my ROS workspace.

Until now, I managed to install the ROS, the peak driver, the package, and I can launch the bhand_controller.launch, and I can initialize the hand by calling the service which takes "action 1", and I can see the hand being initialized. I want to control the hand motors now. What I understand is that controlling the motors is done by publishing to some of the available topics, and there is an examples directory that publishes to the bhand_node/command topic. I tried publishing to this topic but the hand is not responding. Please, let me know the way I can control the hand motors.

Thank you

@RomanRobotnik
Copy link
Contributor

Hi,

You did the correct installing from sources. The configuration for the rosdistro installation is not working...

Regarding your question about controlling the hand, you can try the following:

  1. Try calling the services to open & close the hand:

rosservice call /bhand_node/actions "action: 2" (CLOSE)
rosservice call /bhand_node/actions "action: 3" (OPEN)

  1. Check the control mode reading the state topic and change it to CONTROL POSITION (at least for the initial tests):

$ rosservice call /bhand_node/set_control_mode "mode: 'POSITION'"
Try again sending commands to the command topic. The one of the example should work.

  1. You could use to rqt tool for the hand: rqt_bhand (http://wiki.ros.org/rqt_bhand). It is a fast and easy way to try everything.

Best regards,

Román

@Robotawi
Copy link
Author

Robotawi commented Apr 19, 2017

Hello,
Thank you for your reply
Firstly, I believe that the connection between the hand and the computer is established correctly, I got these messages after roslaunch of the bhand_controller.launch:

[INFO] [WallTime: 1492607366.954304] bhand_node: starting
PCANBasic::Initialize: Port /dev/pcanusb32 opened successfully
PCANBasic::Initialize: Port /dev/pcanusb32 configured
PCANBasic::Initialize: PCAN version info = Release_20170214_n

The problem is that the hand responds only to the service call with ("Action: 1"), but at the same time it returns False, and this error appears in the terminal windows in which I launched the bhand_controller.launch file:
[ERROR] [WallTime: 1492607711.220628] /bhand_node::handActions: error on INIT_HAND service
[ERROR] [WallTime: 1492607711.221472] /bhand_node::canError: Errors on CAN bus
[INFO] [WallTime: 1492607711.222388] BHand::switchToState: FAILURE_STATE
PCANBasic::Uninitialize: Port /dev/pcanusb32 closed successfully
[INFO] [WallTime: 1492607716.968345] BHand::switchToState: INIT_STATE
PCANBasic::Initialize: Port /dev/pcanusb32 opened successfully
PCANBasic::Initialize: Port /dev/pcanusb32 configured
PCANBasic::Initialize: PCAN version info = Release_20170214_n

As you see the pcan connection is restarted.

When I call the service with "Action: 2", or "Action: 3", it returns False, and this error appears in the terminal windows in which I launched the bhand_controller.launch file:
[ERROR] [WallTime: 1492607711.220628] /bhand_node::handActions: error on INIT_HAND service
[ERROR] [WallTime: 1492607711.221472] /bhand_node::canError: Errors on CAN bus

Please, let me know what may be the reason of these errors. May it be the package it self?
I followed the steps exactly.

@RomanRobotnik
Copy link
Contributor

Hi,

It could be a problem with the CAN driver compilation, as it was reported on the following issue:

issue 1

In that case, the problem was in a flag set in the compilation of the peak-can driver:

make NET=NO_NETDEV_SUPPORT
Could it be your case?

Which version are you using?

Regards

@Robotawi
Copy link
Author

Robotawi commented Apr 20, 2017

Thank you for your reply

I am using peak-Linux-driver 8.3.1 with Linux 14.04 64-bit and ROS indigo. I tried also version 7.15 and the hand doesn't move.

I followed issue 1 and commented the mentioned lines and there is some progress. The hand now responds to the predefined actions like close and open. The major problem is that the hand doesn't respond to publishing on the /bhand_node/command.

Sometimes whn I roslaunch the file: roslaunch bhand_controller bhand_controller.launch, I get this error:
File "/home/reassa/catkin_ws_bhsim/src/bhand_controller/src/bhand_controller/bhand_node.py", line 35, in
from pyHand_api import *
File "/home/reassa/catkin_ws_bhsim/src/bhand_controller/src/bhand_controller/pyHand_api.py", line 43, in
from pcan_python.pcan_library import *
File "/usr/local/lib/python2.7/dist-packages/pcan_python-0.1dev-py2.7.egg/pcan_python/pcan_library.py", line 35, in
from pcan_python import pcan_module
File "/usr/local/lib/python2.7/dist-packages/pcan_python-0.1dev-py2.7.egg/pcan_python/pcan_module.py", line 28, in
_pcan_module = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/pcan_python-0.1dev-py2.7.egg/pcan_python/pcan_module.py", line 20, in swig_import_helper
import _pcan_module
ImportError: No module named _pcan_module
[bhand_node-2] process has died [pid 3188, exit code 1, cmd /home/reassa/catkin_ws_bhsim/src/bhand_controller/src/bhand_controller/bhand_node.py __name:=bhand_node __log:=/home/reassa/.ros/log/04a18a72-2969-11e7-8ade-704d7bb8187a/bhand_node-2.log].
log file: /home/reassa/.ros/log/04a18a72-2969-11e7-8ade-704d7bb8187a/bhand_node-2*.log

but this error disappears when I run this command:
export PYTHONPATH=/usr/lib:$PYTHONPATH

I would like to know your recommendation to fix the current problem.
Thank you

@RomanRobotnik
Copy link
Contributor

Hi,

Commenting the lines referred in issue 1 is just to try, but it should work without it.

You should add export PYTHONPATH=/usr/lib:$PYTHONPATH in your .bashrc file in order to avoid that problem importing the library.

Regarding the version of the library, I've never tried with the new version 8.x.x, just with the 7.XX.

Once installed you should check that the NO_NET_DEV support is correctly set:

$> cat /proc/pcan

You should see: -NA- under ndev

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*-------------------------- Release_20120319_n (7.5.0) ----------------------
*---------------- [mod] [isa] [pci] [dng] [par] [usb] [pcc] -----------------
*--------------------- 1 interfaces @ major 250 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 255 0x0014 00000005 00000034 00000168 00000075 0x000c

@huiwenzhang
Copy link

huiwenzhang commented Aug 30, 2018

@RomanRobotnik Hi, I almost encounter the same problems. When I am calling the action service, errors showing:

[ERROR] [WallTime: 1535604260.103613] /bhand_node::handActions: action not allowed in state INIT_STATE
[ERROR] [WallTime: 1535604489.156539] /bhand_node::handActions: action not allowed in state INIT_STATE
[ERROR] [WallTime: 1535604622.412742] /bhand_node::handActions: error on INIT_HAND service
[ERROR] [WallTime: 1535604622.413523] /bhand_node::canError: Errors on CAN bus

I commented the code suggested in issue 1:

# self.get_property(FINGER1, ROLE)

in the init_hand method. It works, but I want to know is it correct to do like this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants