libkovan  1
The kovan standard library
Motor Class Reference

A motor object that is associated with a physical motor port. More...

#include <motors.hpp>

Public Member Functions

 Motor (const port_t &port) throw ()
 
void clearPositionCounter ()
 
void moveAtVelocity (const short &velocity)
 
void moveToPosition (const short &speed, const int &goalPos)
 
void moveRelativePosition (const short &speed, const int &deltaPos)
 
void setPidGains (const short &p, const short &i, const short &d, const short &pd, const short &id, const short &dd)
 
void pidGains (short &p, short &i, short &d, short &pd, short &id, short &dd) const
 
void freeze ()
 
bool isMotorDone () const
 
void blockMotorDone () const
 
void forward ()
 
void backward ()
 
void motor (int percent)
 
void off ()
 
const port_tport () const
 

Detailed Description

A motor object that is associated with a physical motor port.

Allows both PWM and PID control of a motor.

Constructor & Destructor Documentation

Motor::Motor ( const port_t port)
throw (
)

Creates a new motor object associated with a given physical port.

Parameters
portthe port this motor will communicate with.

Member Function Documentation

void Motor::backward ( )

Move the motor backward at full speed using PWM control.

See also
forward
motor
void Motor::blockMotorDone ( ) const

Waits until the motor has reached its target position.

See also
getMotorDone
This function blocks until the motor has reached its target position.
void Motor::clearPositionCounter ( )
void Motor::forward ( )

Move the motor forward at full speed using PWM control.

See also
backward
motor
void Motor::freeze ( )
bool Motor::isMotorDone ( ) const
Returns
true if the motor has reached its target position, false otherwise
See also
blockMotorDone
void Motor::motor ( int  percent)

Move the motor at a given percentage of power using PWM control.

Parameters
percentThe speed to move the motor at, in percentage. Should be between -100% and 100%
void Motor::moveAtVelocity ( const short &  velocity)
void Motor::moveRelativePosition ( const short &  speed,
const int &  deltaPos 
)
void Motor::moveToPosition ( const short &  speed,
const int &  goalPos 
)
void Motor::off ( )

Turns the motor off.

void Motor::pidGains ( short &  p,
short &  i,
short &  d,
short &  pd,
short &  id,
short &  dd 
) const
const port_t& Motor::port ( ) const

The pyhsical port this motor is associated with.

Returns
the port's address.
void Motor::setPidGains ( const short &  p,
const short &  i,
const short &  d,
const short &  pd,
const short &  id,
const short &  dd 
)

The documentation for this class was generated from the following file: