Differential Servo Drive Library
v0.8
Differential servo drive control for educational and hobby applications
|
Adds a layer over servo library for use with a differential servo drive robot. You have to add the simpletools and servo libraries to your project (with the Add Simple Libraries button) for this to work. More...
#include "simpletools.h"
Go to the source code of this file.
Functions | |
void | drive_pins (int left, int right) |
Set up left and right wheel servo pin connections. | |
void | drive_speeds (int left, int right) |
Set the servo drive speeds. | |
void | drive_setramp (int left, int right) |
Set the maximum ramp step size. | |
void | drive_sleep () |
Stops the drive wheel servo signals without stopping the processor that controls them. | |
void | drive_stop () |
Stops the processor that controls all servos in the application. |
Adds a layer over servo library for use with a differential servo drive robot. You have to add the simpletools and servo libraries to your project (with the Add Simple Libraries button) for this to work.
Functions that control servo speeds and directions automatically reverse servo speed on the right side to make intuitive functions that involve positive values for forward and negative ones for backward. speed control calls typically set up once with drivePins(left, right). After that driveSpeeds(speedLeft, speedRight) control servo speed and direction. Example: driveSpeed(200, 200) is full speed forward. Likewise, driveSpeed(-200, -200) is full speed reverse.
Please submit bug reports, suggestions, and improvements to this code to edito. r@pa ralla x.co m
void drive_pins | ( | int | left, |
int | right | ||
) |
Set up left and right wheel servo pin connections.
Call this function once to tell the library which pins the left and right continuous rotation drive servos are connected to.
left | Left servo pin |
right | Right servo pin |
void drive_setramp | ( | int | left, |
int | right | ||
) |
Set the maximum ramp step size.
Call this function if you want a large change in speed to be reached incrementally for a ramping effect. Default is 2000 (no ramping whatsoever). values in the 4 to 10 range tend to have a visible effect. 4 is a little sluggish but works well for gradual speed changes that are useful in hill climbing applications.
left | Left sevo maximum ramp step |
right | Right servo maximum ramp step |
void drive_sleep | ( | ) |
Stops the drive wheel servo signals without stopping the processor that controls them.
This function is useful for stopping the control signals to the drive wheel servos without stopping signals to the rest of the servos. You can call driveSpeeds to wake the servos back up. This can save some power if your application needs to operate other servos while giving the continuous rotation drive servos a rest.
left | Left sevo maximum ramp step |
right | Right servo maximum ramp step |
void drive_speeds | ( | int | left, |
int | right | ||
) |
Set the servo drive speeds.
Speeds range from 100 for full speed forward to -100 for full speed reverse. To ensure that both servos are turning at full speeds, 200 is typically used for forward and -200 for backward. Then, linear speed control happens in the -100...0...100 range.
left | Left srvo speed |
right | Right servo speed |
void drive_stop | ( | ) |
Stops the processor that controls all servos in the application.
This function takes all servos in the application out of commission, and all settings will be lost. Use at the end of the program for maximum power savings.
left | Left sevo maximum ramp step |
right | Right servo maximum ramp step |