Hello,
I am trying to use urdf-loader (which uses three.js to load robots from a URDF file) and animate robot movements.
I can’t figure out how to get forward kinematics to work here. I want to move from a joint configuration A to configuration B and then to config C. Could someone please point me in the right direction?
This is my current test implementation but it just sets position abruptly there’s no movement. I need to generate a smooth motion trajectory that also accounts for self-collisions.
const animateRobot = async () => {
const position1 = [ 0.5, -0.5, 0.2 ];
const position2 = [ -0.5, 0.5, -0.2 ];
const position3 = [ 0, 0, 0 ];
const positions = [position1, position2, position3];
for (const position of positions) {
robot.joints['elbow'].setJointValue(position[0]);
robot.joints['shoulder'].setJointValue(position[1]);
robot.joints['wrist'].setJointValue(position[2]);
await new Promise((resolve) => setTimeout(resolve, 1000));
}
};