Inscription on the object

Typically: "How do I... ", "How can I... " questions
Post Reply
songi
Posts: 6
Joined: 30 Jan 2023, 23:22

Inscription on the object

Post 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

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Inscription on the object

Post 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

songi
Posts: 6
Joined: 30 Jan 2023, 23:22

Re: Inscription on the object

Post 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?

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: Inscription on the object

Post 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

songi
Posts: 6
Joined: 30 Jan 2023, 23:22

Re: Inscription on the object

Post 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

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: Inscription on the object

Post 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('.')

songi
Posts: 6
Joined: 30 Jan 2023, 23:22

Re: Inscription on the object

Post 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

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Inscription on the object

Post by coppelia »

You can attach/detach the pen to/from another object via sim.setObjectParent

Cheers

songi
Posts: 6
Joined: 30 Jan 2023, 23:22

Re: Inscription on the object

Post 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

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Inscription on the object

Post 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

Post Reply