Is there a way to control servo position and speed at the same time? ex: you want to build a biped but you don't want the movements to be jerky.
thanks
Is there a way to control servo position and speed at the same time? ex: you want to build a biped but you don't want the movements to be jerky.
thanks
Increment or decrement the
Increment or decrement the servo value with a small delay between each iteration.
So instead of going from 0 to 90
you go from 0 to 1 to 2… 90 with small delays in between each. Use a for loop.
Ok thanks
Ok thanks
Looping movements
I’ve played with this a bit with multiple servo operated joints.
I found the best way to get smooth movement is to use nextmove assigned times.
This is just an example of what I’m talking about. (not actual code)
long NextMove;
int MoveDelay; ’ the number of milliseconds between each step, smaller steps = faster movement
int Step; ’ the amount the servo moves with each loop, keep this number small
int TargetPosition; ’ this controls where the joint is moving to, you just change the targetposition to make it move
loop(){
if millis() >= NextMove and JointPosition <> TargetPosition then MoveJoint;
}
MoveJoint() {
Int NewPosition = CurrentPosition + Step;
rem the next two lines make sure you don’t overshoot the target
If CurrentPosition < TargetPosition and NewPosition > TargetPosition then NewPosition = TargetPosition;
if CurrentPosition > TargetPosition and NewPosition < TargetPosition then NewPosition = TargetPosition;
Joint.move(NewPosition);
CurrentPosition = NewPosition;
NextMove = millis() + MoveDelay;
}
@Lasrin …This is a very
@Lasrin …This is a very useful when making cyborg because movement needs to be smooth which i struggled for some time. I ask wha0 library are you using here? Also is there a way to use ultrasound sensor where the robot moves the servo s to maintain a fized distance from a persons face as some sort of interactive behavior.