## get force/torque sensor values

Typically: "How do I... ", "How can I... " questions
jean taylor
Posts: 3
Joined: 16 Dec 2018, 00:24

### get force/torque sensor values

Hi,
I want to display the f/torque sensor value in the status bar message.

Code: Select all

force={-1,-1,-1}
torque={-1,-1,-1}
HEX_Force_sensor = sim.getObjectHandle('HEX_Force_sensor')
Cube = sim.getObjectHandle('Cube')
--the cube must be non-static shape
sim.setObjectInt32Parameter(Cube,3003,0)
while true do
sim.wait (1)
if res== -1 then
elseif res == 1 then
else
sim.addStatusbarMessage('Fx = '..force[1]..'  Fy = '..force[2].. '  Fz = '..force[3]..' Tx = '..torque[1]..' Ty = '..torque[2]..' Tz = '..torque[3])
end
end
However, when I run the program, I always get the result value "res" = 1 which means that the sensor is broken ( the breaking settings is not selected)
I verified the conditions mentioned here http://www.coppeliarobotics.com/helpFil ... ations.htm , and I even tried the second solution ( Dummy-dummy link) but res still = 1
Any help would be appreciated.

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

### Re: get force/torque sensor values

Hello,

you didn't correctly read the documentation. It sais:

bit 0 set (1): force and torque data is available, otherwise it is not (yet) available (e.g. when not enough values are present for the filter)

if Bit 0 is set, this is 1.

Cheers

jean taylor
Posts: 3
Joined: 16 Dec 2018, 00:24

### Re: get force/torque sensor values

My mistake, you are right.
Thank you so much coppelia
Have a nice day :)