show object's trajectory
show object's trajectory
There is a force sensor at the end of my robotic arm. With the movement of the robotic arm, the force sensor also moves. I want to display the movement trajectory of the force sensor in the scene. I read many tutorials and said that Graph can be set, but I found that That method should only be used in lower versions, I am using the latest version 4.3.0 now, and there are no similar settings that can be set in the GUI. How should I solve my problem in the latest version?
Re: show object's trajectory
Hello,
a simple way to display a trace of the object, is to add a child script to the object with following content:
Cheers
a simple way to display a trace of the object, is to add a child script to the object with following content:
Code: Select all
function sysCall_init()
h=sim.getObject('.')
dr=sim.addDrawingObject(sim.drawing_lines|sim.drawing_cyclic,2,0,-1,300,{1,0,1})
pt=sim.getObjectPosition(h,sim.handle_world)
end
function sysCall_sensing()
local l={pt[1],pt[2],pt[3]}
pt=sim.getObjectPosition(h,sim.handle_world)
l[4]=pt[1]
l[5]=pt[2]
l[6]=pt[3]
sim.addDrawingObjectItem(dr,l)
end
Re: show object's trajectory
It works.Thanks!coppelia wrote: ↑20 May 2022, 14:22 Hello,
a simple way to display a trace of the object, is to add a child script to the object with following content:
CheersCode: Select all
function sysCall_init() h=sim.getObject('.') dr=sim.addDrawingObject(sim.drawing_lines|sim.drawing_cyclic,2,0,-1,300,{1,0,1}) pt=sim.getObjectPosition(h,sim.handle_world) end function sysCall_sensing() local l={pt[1],pt[2],pt[3]} pt=sim.getObjectPosition(h,sim.handle_world) l[4]=pt[1] l[5]=pt[2] l[6]=pt[3] sim.addDrawingObjectItem(dr,l) end