I am working with an ePuck, the task is:

When the conditions about the components of ImageTable_rgb (as you can see in the code below) are true, the ePuck has to be rotated of 90 degrees. To do that I am using the following code:

Code: Select all

```
ImageTable_rgb=simGetVisionSensorImage(handleVision,0,0,0)
Orientation = simGetObjectOrientation(ePuck,-1)
if (ImageTable_rgb [1]>0.5) and (ImageTable_rgb [2] < 0.2) and (ImageTable_rgb [3] < 0.2)then
while (Orientation[1] <= Orientation[1] + 1.57) or (Orientation[1] >= Orientation[1] - 1.57) do
simSetJointTargetVelocity(leftMotor,-math.pi*0.5)
simSetJointTargetVelocity(rightMotor,math.pi*0.5)
Orientation = simGetObjectOrientation(ePuck,-1)
simWait(0.5)
end
end
```

I am not sure about the following things:

1) I need to know which is the component of the vector Orientation (Euler Angle) refeared to absolute Z axes rotation.

2)I am not sure about the values retrieved by the function simGetObjectOrientation, are they in radians? Because I am considering the while condition in radians but seems to be far to my target.

Any suggestions?

Many thanks

Davide