## Inscription on the object

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

### Inscription on the object

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
Posts: 9762
Joined: 14 Dec 2012, 00:25

### Re: Inscription on the object

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

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: 999
Joined: 09 Sep 2013, 19:28

### Re: Inscription on the object

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

I did it. Is it correct now? Can you tell me where I should write code? Where I marked green or blue?

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

### Re: Inscription on the object

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()
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

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
Posts: 9762
Joined: 14 Dec 2012, 00:25

### Re: Inscription on the object

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

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