I simulate a complex mathematical model in MATLAB to get a sequence of Pose(Frame Transformation Matrix) of a complex Robot.
In order to clearly display my results, I want to input this sequence of Transformation Matrix into Coppeliasim for animation.
So, the Robot can move in the coppeliasim.
Just for animation in Coppeliasim, Not for ODE simulation.
How can I easily solve this issue?
How can I input sequence of Pose into Coppelisasim just to display animation?
-
- Posts: 8
- Joined: 06 Apr 2023, 10:05
Re: How can I input sequence of Pose into Coppelisasim just to display animation?
Make sure the object to animate is static, then apply the poses sequentially with sim.setObjectPose, e.g.:
Code: Select all
function sysCall_init()
handle = sim.getObject '.'
poses = { {0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1}, ... }
end
function sysCall_actuation()
index = (index or 0) + 1
if index <= #poses then
sim.setObjectPose(handle, poses[index])
end
end
-
- Posts: 8
- Joined: 06 Apr 2023, 10:05
Re: How can I input sequence of Pose into Coppelisasim just to display animation?
fferri wrote: ↑05 Apr 2024, 10:30 Make sure the object to animate is static, then apply the poses sequentially with sim.setObjectPose, e.g.:
Code: Select all
function sysCall_init() handle = sim.getObject '.' poses = { {0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1}, ... } end function sysCall_actuation() index = (index or 0) + 1 if index <= #poses then sim.setObjectPose(handle, poses[index]) end end
Can this script of codes be a input file?
e.g. A .txt file to record these codes?
Re: How can I input sequence of Pose into Coppelisasim just to display animation?
Yes, you can use e.g. a text or csv file...
Code: Select all
poses = {}
for line in io.lines('poses.csv') do
local pose = map(tonumber, string.split(line, ','))
table.insert(poses, pose)
end