Page 1 of 1

How can I input sequence of Pose into Coppelisasim just to display animation?

Posted: 04 Apr 2024, 16:00
by linzijie876
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?

Re: How can I input sequence of Pose into Coppelisasim just to display animation?

Posted: 05 Apr 2024, 10:30
by fferri
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

Re: How can I input sequence of Pose into Coppelisasim just to display animation?

Posted: 05 Apr 2024, 13:16
by linzijie876
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?

Posted: 08 Apr 2024, 08:01
by fferri
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