## Control robot arm by joystick

Typically: "How do I... ", "How can I... " questions
ljklonepiece
Posts: 105
Joined: 10 Oct 2013, 14:51

### Control robot arm by joystick

Hi Marc,

I was wondering if it is possible to control the end effector (position and orientation)of robot arm from a joystick in 64-bit Linux?
If so, how can i set up the joystick bindings and read joystick readings in order to control the arm?
Could you give some rough idea on this?

Thanks a lot for your help!

Yours sincerely,
Juekun

coppelia
Posts: 7691
Joined: 14 Dec 2012, 00:25

### Re: Control robot arm by joystick

Hello Juekun,

if you were running on Windows, you would directly be able to use the joystick plugin.
Under Linux, have a look at the ROS gamepad interface.

Cheers

ljklonepiece
Posts: 105
Joined: 10 Oct 2013, 14:51

### Re: Control robot arm by joystick

Dear Marc,

Thanks a lot for your suggestions!
I finally make the joystick to work

However, as you may see, the hand fails to grasp the cuboid which has the following dynamic property:

1. non-static,
2. body is respondable, all the masks are checked
3. material: highFrictionMaterial
4. Mass: 0.1 etc..

in the common property:
1. collidable, renderable, detectable an measurable are all checked

How shall I improve the grasp quality?

Yours sincerely,
juekun

coppelia
Posts: 7691
Joined: 14 Dec 2012, 00:25

### Re: Control robot arm by joystick

You can adjust various parameters, such as the closing force and velocity:

You will have to adjust the force of the 2 prismatic joints marked in red in the scene hierarchy. Normally 10 N should be fine. To adjust the closing velocity, have a look at the child script attached to the Mico hand model.

Try also to use the Vortex engine and see how the result look like: the Vortex engine is much more stable, forgiving (and realistic) than the 2 other engines.

Cheers

ljklonepiece
Posts: 105
Joined: 10 Oct 2013, 14:51

### Re: Control robot arm by joystick

Dear Marc,

Thanks a lot for your suggestions!

Correct me if I am wrong, the two joints in red in the hierarchy is MicoHand_finger12_motor1 and MicoHand_finger12_motor2, so I change their max. torque/force to 50 in the dynamic parameters, but it still cannot work well in Bullet and ODE, i also increase the closing velocity in the child script.

Vortex plugin as you said works perfectly well, what is the price of vortex plugin for long-term use?
Thanks a lot

Yours sincerely,
Juekun

coppelia
Posts: 7691
Joined: 14 Dec 2012, 00:25

### Re: Control robot arm by joystick

Yes, those are the joints. 50 Newton is already too much for the Bullet/ODE engines. I would go with 2-10 N. If not already set, make sure the 4 pads holding the object (MicoHand_pad1_finger1, MicoHand_pad2_finger1, MicoHand_pad1_finger3 and MicoHand_pad2_finger3) use a material where the Bullet engine has the sticky contact property enabled.

Since you are using a beta version of the gripper, you might have other wrong settings. The easiest would be to post the scene file here, so that we can have a look at it.

The Vortex plugin is developed and distributed by Simwat.

Cheers

ljklonepiece
Posts: 105
Joined: 10 Oct 2013, 14:51

### Re: Control robot arm by joystick

Thanks a lot Marc!

The problem solved by using stick property of bullet!

Another problem is that I want the arm to rotate with respect to its own frame, here is what i do

Code: Select all

h=simGetObjectHandle('MicoHand')
ori_increment=0.001
iori=simGetObjectOrientation(h,-1)
simSetObjectOrientation(h,h,{iori[1],iori[2]+ori_increment,iori[3]})  --for the case of increasing beta
When i run the simulation, the arm just rotate randomly and continuously and not stable.
However, it works when rotate with respect to the world frame, in such a case the second argument is -1

Any help is much appreciated!
Yours sincerely,
juekun

coppelia