0
Answered

Real Time IK Mode

VIZtech4 1 year ago in realvirtual.io Starter and Professional updated 1 year ago 6

Hello,

Robot arm.

I need to move the robot TCP object using a joystick and have the robot follow, as it does in 'add target edit mode'.

This has to work not in edit mode but in Unity run mode. I have no problem moving the TCP object, the problem is having the robot follow it in real time.

Can you please advise how this can be done ?

When I said move the TCP I really meant the target object which will be set at TCP

It looks something like we have to fill Axis[] with the IK calculated positions then call, "drive.StartEditorMoveMode()" for each drive. OR maybe DriveToTarget()

There must be a "nice" way to put this into my own script for use in Unity run time.

This would be a good feature for realvirtual because it would allow users to create a robot simulator where x,y,z,A,B,C world coordinate system could be controlled with joysticks. I'm thinking of a KUKA robot arm here.

Answered

Hi, good idea. Currently all movements are controlled by the methods in IKPath, you can use these as a template for your own motion control. In difference to the Editor move mode you must somehow interpolate between the positions so that the speeds of the axis are not "jumping".In IKPath there is a public method "DriveToTarget" which is Starting the robot to drive to a target. Currently it is always done after last target is reached and maybe it does not works if you just start it at any time but in IKPath you should everything you need to know to control it from your side. There is also a difference if you move PTP (here only the drives are started to a destination position with the needed time of the slowest axis) or Linear (here the interpolation is done by IKPath in the Method PositionOnLinearPath).

Frohe Weihnachten und ein gutes neues Jahr.

Thank you for your guidance, I shall have a better look at IKPath.

I think I'm getting somehwere with this now.

My algorithm is this;

1. Move the joystick to translate a target object

2. At regular timed intervals get the position and add it to an IKPath as an IKTarget

3. When the number ot targets > x (x being an arbitrary number) create a loop,

foreach(IKTarget target in path) DriveToTarget(target)

This is the best algorithm I have used so far however the only interpolation method that works with it is,

"IKTarget.Interploation.PointToPointUnsynced", the other two give erratic movement.


Can you suggest a better algorithm ?

Hard to say from my side,  there is to much individual code involved on your side.

I have this working very smoothly now.

1. move a TargetGameobject around using a joystick

2. make an IKTarget from that gameobject

3. use method "JumpToTarget()" using the IKTarget in step 2.

Note: I had to make JumpToTarget() public rather than private.