libwallaby  v24
The wallaby standard library
motors.h
Go to the documentation of this file.
1 /*
2  * motors.h
3  *
4  * Created on: Nov 6, 2015
5  * Author: Joshua Southerland
6  */
7 
8 #ifndef INCLUDE_WALLABY_MOTORS_H_
9 #define INCLUDE_WALLABY_MOTORS_H_
10 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
29 
36 int gmpc(int motor);
37 
38 
46 
47 
54 void cmpc(int motor);
55 
56 
57 
66 int move_at_velocity(int motor, int velocity);
67 
75 int mav(int motor, int velocity);
76 
77 
88 int move_to_position(int motor, int speed, int goal_pos);
89 
90 
99 int mtp(int motor, int speed, int goal_pos);
100 
109 int move_relative_position(int motor, int speed, int delta_pos);
110 
119 int mrp(int motor, int speed, int delta_pos);
120 
132 void set_pid_gains(int motor, short p, short i, short d, short pd, short id, short dd);
133 
134 
146 void get_pid_gains(int motor, short * p, short * i, short * d, short * pd, short * id, short * dd);
147 
153 int freeze(int motor);
154 
161 int get_motor_done(int motor);
162 
169 void block_motor_done(int motor);
170 
177 void bmd(int motor);
178 
185 int setpwm(int motor, int pwm);
186 
192 int getpwm(int motor);
193 
194 
200 void fd(int motor);
201 
202 
208 void bk(int motor);
209 
210 
219 void motor(int motor, int percent);
220 
229 void motor_power(int motor, int percent);
230 
231 
237 void off(int motor);
238 
244 void alloff();
245 
251 void ao();
252 
253 #ifdef __cplusplus
254 }
255 #endif
256 
257 
258 #endif /* INCLUDE_WALLABY_MOTORS_H_ */
move_at_velocity
int move_at_velocity(int motor, int velocity)
Set a goal velocity in ticks per second. \detailed The range is -1500 to 1500, though motor position ...
get_motor_position_counter
int get_motor_position_counter(int motor)
Gets the current motor position.
getpwm
int getpwm(int motor)
Get the current motor pwm command.
set_pid_gains
void set_pid_gains(int motor, short p, short i, short d, short pd, short id, short dd)
Set the motor PID gains, represented as fractions.
clear_motor_position_counter
void clear_motor_position_counter(int motor)
Clears the motor position counter.
setpwm
int setpwm(int motor, int pwm)
Set the motor pwm (percent power) command.
block_motor_done
void block_motor_done(int motor)
Wait until the motor is at it's goal.
fd
void fd(int motor)
Moves the given motor forward at full power.
freeze
int freeze(int motor)
Active braking to stop a motor.
ao
void ao()
Turns all motors off.
off
void off(int motor)
Turns the specified motor off.
mrp
int mrp(int motor, int speed, int delta_pos)
Set a goal position (in ticks) for the motor to move to, relative to the current position.
get_motor_done
int get_motor_done(int motor)
Check if the motor has reached it's goal.
bk
void bk(int motor)
Moves the given motor backward at full power.
move_relative_position
int move_relative_position(int motor, int speed, int delta_pos)
Set a goal position (in ticks) for the motor to move to, relative to the current position.
mtp
int mtp(int motor, int speed, int goal_pos)
Set a goal position (in ticks) for the motor to move to.
alloff
void alloff()
Turns all motors off.
motor_power
void motor_power(int motor, int percent)
Moves a motor at a percent power.
motor
void motor(int motor, int percent)
Moves a motor at a percent velocity.
gmpc
int gmpc(int motor)
Gets the current motor position.
cmpc
void cmpc(int motor)
Clears the motor position counter.
move_to_position
int move_to_position(int motor, int speed, int goal_pos)
Set a goal position (in ticks) for the motor to move to. \detailed There are approximately 1500 ticks...
get_pid_gains
void get_pid_gains(int motor, short *p, short *i, short *d, short *pd, short *id, short *dd)
Set the motor PID gains, represented as fractions.
mav
int mav(int motor, int velocity)
Set a goal velocity in ticks per second.
bmd
void bmd(int motor)
Wait until the motor is at it's goal.