Page 1 of 1

Inscription on the object

Posted: 31 Jan 2023, 09:29
by songi
Hello. I would like to create a simple program in which a robotic arm will
write some inscription on an object. It can even be straight line and circle. Could you please tell me how to do it
in the simplest way? I have free version program Coppelia. This free version is called "player"
Thanks

Re: Inscription on the object

Posted: 31 Jan 2023, 17:49
by coppelia
Hello,

you will need the EDU version at least. Then you can use the pen model for instance: Models/components/modifiers/felt pen.ttm
If the tip of the pen touches a surface during simulation, it will draw a point/line a that location.

Cheers

Re: Inscription on the object

Posted: 01 Feb 2023, 17:31
by songi
Hello
I attach feltPen on the robot. Can you explain to me what should I do to make my robot move? Do you have scripting instructions? I add photo what I have this right now.
Photo:
https://iv.pl/image/GZGGtTS

I'd like write something on this cuboid. Could you help me?

Re: Inscription on the object

Posted: 02 Feb 2023, 10:44
by fferri
Hi,

the pen should be child of the 'connection' object.

To make the robot move you would move the IK target (the 'target' object, or the green sphere that contains it) e.g. via sim.setObjectPosition

Re: Inscription on the object

Posted: 03 Feb 2023, 21:23
by songi
I did it. Is it correct now? Can you tell me where I should write code? Where I marked green or blue?
https://iv.pl/image/GZGOSad

Re: Inscription on the object

Posted: 06 Feb 2023, 13:20
by fferri
You can achieve a linear motion of the target from poseA to poseB with:

Code: Select all

function sysCall_init()
    ...
    target=sim.getObject('/IRB140/target')
    maxVel=0.1
    maxAccel=0.05
    maxJerk=0.01
    -- call sim.moveToPose() in a coroutine to be resumed periodically:
    corout=coroutine.create(function()
        local function moveTarget(currentPose,currentVel,currentAccel)
            sim.setObjectPose(target,-1,currentPose)
        end
        sim.moveToPose(-1,poseA,{maxVel},{maxAccel},{maxJerk},poseB,moveTarget,nil,{1,1,1,1})
    end
end

function sysCall_actuation()
    if coroutine.status(corout)~='dead' then
        local ok,errorMsg=coroutine.resume(corout)
        if errorMsg then
            error(debug.traceback(corout,errorMsg),2)
        end
    end
    ...
end
you can put the code in an embedded script of any object, adjusting for how the target object is retrieved (target=sim.getObject(...)); the absolute path I used works from anywhere, but for instance if the script is attached to the 'target' object itself, the you could just say target=sim.getObject('.')

Re: Inscription on the object

Posted: 07 Feb 2023, 22:24
by songi
If I did something like this, what do I need to do to make the pen move with the robot? How to connect the pen with the robot?
https://ibb.co/q5NvF6x

Re: Inscription on the object

Posted: 08 Feb 2023, 08:55
by coppelia
You can attach/detach the pen to/from another object via sim.setObjectParent

Cheers

Re: Inscription on the object

Posted: 13 Feb 2023, 17:14
by songi
Hi
I don't have the "Segment Path" function in my program. In the "Path" tab, I only have "Open" and "Closed". My program version is 4.4.0. When I open a ready-made program and want to modify "Path", I have something like the attached image. How can I fix it?

https://ibb.co/Qj8MW0r

Re: Inscription on the object

Posted: 15 Feb 2023, 07:00
by coppelia
That is a deprecated path object. From that, you can create an equivalent path object, that is not deprecated (click Create similar object).

If you are opening an old scene, that uses a deprecated path object, then youcan still modify it: select the object, then with ctrl-click, select a path control point, and move it in the same way you would move another object.

Cheers