Problem with force sensors on mico hand

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

Problem with force sensors on mico hand

Post by ljklonepiece » 06 Mar 2014, 11:57

Hi Developers,

I want to create a flying hand with touch sensor enabled.
However, I encountered some problem to make the touch sensor work.
Specifically, I am trying to obtain the readings from force sensor on the finger of mico arm when it touches something.
i use

Code: Select all

r,force,torque=simReadForceSensor(force_sen_tip_right)
to get the reading

However the 'r' value is always 1 which means the sensor is broken according to the documentation.
but when i am trying to access the value in force vector, say print(force[1]), it reports errors as:

Code: Select all

Lua runtime error: [string "SCRIPT Control_hand"]:39: attempt to index global 'force' (a nil value)
and now 'r' has the value 0

I have attached scene file for reference, I want to hand to stop when it touches the table.
https://drive.google.com/file/d/0B3-BbM ... sp=sharing

Any help and suggestions are much appreciated!

Yours sincerely,
Juekun

coppelia
Site Admin
Posts: 7689
Joined: 14 Dec 2012, 00:25

Re: Problem with force sensors on mico hand

Post by coppelia » 06 Mar 2014, 13:12

Hello Juekun,

you are mixing up bit 0 and bit 1 (I agree this can be a little bit confusing):
  • bit0 --> 1
  • bit1 --> 2
  • bit2 --> 4
  • bit3 --> 8
  • etc.
so you could have your code like that:

Code: Select all

r,force,torque=simReadForceSensor(forceSensorHandle)
if (simBoolAnd16(r,1)~=0) then
	-- ok, the force/torque data is available
	print('Force: '..force[1],force[2],force[3])
	print('Torque: '..torque[1],torque[2],torque[3])
	if (simBoolAnd16(r,2)~=0) then
		-- The force sensor is broken
		print('Force/torque sensor is broken')
	end
end
Cheers

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

Re: Problem with force sensors on mico hand

Post by ljklonepiece » 07 Mar 2014, 03:15

Hi Marc,

Thanks a lot for your detailed explanations! It works!

Another question regarding the tactile sensor are :
1. what is the effective sensing volume of the each force sensor? is it the white bounding box shown when such sensor is selected?

2. I notice that even there is no contact with the force sensor, the force sensor still reports some small value which i suppose it should be 0 in case of no contact:
eg.

Code: Select all

right_tip: -0.0041960747912526, -0.28841668367386, -0.36253958940506
left_tip: 0.0028423713520169, -0.27158948779106, -0.41862398386002
right_mid: -0.0028867477085441, -0.41841167211533, -0.2413445264101
left_mid: 0.0042679626494646, -0.41926923394203, -0.2585569024086
these are the four sensor readings i got from mico hand when no contact with object is observed.
when contact is observed, some value becomes larger than 1, thus, can i say that the value 1 is the threshold separating no contact and contact state?

Thanks a lot in advance!

Yours sincerely,
Juekun

coppelia
Site Admin
Posts: 7689
Joined: 14 Dec 2012, 00:25

Re: Problem with force sensors on mico hand

Post by coppelia » 07 Mar 2014, 11:45

there is no sensing volume for a force/torque sensor. A force/torque sensor will simply register the forces/torques applied to it via attached bodies. In your case:

finger segment --> force sensor --> finger pad

the object finger pad has a mass, and acts on the force sensor also when the pad is not touching anything (that's why you have non-zero forces/masses when the finger is idle, because gravity is pulling the pad down). When the pad collides with an object (e.g. an object to grasp), then the pad will push (or transmitt the force to) the force sensor.

Cheers

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

Re: Problem with force sensors on mico hand

Post by ljklonepiece » 08 Mar 2014, 02:20

Dear Marc,

I see~~Thanks a lot for your help!!!

Yours sincerely,
Juekun

Post Reply