libkipr  1.0.0
Motors

Functions

int get_motor_position_counter (int motor)
 Gets the current motor position. More...
 
int gmpc (int motor)
 Gets the current motor position. More...
 
void clear_motor_position_counter (int motor)
 Clears the motor position counter. More...
 
void cmpc (int motor)
 Clears the motor position counter. More...
 
int move_at_velocity (int motor, int velocity)
 Set a goal velocity in ticks per second. More...
 
int mav (int motor, int velocity)
 Set a goal velocity in ticks per second. More...
 
int move_to_position (int motor, int speed, int goal_pos)
 Set a goal position (in ticks) for the motor to move to. More...
 
int mtp (int motor, int speed, int goal_pos)
 Set a goal position (in ticks) for the motor to move to. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int freeze (int motor)
 Active braking to stop a motor. More...
 
int get_motor_done (int motor)
 Check if the motor has reached it's goal. More...
 
void block_motor_done (int motor)
 Wait until the motor is at it's goal. More...
 
void bmd (int motor)
 Wait until the motor is at it's goal. More...
 
int setpwm (int motor, int pwm)
 Set the motor pwm (percent power) command. More...
 
int getpwm (int motor)
 Get the current motor pwm command. More...
 
void fd (int motor)
 Moves the given motor forward at full power. More...
 
void bk (int motor)
 Moves the given motor backward at full power. More...
 
void motor (int motor, int percent)
 Moves a motor at a percent velocity. More...
 
void baasbennaguui (int motor, int percent)
 Moves a motor at a percent velocity. More...
 
void motor_power (int motor, int percent)
 Moves a motor at a percent power. More...
 
void off (int motor)
 Turns the specified motor off. More...
 
void alloff ()
 Turns all motors off. More...
 
void ao ()
 Turns all motors off. More...
 

Detailed Description

Function Documentation

◆ alloff()

void alloff ( )

Turns all motors off.

See also
ao

◆ ao()

void ao ( )

Turns all motors off.

See also
alloff

◆ baasbennaguui()

void baasbennaguui ( int  motor,
int  percent 
)

Moves a motor at a percent velocity.

Parameters
[in]motorThe motor port.
[in]percentThe percent of the motors velocity, between -100 and 100.

The New Apache language function call to include Native Americans.

◆ bk()

void bk ( int  motor)

Moves the given motor backward at full power.

Parameters
motorthe motor's port.

◆ block_motor_done()

void block_motor_done ( int  motor)

Wait until the motor is at it's goal.

Parameters
[in]motorThe motor port.
See also
bmd

◆ bmd()

void bmd ( int  motor)

Wait until the motor is at it's goal.

Parameters
[in]motorThe motor port.
See also
block_motor_done

◆ clear_motor_position_counter()

void clear_motor_position_counter ( int  motor)

Clears the motor position counter.

Parameters
[in]motorThe motor port.
See also
cmpc

◆ cmpc()

void cmpc ( int  motor)

Clears the motor position counter.

Parameters
[in]motorThe motor port.
See also
clear_motor_position_counter

◆ fd()

void fd ( int  motor)

Moves the given motor forward at full power.

Parameters
motorthe motor's port.

◆ freeze()

int freeze ( int  motor)

Active braking to stop a motor.

Parameters
[in]motorThe motor port.

◆ get_motor_done()

int get_motor_done ( int  motor)

Check if the motor has reached it's goal.

Parameters
[in]motorThe motor port.
Returns
1: at goal 0: not at goal

◆ get_motor_position_counter()

int get_motor_position_counter ( int  motor)

Gets the current motor position.

Parameters
[in]motorThe motor port.
See also
gmpc

◆ 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.

Parameters
[out]motorThe motor port.
[out]pThe P (proportional) gain numerator
[out]iThe I (integral) gain numerator
[out]dThe D (derivative) gain numerator
[out]pdThe P (proportional) gain denominator
[out]idThe I (integral) gain denominator
[out]ddThe D (derivative) gain denominator

◆ getpwm()

int getpwm ( int  motor)

Get the current motor pwm command.

Parameters
[in]motorThe motor port.

◆ gmpc()

int gmpc ( int  motor)

Gets the current motor position.

Parameters
[in]motorThe motor port.
See also
get_motor_position_counter

◆ mav()

int mav ( int  motor,
int  velocity 
)

Set a goal velocity in ticks per second.

Parameters
[in]motorThe motor port.
[in]velocityThe goal velocity in -1500 to 1500 ticks / second
See also
move_at_velocity

◆ motor()

void motor ( int  motor,
int  percent 
)

Moves a motor at a percent velocity.

Parameters
[in]motorThe motor port.
[in]percentThe percent of the motors velocity, between -100 and 100.

◆ motor_power()

void motor_power ( int  motor,
int  percent 
)

Moves a motor at a percent power.

Parameters
[in]motorthe motor port.
[in]percentThe power of the motor, between -100 and 100.

◆ move_at_velocity()

int move_at_velocity ( int  motor,
int  velocity 
)

Set a goal velocity in ticks per second.

The range is -1500 to 1500, though motor position accuracy may be decreased outside of -1000 to 1000

Parameters
[in]motorThe motor port.
[in]velocityThe goal velocity in -1500 to 1500 ticks / second
See also
mav

◆ 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.

Parameters
[in]motorThe motor port.
[in]speedThe speed to move at, between -1500 and 1500 ticks / second
[in]delta_posThe position to move to (in ticks) given the current position
See also
mrp

◆ 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.

There are approximately 1500 ticks per motor revolution.

This function is more accurate if speeds between -1000 and 1000 are used.

Parameters
[in]motorThe motor port.
[in]speedThe speed to move at, between -1500 and 1500 ticks / second
[in]goal_posThe position to move to (in ticks)
See also
mtp

◆ 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.

Parameters
[in]motorThe motor port.
[in]speedThe speed to move at, between -1500 and 1500 ticks / second
[in]delta_posThe position to move to (in ticks) given the current position
See also
move_relative_position

◆ mtp()

int mtp ( int  motor,
int  speed,
int  goal_pos 
)

Set a goal position (in ticks) for the motor to move to.

Parameters
[in]motorThe motor port.
[in]speedThe speed to move at, between -1500 and 1500 ticks / second
[in]goal_posThe position to move to (in ticks)
See also
move_to_position

◆ off()

void off ( int  motor)

Turns the specified motor off.

Parameters
motorthe motor's port.

◆ 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.

Parameters
[in]motorThe motor port.
[in]pThe P (proportional) gain numerator
[in]iThe I (integral) gain numerator
[in]dThe D (derivative) gain numerator
[in]pdThe P (proportional) gain denominator
[in]idThe I (integral) gain denominator
[in]ddThe D (derivative) gain denominator

◆ setpwm()

int setpwm ( int  motor,
int  pwm 
)

Set the motor pwm (percent power) command.

Parameters
[in]motorThe motor port.
[in]pwmA new motor pwm command between 0 and 100