rec::robotino::api2 C interface
Macros | Typedefs | Functions
Motor.h File Reference

In "rec/robotino/api2/c/Motor.h" you can find functions for reading Robotino's bumper. More...

#include "rec/robotino/api2/c/globals.h"
#include "rec/robotino/api2/c/Com.h"

Go to the source code of this file.

Macros

#define INVALID_MOTORID   -1
 

Typedefs

typedef int MotorId
 

Functions

DLLEXPORT MotorId Motor_construct (unsigned int number)
 
DLLEXPORT BOOL Motor_destroy (MotorId id)
 
DLLEXPORT BOOL Motor_setComId (MotorId id, ComId comId)
 
DLLEXPORT BOOL Motor_setMotorNumber (MotorId id, unsigned int number)
 
DLLEXPORT unsigned int numMotors ()
 
DLLEXPORT BOOL Motor_setSetPointSpeed (MotorId id, float speed)
 
DLLEXPORT BOOL Motor_resetPosition (MotorId id)
 
DLLEXPORT BOOL Motor_setBrake (MotorId id, BOOL brake)
 
DLLEXPORT BOOL Motor_setPID (MotorId id, float kp, float ki, float kd)
 
DLLEXPORT float Motor_actualSpeed (MotorId id)
 
DLLEXPORT int Motor_actualPosition (MotorId id)
 
DLLEXPORT float Motor_motorCurrent (MotorId id)
 
DLLEXPORT float Motor_rawCurrentMeasurment (MotorId id)
 

Detailed Description

In "rec/robotino/api2/c/Motor.h" you can find functions for reading Robotino's bumper.

Use Motor_construct() to create a new motor object. Associate the motor object with a com object using Motor_setComId(). Use Motor_setSetPointSpeed() to set the motor's speed.

Macro Definition Documentation

#define INVALID_MOTORID   -1

Invalid MotorId is -1

Typedef Documentation

typedef int MotorId

MotorId

Function Documentation

DLLEXPORT int Motor_actualPosition ( MotorId  id)

Retrieves the actual position of this motor.

Parameters
idThe id of the motor object.
Returns
actual position
DLLEXPORT float Motor_actualSpeed ( MotorId  id)

Retrieves the actual speed of this motor.

Parameters
idThe id of the motor object.
Returns
Speed in rpm.
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId is invalid.
DLLEXPORT MotorId Motor_construct ( unsigned int  number)

Construct an motor object

Parameters
numbernumber of this motor. Range [0; numMotors()-1].
Returns
Returns the ID of the newly constructed motor object.
DLLEXPORT BOOL Motor_destroy ( MotorId  id)

Destroy the motor object assigned to id

Parameters
idThe id of the motor object to be destroyed
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId is invalid.
DLLEXPORT float Motor_motorCurrent ( MotorId  id)

Retrieves the current of this motor.

Parameters
idThe id of the motor object.
Returns
motor current in A.
DLLEXPORT float Motor_rawCurrentMeasurment ( MotorId  id)

The current is measured by a 10 bit adc and is not converted into A.

Parameters
idThe id of the motor object.
Returns
The current delivered by to this motor. Range from 0 to 1023.
DLLEXPORT BOOL Motor_resetPosition ( MotorId  id)

Resets the position of this motor.

Parameters
idThe id of the motor object.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId is invalid.
DLLEXPORT BOOL Motor_setBrake ( MotorId  id,
BOOL  brake 
)

Controls the brakes of this motor.

Parameters
idThe id of the motor object.
brakeIf set to TRUE, this will activate the brake. If set to FALSE, the brake is released.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId is invalid.
DLLEXPORT BOOL Motor_setComId ( MotorId  id,
ComId  comId 
)

Associated a motor object with a communication interface, i.e. binding the motor to a specific Robotino

Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId or ComId is invalid.
DLLEXPORT BOOL Motor_setMotorNumber ( MotorId  id,
unsigned int  number 
)

Sets the number of this motor.

Parameters
idThe id of the motor object to be set
numbernumber of this motor
Exceptions
RobotinoExceptionif the current communication object is invalid.
DLLEXPORT BOOL Motor_setPID ( MotorId  id,
float  kp,
float  ki,
float  kd 
)

Sets the proportional, integral and differential constant of the PID controller.

Parameters
idThe id of the motor object.
kpproportional constant. Robotino v2: Typical value 200. Robotino v3: Typical value is 0.1.
kiintegral constant. Robotino v2: Typical value 10. Robotino v3: Typical value is 0.005.
kddifferential constant. Robotino v2: Typical value 0. Robotino v3: Not used.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId is invalid.
DLLEXPORT BOOL Motor_setSetPointSpeed ( MotorId  id,
float  speed 
)

Sets the setpoint speed of this motor.

Parameters
idThe id of the motor object.
speedSet point speed in rpm.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given MotorId is invalid.
DLLEXPORT unsigned int numMotors ( )
Returns
Returns the number of drive motors on Robotino