PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Functions
servodiffdrive.h File Reference

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"
#include "servo.h"
+ Include dependency graph for servodiffdrive.h:
+ This graph shows which files directly or indirectly include this file:

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. More...
 
void drive_speeds (int left, int right)
 Set the servo drive speeds. More...
 
void drive_setramp (int left, int right)
 Set the maximum ramp step size. More...
 
void drive_sleep ()
 Stops the drive wheel servo signals without stopping the processor that controls them. More...
 
void drive_stop ()
 Stops the processor that controls all servos in the application.
More...
 

Detailed Description

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.

Author
Andy Lindsay
Version
0.85

@detail 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.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m.

Definition in file servodiffdrive.h.

Function Documentation

◆ drive_pins()

void drive_pins ( int  left,
int  right 
)

Set up left and right wheel servo pin connections.

@detail Call this function once to tell the library which pins the left and right continuous rotation drive servos are connected to.

Parameters
leftLeft servo pin
rightRight servo pin

Definition at line 6 of file servodiffdrive.c.

◆ drive_setramp()

void drive_setramp ( int  left,
int  right 
)

Set the maximum ramp step size.

@detail 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.

Parameters
leftLeft sevo maximum ramp step
rightRight servo maximum ramp step

Definition at line 18 of file servodiffdrive.c.

+ Here is the call graph for this function:

◆ drive_sleep()

void drive_sleep ( )

Stops the drive wheel servo signals without stopping the processor that controls them.

@detail 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.

Parameters
leftLeft sevo maximum ramp step
rightRight servo maximum ramp step

Definition at line 24 of file servodiffdrive.c.

+ Here is the call graph for this function:

◆ drive_speeds()

void drive_speeds ( int  left,
int  right 
)

Set the servo drive speeds.

@detail 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.

Parameters
leftLeft srvo speed
rightRight servo speed

Definition at line 12 of file servodiffdrive.c.

+ Here is the call graph for this function:

◆ drive_stop()

void drive_stop ( )

Stops the processor that controls all servos in the application.

@detail 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.

Parameters
leftLeft sevo maximum ramp step
rightRight servo maximum ramp step

Definition at line 30 of file servodiffdrive.c.

+ Here is the call graph for this function: