Sign in to follow this  

Implementing stepper motor physics and joint constraints

Recommended Posts

I am trying to move a robot arm whose desired angles for each segment have been solved for with inverse kinematics.  The robot arm is in my physics engine and each segment is connected with a joint constraint; these constraints are solved using sequential impulses.

 

The effect I am trying to achieve is to have a robot arm that can swing at the player, but the player can shoot it to knock its movement back before it hits them.

 

I would like to be able to move the robot arm using something similar to a stepper motor where each frame each segment will rotate a certain number of steps until the computed target is reached.  The issue I am having is with combining this movement with the constraint system.  I am easily able to apply the force to each segment to move it a certain amount (I do this by applying the exact torque and force to each segment to make it accelerate it in global coordinate system to so that by the next frame, the angle between each segment will have changed appropriately), but I am unsure how to stop the segment at the end of its step.  Floating point rounding errors appear to especially be an issue.  I tried applying an opposite force and torque to each segment the next frame but it wasn't precise enough and caused the system to be unstable. It becomes even worse when trying to account for melding the motor force with the force applied to the segments from the constraint resolution.

 

Does anyone know how to solve this?

Edited by Vexal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this