Public Member Functions | Public Attributes | Private Attributes | List of all members
MotorDriver Class Reference

#include <MotorDriver.h>

Public Member Functions

void configure (uint8_t position, uint8_t motorID)
 
void goBackward ()
 
void goForward ()
 
void goLeft ()
 
void goRight ()
 
void init ()
 
 MotorDriver (PinName int1, PinName int2, PinName int3, PinName int4, PinName speedA, PinName speedB)
 
void rotate (uint8_t direction, uint8_t motor_position)
 
void rotateWithID (uint8_t direction, uint8_t motorID)
 
void setDirection (uint8_t direction, uint8_t motorID)
 
void setSpeed (uint8_t speed, uint8_t motorID)
 
void stop ()
 
void stop (uint8_t motorID)
 

Public Attributes

MotorStruct motorA
 
MotorStruct motorB
 

Private Attributes

DigitalOut _int1
 
DigitalOut _int2
 
DigitalOut _int3
 
DigitalOut _int4
 
SoftwarePWM _speedA
 
SoftwarePWM _speedB
 

Detailed Description

Motor Driver class. offer API to control the movement of motor

Definition at line 54 of file MotorDriver.h.

Constructor & Destructor Documentation

MotorDriver::MotorDriver ( PinName  int1,
PinName  int2,
PinName  int3,
PinName  int4,
PinName  speedA,
PinName  speedB 
)
inline

Create Motor Driver instance

Parameters
int1pin 1 of motor movement control
int2pin 2 of motor movement control
int3pin 3 of motor movement control
int4pin 4 of motor movement control
speedAspeed control of motorA
speedBspeed control of motorB

Definition at line 67 of file MotorDriver.h.

Member Function Documentation

void MotorDriver::configure ( uint8_t  position,
uint8_t  motorID 
)

config position of motor

Parameters
positionthe position set to motor,MOTOR_POSITION_LEFT or MOTOR_POSITION_RIGHT will be allowed
motorIDthe ID define which motor will be set, you can choose MOTORA or MOTORB

Definition at line 37 of file MotorDriver.cpp.

void MotorDriver::goBackward ( )

make motor go backward

Definition at line 87 of file MotorDriver.cpp.

void MotorDriver::goForward ( )

make motor go forward

Definition at line 82 of file MotorDriver.cpp.

void MotorDriver::goLeft ( )

make motor go left

Definition at line 92 of file MotorDriver.cpp.

void MotorDriver::goRight ( )

make motor go right

Definition at line 97 of file MotorDriver.cpp.

void MotorDriver::init ( )

set motor to initialized state

Definition at line 25 of file MotorDriver.cpp.

void MotorDriver::rotate ( uint8_t  direction,
uint8_t  motor_position 
)

rotate motor

Parameters
directionthe direction set to motor, MOTOR_CLOCKWISE or MOTOR_ANTICLOCKWISE will be allowed
motor_positionthe position set to motor,MOTOR_POSITION_LEFT or MOTOR_POSITION_RIGHT will be allowed

Definition at line 54 of file MotorDriver.cpp.

void MotorDriver::rotateWithID ( uint8_t  direction,
uint8_t  motorID 
)

rotate motorA or motorB

Parameters
directionthe direction set to motor, MOTOR_CLOCKWISE or MOTOR_ANTICLOCKWISE will be allowed
motorIDthe ID define which motor will be set, you can choose MOTORA or MOTORB

Definition at line 66 of file MotorDriver.cpp.

void MotorDriver::setDirection ( uint8_t  direction,
uint8_t  motorID 
)

set direction of motor,

Parameters
directionthe direction of motor, MOTOR_CLOCKWISE or MOTOR_ANTICLOCKWISE will be allowed
motorIDthe ID define which motor will be set, you can choose MOTORA or MOTORB

Definition at line 48 of file MotorDriver.cpp.

void MotorDriver::setSpeed ( uint8_t  speed,
uint8_t  motorID 
)

set speed of motor

Parameters
speedspeed value set to motor, [0,100] will be allowed
motorIDthe ID define which motor will be set, you can choose MOTORA or MOTORB

Definition at line 43 of file MotorDriver.cpp.

void MotorDriver::stop ( )

make motor stop

Definition at line 103 of file MotorDriver.cpp.

void MotorDriver::stop ( uint8_t  motorID)

make motorA or motorB stop

Parameters
motorIDthe ID define which motor will be set, you can choose MOTORA or MOTORB

Definition at line 109 of file MotorDriver.cpp.

Member Data Documentation

DigitalOut MotorDriver::_int1
private

Definition at line 144 of file MotorDriver.h.

DigitalOut MotorDriver::_int2
private

Definition at line 145 of file MotorDriver.h.

DigitalOut MotorDriver::_int3
private

Definition at line 146 of file MotorDriver.h.

DigitalOut MotorDriver::_int4
private

Definition at line 147 of file MotorDriver.h.

SoftwarePWM MotorDriver::_speedA
private

Definition at line 148 of file MotorDriver.h.

SoftwarePWM MotorDriver::_speedB
private

Definition at line 149 of file MotorDriver.h.

MotorStruct MotorDriver::motorA

motor A

Definition at line 136 of file MotorDriver.h.

MotorStruct MotorDriver::motorB

motor B

Definition at line 140 of file MotorDriver.h.


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


rosserial_mbed
Author(s): Gary Servin
autogenerated on Mon Jun 10 2019 14:53:26