Close

Servo Stepped Movements, plus a new Video

A project log for Stubby the (Teaching) Hexapod

100% open source robot platform with accessability and affordability in mind: teaching children of all ages about robots & programming

the-big-oneThe Big One 04/25/2014 at 02:490 Comments

As promised yesterday, this evening we made some changes to the servo software which allow stepped movements.  This means, for instance, that if you want to move a servo from -45 degrees to +90 degrees, you can specify a duration over which that move will occur, and the move will be done smoothly over the specified duration.  Prior to this change, the move would be done at the maximum speed, which results in jerky movements.  This change is especially noticeable when Stubby is moving slowly.

While this behaviour is likely very common for standalone servo controllers, keep in mind that Stubby uses a single AVR chip, running at 10MHz (it will be 12MHz when the PCBs arrive), to do all motion calculations (lots of floating point / radian math), serial communication from / to the Universal Controller, as well as PWM waveform generation.

An example of how to use the new capabilities is included below:

while (1){
	leg_set_desired_position_relative(leg_index, 0, 1.5, -1.5, 1000);
	leg_delay_ms(1000);
	leg_set_desired_position_relative(leg_index, 0, 0, 1.5, 1000);
	leg_delay_ms(1000);
}

This would move the coxa between 1.5 radians and 0 radians repeatedly, with a period of 1000 milliseconds, while simultaneously moving the tibia joint between -1.5 radians and 1.5 radians.

Princess Sparkle has graciously volunteered to demonstrate the practical applications of the new features, in this latest video.

Discussions