Functions
D:/DRISSI/arduino-0022/arduino-0022/libraries/motors/motors.h File Reference

A simple library to send instruction and receive data from motors Faulhaber via RS232 link. More...

#include <WProgram.h>
#include <TimerOne/TimerOne.h>

Go to the source code of this file.

Functions

bool EnableLeft ()
bool EnableRight ()
bool DisableLeft ()
bool DisableRight ()
bool ResetLeft ()
bool ResetRight ()
char ReadBufferLeft (char *Buffer, int NbMax, long TimeOut)
char ReadBufferRight (char *Buffer, int NbMax, long TimeOut)
bool CheckOKLeft (long TimeOut_us=100000)
bool CheckOKRight (long TimeOut_us=100000)
bool CheckRESETLeft (long TimeOut_us=100000)
bool CheckRESETRight (long TimeOut_us=100000)
void ISR_TimeOut_Motors ()
bool SetLeftSpeed (long Vit)
bool SetRightSpeed (long Vit)
bool SetLeftAbsolutePos (long Pos)
bool SetRightAbsolutePos (long Pos)
bool SetLeftRelativePos (long Pos)
bool SetRightRelativePos (long Pos)
bool SetLeftAcc (int Acc)
bool SetRightAcc (int Acc)
bool SetLeftDec (int Dec)
bool SetRightDec (int Dec)
bool SetLeftPeakCurrentLimit (int Current)
bool SetRightPeakCurrentLimit (int Current)
bool SetLeftContCurrentLimit (int Current)
bool SetRightContCurrentLimit (int Current)
bool SetLeftNotifyPosition (long Pos=0)
bool SetRightNotifyPosition (long Pos=0)
bool SetLeftNotifyPositionOff ()
bool SetRightNotifyPositionOff ()
bool SetLeftNotifyVelocity (long Vel)
bool SetRightNotifyVelocity (long Vel)
bool SetLeftNotifyVelocityOff ()
bool SetRightNotifyVelocityOff ()
bool MovingLeft ()
bool MovingRight ()
char GetLeftSpeed (long *Speed)
char GetRightSpeed (long *Speed)
char GetLeftPos (long *Pos)
char GetRightPos (long *Pos)
char GetLeftAcc (int *Acc)
char GetRightAcc (int *Acc)
char GetLeftDec (int *Dec)
char GetRightDec (int *Dec)
char GetLeftPeakCurrentLimit (int *Current)
char GetRightPeakCurrentLimit (int *Current)
char GetLeftContCurrentLimit (int *Current)
char GetRightContCurrentLimit (int *Current)
bool GetLeftNotifyPosition ()
bool GetRightNotifyPosition ()
bool GetLeftNotifyVelocity ()
bool GetRightNotifyVelocity ()

Detailed Description

A simple library to send instruction and receive data from motors Faulhaber via RS232 link.

motors.cpp
Here is the C++ File Reference of this header.

Definition in file motors.h.


Function Documentation

bool CheckOKLeft ( long  TimeOut_us = 100000)

Check if a "ok" has been received on left buffer.

Parameters:
TimeOut_usSet the length of the time out (by default : 100 ms)
Returns:
a boolean, 1 means the answer was good and 0 that answer was bad or reception failed.

Definition at line 123 of file motors.cpp.

bool CheckOKRight ( long  TimeOut_us = 100000)

Check if a "ok" has been received on right buffer.

Parameters:
TimeOut_usSet the length of the time out (by default : 100 ms)
Returns:
a boolean, 1 means the answer was good and 0 that answer was bad or reception failed.

Definition at line 135 of file motors.cpp.

bool CheckRESETLeft ( long  TimeOut_us = 100000)

Check if a "reset" has been received on left buffer.

Parameters:
TimeOut_usSet the length of the time out (by default : 100 ms)
Returns:
a boolean, 1 means the answer was good and 0 that answer was bad or reception failed.

Definition at line 148 of file motors.cpp.

bool CheckRESETRight ( long  TimeOut_us = 100000)

Check if a "reset" has been received on right buffer.

Parameters:
TimeOut_usSet the length of the time out (by default : 100 ms)
Returns:
a boolean, 1 means the answer was good and 0 that answer was bad or reception failed.

Definition at line 160 of file motors.cpp.

bool DisableLeft ( )

Disable left motor.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 31 of file motors.cpp.

bool DisableRight ( )

Disable right motor.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 38 of file motors.cpp.

bool EnableLeft ( )

Enable left motor.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 15 of file motors.cpp.

bool EnableRight ( )

Enable right motor.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 22 of file motors.cpp.

char GetLeftAcc ( int *  Acc)

Get left acceleration (from 0 to 30000 r/s^2).

Returns:
an int, the acceleration in r/s^2.

Definition at line 452 of file motors.cpp.

char GetLeftContCurrentLimit ( int *  Current)

Get left continuous current limit (from 0 to 12000 mA).

Returns:
an int, the current limit.

Definition at line 527 of file motors.cpp.

char GetLeftDec ( int *  Dec)

Get left deceleration (from 0 to 30000 r/s^2).

Returns:
an int, the deceleration in r/s^2.

Definition at line 477 of file motors.cpp.

bool GetLeftNotifyPosition ( )

Read left buffer to see if a "notify position" packet has been received (Check SetLeftNotifyPosition for more information about this function).

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 552 of file motors.cpp.

bool GetLeftNotifyVelocity ( )

Read left buffer to see if a "notify velocity" packet has been received (Check SetLeftNotifyVelocity for more information about this function).

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 571 of file motors.cpp.

char GetLeftPeakCurrentLimit ( int *  Current)

Get left peak current limit (from 0 to 12000 mA).

Returns:
an int, the current limit.

Definition at line 502 of file motors.cpp.

char GetLeftPos ( long *  Pos)

Get left position (from -1.8*10^9 to +1.8*10^9).

Returns:
an int, the current position of the robot.

Definition at line 427 of file motors.cpp.

char GetLeftSpeed ( long *  Speed)

Set left speed (from 0 to 32767 rpm).

Returns:
an int, the speed in rpm.

Definition at line 402 of file motors.cpp.

char GetRightAcc ( int *  Acc)

Get right acceleration (from 0 to 30000 r/s^2).

Returns:
an int, the acceleration in r/s^2.

Definition at line 464 of file motors.cpp.

char GetRightContCurrentLimit ( int *  Current)

Get right continuous current limit (from 0 to 12000 mA).

Returns:
an int, the current limit.

Definition at line 539 of file motors.cpp.

char GetRightDec ( int *  Dec)

Get right deceleration (from 0 to 30000 r/s^2).

Returns:
an int, the deceleration in r/s^2.

Definition at line 489 of file motors.cpp.

bool GetRightNotifyPosition ( )

Read right buffer to see if a "notify position" packet has been received (Check SetRightNotifyPosition for more information about this function).

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 561 of file motors.cpp.

bool GetRightNotifyVelocity ( )

Read right buffer to see if a "notify velocity" packet has been received (Check SetRightNotifyVelocity for more information about this function).

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 580 of file motors.cpp.

char GetRightPeakCurrentLimit ( int *  Current)

Get right peak current limit (from 0 to 12000 mA).

Returns:
an int, the current limit.

Definition at line 514 of file motors.cpp.

char GetRightPos ( long *  Pos)

Get right position (from -1.8*10^9 to +1.8*10^9).

Returns:
an int, the current position of the robot.

Definition at line 439 of file motors.cpp.

char GetRightSpeed ( long *  Speed)

Set right speed (from 0 to 32767 rpm).

Returns:
an int, the speed in rpm.

Definition at line 414 of file motors.cpp.

void ISR_TimeOut_Motors ( )

When reception is too long, the time out occurenced and the present function is attach to the time out. So, when it occurenced, this function sets the flag to true and stop the timer. This flag will also stop reception and return an error.

Returns:
no return.

Definition at line 174 of file motors.cpp.

bool MovingLeft ( )

Start moving to the last left position load.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 385 of file motors.cpp.

bool MovingRight ( )

Start moving to the last right position load.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 392 of file motors.cpp.

char ReadBufferLeft ( char *  Buffer,
int  NbMax,
long  TimeOut 
)

Read left buffer.

Parameters:
BufferTo save the reception
NbMaxSet the maximum number of characters to read
TimeOutSet the length of the time out
Returns:
a char, 0 means instruction is done, -1 that reception buffer is full and -2 that time out has occurenced.

Definition at line 63 of file motors.cpp.

char ReadBufferRight ( char *  Buffer,
int  NbMax,
long  TimeOut 
)

Read right buffer.

Parameters:
BufferTo save the reception
NbMaxSet the maximum number of characters to read
TimeOutSet the length of the time out
Returns:
a char, 0 means instruction is done, -1 that reception buffer is full and -2 that time out has occurenced.

Definition at line 93 of file motors.cpp.

bool ResetLeft ( )

Reset left motor.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 47 of file motors.cpp.

bool ResetRight ( )

Reset right motor.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 54 of file motors.cpp.

bool SetLeftAbsolutePos ( long  Pos)

Set left absolute position (from -1.8*10^9 to +1.8*10^9).

Parameters:
PosDefines the position to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 207 of file motors.cpp.

bool SetLeftAcc ( int  Acc)

Set left acceleration (from 0 to 30000 r/s^2).

Parameters:
AccDefines the acceleration to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 243 of file motors.cpp.

bool SetLeftContCurrentLimit ( int  Current)

Set left continuous current limit (from 0 to 12000 mA).

Parameters:
CurrentDefines the current limit to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 294 of file motors.cpp.

bool SetLeftDec ( int  Dec)

Set left deceleration (from 0 to 30000 r/s^2).

Parameters:
DecDefines the deceleration to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 260 of file motors.cpp.

bool SetLeftNotifyPosition ( long  Pos = 0)

Set left notify position (when specified position is reached send a "notify position" that could be read by GetLeftNotifyPosition.

Parameters:
PosDefines the position to reach or pass to send the packet or if 0 or nothing is given the packet will be send when nominal position will be reached.
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 311 of file motors.cpp.

bool SetLeftNotifyPositionOff ( )

Stop sending a "notify position" packet when left position is reached.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 338 of file motors.cpp.

bool SetLeftNotifyVelocity ( long  Vel)

Set left notify velocity (when specified velocity is reached send a "notify position" that could be read by GetLeftNotifyVelocity.

Parameters:
VelDefines the velocity to reach or pass to send the packet.
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 353 of file motors.cpp.

bool SetLeftNotifyVelocityOff ( )

Stop sending a "notify velocity" packet when left velocity is reached.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 370 of file motors.cpp.

bool SetLeftPeakCurrentLimit ( int  Current)

Set left peak current limit (from 0 to 12000 mA).

Parameters:
CurrentDefines the current limit to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 277 of file motors.cpp.

bool SetLeftRelativePos ( long  Pos)

Set left relative position (from -2.14*10^9 to +2.14*10^9).

Parameters:
PosDefines the position to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 225 of file motors.cpp.

bool SetLeftSpeed ( long  Vit)

Set left speed (from 0 to 32727 rpm).

Parameters:
VitDefines the speed to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 189 of file motors.cpp.

bool SetRightAbsolutePos ( long  Pos)

Set right absolute position (from -1.8*10^9 to +1.8*10^9).

Parameters:
PosDefines the position to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 215 of file motors.cpp.

bool SetRightAcc ( int  Acc)

Set right acceleration (from 0 to 30000 r/s^2).

Parameters:
AccDefines the acceleration to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 251 of file motors.cpp.

bool SetRightContCurrentLimit ( int  Current)

Set right continuous current limit (from 0 to 12000 mA).

Parameters:
CurrentDefines the current limit to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 302 of file motors.cpp.

bool SetRightDec ( int  Dec)

Set right deceleration (from 0 to 30000 r/s^2).

Parameters:
DecDefines the deceleration to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 268 of file motors.cpp.

bool SetRightNotifyPosition ( long  Pos = 0)

Set right notify position (when specified position is reached send a "notify position" that could be read by GetRightNotifyPosition.

Parameters:
PosDefines the position to reach or pass to send the packet or if 0 or nothing is given the packet will be send when nominal position will be reached.
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 324 of file motors.cpp.

bool SetRightNotifyPositionOff ( )

Stop sending a "notify position" packet when right position is reached.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 345 of file motors.cpp.

bool SetRightNotifyVelocity ( long  Vel)

Set right notify velocity (when specified velocity is reached send a "notify position" that could be read by GetRightNotifyVelocity.

Parameters:
VelDefines the velocity to reach or pass to send the packet.
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 361 of file motors.cpp.

bool SetRightNotifyVelocityOff ( )

Stop sending a "notify velocity" packet when right velocity is reached.

Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 377 of file motors.cpp.

bool SetRightPeakCurrentLimit ( int  Current)

Set right peak current limit (from 0 to 12000 mA).

Parameters:
CurrentDefines the current limit to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 285 of file motors.cpp.

bool SetRightRelativePos ( long  Pos)

Set right relative position (from -2.14*10^9 to +2.14*10^9).

Parameters:
PosDefines the position to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 233 of file motors.cpp.

bool SetRightSpeed ( long  Vit)

Set right speed (from 0 to 32727 rpm).

Parameters:
VitDefines the speed to use
Returns:
a boolean, 1 means instruction is done and 0 that instruction has failed.

Definition at line 197 of file motors.cpp.