Page 4 of 4

Re: Inquiry for follow-path code

Posted: 05 May 2022, 10:19
by Luis Nieto
Predefined Movement Sequence?

Does this essentially mean that every joint on the legs has a path and is enabled with Inverse-Kinematics in order to assure that the robot model has the best balance everytime? Or is it using more of position control?

Thanks

Re: Inquiry for follow-path code

Posted: 06 May 2022, 06:50
by coppelia
The relative foot motion is defined for each foot, i.e. each foot has a list of pos-time pairs. Then, ik is applied to compute for a given pair the corresponding joint angles. Those joint angles are then applied to the leg joints, which all operate in position control mode.

Cheers

Re: Inquiry for follow-path code

Posted: 08 May 2022, 07:50
by Luis Nieto
What would be an example of a position-time pair? This is a term that relatively new for me.

Thanks.

Re: Inquiry for follow-path code

Posted: 09 May 2022, 13:04
by coppelia
That's entirely up to you, e.g.:

t=0.00 , p={0,0,0}
t=0.05, p={0,0,0.1}
t=0.10, p={0,0,0.2}
etc.

and you can keep that in code like:

Code: Select all

positions={{0,0,0},{0,0,0.1},{0,0,0.2}}
times={0,0.05,0.1}

or

data={{0,{0,0,0}},{0.05,{0,0,0.1}},{0.1,{0,0,0.2}}}

or

...
Cheers

Re: Inquiry for follow-path code

Posted: 19 May 2022, 15:13
by Luis Nieto
Is there a sensor or any way on Coppeliasim to detect how tilted a shape is? - A way to read what its orientation with respect to an axis in the world is or something and then a way to print the angle in order to use it in code?

Thank you in advanced...

Re: Inquiry for follow-path code

Posted: 20 May 2022, 14:20
by coppelia
Yes, you can use e.g. sim.getObjectOrientation or sim.getObjectMatrix

sim.getObjectOrientation returns Euler angles of the reference frame of the object, relative to the world (if the second argument is -1 or sim.handle_world), or relative to another reference frame.

sim.getObjectMatrix can also be used, knowing that:

Code: Select all

local m=sim.getObjectMatrix(objectHandle,-1)
unitAxisX={m[1],m[5],m[9]}
unitAxisY={m[2],m[6],m[10]}
unitAxisZ={m[3],m[7],m[11]}
With above vectors, you can do many types of calculations, also orientation-related.

Cheers

Re: Inquiry for follow-path code

Posted: 23 May 2022, 14:30
by Luis Nieto
May I know what are the values that sim.getObjectOrientation returns please? And what they mean?

Thanks in advance.

Re: Inquiry for follow-path code

Posted: 23 May 2022, 15:21
by coppelia
Those are Euler angles

Cheers

Re: Inquiry for follow-path code

Posted: 24 May 2022, 14:34
by Luis Nieto
Would there be a way to execute sim.getObjectOrientation repeatedly during a simulation - like obtaining the alpha, beta and gamma of an selected object every instant or every so often during?

Thanks in advance for the advice.

Re: Inquiry for follow-path code

Posted: 25 May 2022, 07:58
by coppelia

Code: Select all

function sysCall_init()
    objectHandle=sim.getObject('.')
end

function sysCall_sensing()
    print(sim.getObjectOrientation(objectHandle,-1))
end
Cheers