lib/motor_group.h File Reference

A grouping of motors as single unit. More...

#include <kern/global.h>


Defines

#define motor_group_has(group, motor)   ((group)&(1<<(motor)))
 Check if a group contains a motor.

Typedefs

typedef uint8_t MotorGroup
 MotorGroup.

Functions

MotorGroup motor_group_new (bool m0, bool m1, bool m2, bool m3, bool m4, bool m5)
void motor_group_set_vel (MotorGroup group, int16_t vel)
void motor_group_brake (MotorGroup group)

Detailed Description

A motor group is a collection of motors that act as a single unit. This is useful in the situation where many motors are connected to single output shaft. A motor group allows these motors to be treated as a single entity.

Function Documentation

void motor_group_brake ( MotorGroup  group  ) 

Brake each motor in a group

Parameters:
group group specifying which motors to brake

MotorGroup motor_group_new ( bool  m0,
bool  m1,
bool  m2,
bool  m3,
bool  m4,
bool  m5 
)

Create a new motor group and specify which motors are in the group. For example, a group with motors 1,2 and 3:

 MotorGroup m123 = motor_group_new(0,1,1,1,0,0);

void motor_group_set_vel ( MotorGroup  group,
int16_t  vel 
)

Set the velocity of each motor in the group

Parameters:
group group specifying which motors to set
vel motor velocity