Public Member Functions | Private Attributes
Mcdc3006s Class Reference

#include <mcdc3006s.h>

Inheritance diagram for Mcdc3006s:
Inheritance graph
[legend]

List of all members.

Public Member Functions

int activate_limits (int action)
 Activates/Deactivates the driver Limits. If the limits aren't activated the driver will NOT respect the Maximum or Minimum positions.
int calibrate (int limit)
 starts the calibration sequence of the drive
int disable_driver ()
 Disables the driver.
int enable_driver ()
 Enables the driver.
int get_config (driverConf_t *dc)
 Function that gets the current driver configuration as is stored in the flash memory of the driver and writes it in a driverConf_t type format.
int get_cur_lim ()
 get the continuous current limit (CCL) in mA.
int get_instant_current (int *current)
 asks for the instant velocity from sensor data of the driver.
int get_instant_pos (long int *positon)
 asks for the instant position from sensor data of the driver.
int get_instant_vel (long int *velocity)
 asks for the instant velocity from sensor data of the driver.
long int get_max_acc ()
 returns the maximum acceleration allowed by the driver. To set this value see
long int get_max_dec ()
 returns the maximum deceleration allowed by the driver. To set this value see
long int get_max_pos ()
 returns the maximum position allowed by the driver. To set this value see
long int get_max_vel ()
 Returns the maximum speed allowed by the driver which is set with setDriverMaxVel() function.
long int get_min_pos ()
 This function reads from the driver min position from its flash memory.
int get_peak_cur_lim ()
 get the Peak Current Limit (PCL) in mA.
int get_sensor (driverSensor_t *sensor)
 asks for sensor data of the driver
int get_status (driverStatus_t *drvStatus)
 Asks to the driver its current status.
int init (int baudrate, char *dev, char *sem)
 high level functions
 Mcdc3006s ()
 Empty constructor.
int move_abs_pos (long int pos)
 Sends to the driver the order to move to an absolute position in pulses.
int move_rel_pos (long int pos)
 Sends to the driver the order to move to a relative position in pulses.
int move_vel (long int vel)
 Sends to the driver the order to move at a determined speed (in rpm)
int save_to_flash ()
 Save current configuration params to FLASH memory of the drive, so the nest time the drive is turned on it loads this configuration. WARNING!!! It should not be used more than 10,000 times because the FLASH memory could get damaged!!!
int set_baudrate (int baud)
 tells to the driver at which baudrate we want to operate
int set_config (driverConf_t dc)
 Function that configures the driver from a driverConf_t type.
int set_cur_lim (int cl)
 loads continuous current limit
int set_home_position (long int home)
 Sets the current position as the given value. NOTE: Use only during the calibration phase. This function sends to the driver the Home command. The home commands tells to the driver which is the current position. For example If we send home = 0 we are telling to the driver that the current position is 0 position (and it should used as a reference).
int set_max_acc (long int maxAcc)
 sets the maximum acceleration allowed by the driver in revolutions/s^2
int set_max_dec (long int maxDec)
 sets the maximum deceleration allowed by the driver in revolutions/s^2
int set_max_pos (long int maxPos)
 Sets the maximum absolute position in pulses.
int set_max_vel (long int maxVel)
 Sets the maximum speed allowed by the driver in rpm.
int set_min_pos (long int minPos)
 Sets the minimum absolute position in pulses.
int set_peak_cur_lim (int pcl)
 loads peak current limit
 ~Mcdc3006s ()
 Destructor.

Private Attributes

Rs232 _comm

Detailed Description

Definition at line 33 of file mcdc3006s.h.


Constructor & Destructor Documentation

Empty constructor.

Definition at line 30 of file mcdc3006s.cpp.

Destructor.

Definition at line 36 of file mcdc3006s.cpp.


Member Function Documentation

int Mcdc3006s::activate_limits ( int  action) [virtual]

Activates/Deactivates the driver Limits. If the limits aren't activated the driver will NOT respect the Maximum or Minimum positions.

Parameters:
actionit only has two allowed values: ACTIVATE to activate de driver or DEACTIVATE to disable the driver
Returns:
ERR_NOERR if everything works correctly
ERR_WRI in case of error when writing in the driver descriptor file
ERR_OUTOFRANGE if action is not in allowed values set

Implements MotorDriverInterface.

Definition at line 698 of file mcdc3006s.cpp.

int Mcdc3006s::calibrate ( int  limit) [virtual]

starts the calibration sequence of the drive

Parameters:
limitsensor position in pulses measured from the desired 0 position
Returns:
ERR_NOERR If the calibration is done successfully
ERR_NOHOME if it is not possible to establish the home position

Error control here

Implements MotorDriverInterface.

Definition at line 736 of file mcdc3006s.cpp.

int Mcdc3006s::disable_driver ( ) [virtual]

Disables the driver.

Returns:
ERR_NOERR if everything works correctly
ERR_WRI in case of error when writing in the driver descriptor file

Implements MotorDriverInterface.

Definition at line 73 of file mcdc3006s.cpp.

int Mcdc3006s::enable_driver ( ) [virtual]

Enables the driver.

Returns:
ERR_NOERR if everything works correctly
ERR_WRI in case of error when writing in the driver descriptor file

Implements MotorDriverInterface.

Definition at line 58 of file mcdc3006s.cpp.

int Mcdc3006s::get_config ( driverConf_t dc) [virtual]

Function that gets the current driver configuration as is stored in the flash memory of the driver and writes it in a driverConf_t type format.

Parameters:
dcis the driverConf_t type where the driver configuration is stored
Returns:
ERR_NOERR if there are no problems
ERR_COM if it is not possible to read (any parameter) information from the driver. When this happens at least one of the parameters of the driverConf_t structure could be incomplete.

Implements MotorDriverInterface.

Definition at line 88 of file mcdc3006s.cpp.

int Mcdc3006s::get_cur_lim ( ) [virtual]

get the continuous current limit (CCL) in mA.

Returns:
returns the value of the continuous current limit (CCL) in mA.
ERR_COM if could not communicate with the driver (either write or read)

WARNING: Untested Function

Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must return Error control

Implements MotorDriverInterface.

Definition at line 228 of file mcdc3006s.cpp.

int Mcdc3006s::get_instant_current ( int *  current) [virtual]

asks for the instant velocity from sensor data of the driver.

Parameters:
currentis where the instant current data from the driver will be stored. The units from the driver are [rpm]
Returns:
ERR_NOERR if no error (operation is successful)
ERR_COM if there is an error communicating whit the driver.

Implements MotorDriverInterface.

Definition at line 391 of file mcdc3006s.cpp.

int Mcdc3006s::get_instant_pos ( long int *  positon) [virtual]

asks for the instant position from sensor data of the driver.

Parameters:
positionis a pointer pointing to where the position sensor data from the driver will be stored. The units from the driver are in [pulses]
Returns:
ERR_NOERR if no error (operation is successful)
ERR_COM if there is an error communicating whit the driver.

Implements MotorDriverInterface.

Definition at line 349 of file mcdc3006s.cpp.

int Mcdc3006s::get_instant_vel ( long int *  velocity) [virtual]

asks for the instant velocity from sensor data of the driver.

Parameters:
velocityis where the velocity sensor data from the driver will be stored. The units from the driver are [rpm]
Returns:
ERR_NOERR if no error (operation is successful)
ERR_COM if there is an error communicating whit the driver.

Implements MotorDriverInterface.

Definition at line 370 of file mcdc3006s.cpp.

long int Mcdc3006s::get_max_acc ( ) [virtual]

returns the maximum acceleration allowed by the driver. To set this value see

See also:
SetDriverMaxAcc
Returns:
maxAcc Returns the maximum acceleration revolutions/sec2
ERR_COM if could not communicate with the driver (either write or read)
Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must return Error control

Implements MotorDriverInterface.

Definition at line 190 of file mcdc3006s.cpp.

long int Mcdc3006s::get_max_dec ( ) [virtual]

returns the maximum deceleration allowed by the driver. To set this value see

See also:
SetDriverMaxDec
Returns:
maxDec Returns the maximum deceleration revolutions/sec2
ERR_COM if could not communicate with the driver (either write or read)
Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must return Error control

Implements MotorDriverInterface.

Definition at line 209 of file mcdc3006s.cpp.

long int Mcdc3006s::get_max_pos ( ) [virtual]

returns the maximum position allowed by the driver. To set this value see

See also:
SetDriverMaxPos
Returns:
ERR_NOERR if there aren't any problems
ERR_COM if could not communicate with the driver (either write or read)
Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must return Error control

Implements MotorDriverInterface.

Definition at line 132 of file mcdc3006s.cpp.

long int Mcdc3006s::get_max_vel ( ) [virtual]

Returns the maximum speed allowed by the driver which is set with setDriverMaxVel() function.

Returns:
maxVel configured in the drive in r.p.m.
ERR_COM if could not communicate with the driver (either write or read)
Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must return Error control

Implements MotorDriverInterface.

Definition at line 171 of file mcdc3006s.cpp.

long int Mcdc3006s::get_min_pos ( ) [virtual]

This function reads from the driver min position from its flash memory.

Returns:
returns the value of the min position in pulses
ERR_COM if could not communicate with the driver (either write or read) Warning, it is possible to receive a min position which the same as ERR_COM. If this happens the function will wrongly understand that an error has occured
Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must
Returns:
Error control

Implements MotorDriverInterface.

Definition at line 150 of file mcdc3006s.cpp.

int Mcdc3006s::get_peak_cur_lim ( ) [virtual]

get the Peak Current Limit (PCL) in mA.

Returns:
returns the value of the peak current limit (PCL) in mA.
ERR_COM if could not communicate with the driver (either write or read)

WARNING: Untested Function

Todo:
change the way I save the parameter. It has to be saved by parameter by reference. Return only must return Error control

Implements MotorDriverInterface.

Definition at line 246 of file mcdc3006s.cpp.

int Mcdc3006s::get_sensor ( driverSensor_t sensor) [virtual]

asks for sensor data of the driver

Parameters:
sensoris the sensor structure where we want to store the sensor data from the driver.
Returns:
ERR_NOERR if no error (operation is successful)
ERR_COM if there is an error communicating whit the driver. In this case some (of all) of the sensor parameters could not be up to date.

Implements MotorDriverInterface.

Definition at line 308 of file mcdc3006s.cpp.

int Mcdc3006s::get_status ( driverStatus_t drvStatus) [virtual]

Asks to the driver its current status.

Parameters:
drvStatusis a structure where the current driver status is stored. Each of the parameters of the drvStatus are set to 1 if true or 0 if false
Returns:
ERR_NOERR if the status could be returned
ERR_COM if it is not possible to check the driver status

Implements MotorDriverInterface.

Definition at line 264 of file mcdc3006s.cpp.

int Mcdc3006s::init ( int  baudrate,
char *  dev,
char *  sem 
) [virtual]

high level functions

Implements MotorDriverInterface.

Definition at line 43 of file mcdc3006s.cpp.

int Mcdc3006s::move_abs_pos ( long int  pos) [virtual]

Sends to the driver the order to move to an absolute position in pulses.

Parameters:
pabsolute position in pulses
Returns:
ERR_NOERR if no error sending the command to the driver
ERR_WRI if it isn't possible to communicate with the driver

Implements MotorDriverInterface.

Definition at line 619 of file mcdc3006s.cpp.

int Mcdc3006s::move_rel_pos ( long int  pos) [virtual]

Sends to the driver the order to move to a relative position in pulses.

Parameters:
prelative position in pulses
Returns:
ERR_NOERR if no error sending the command to the driver
ERR_WRI if it isn't possible to communicate with the driver

Implements MotorDriverInterface.

Definition at line 642 of file mcdc3006s.cpp.

int Mcdc3006s::move_vel ( long int  vel) [virtual]

Sends to the driver the order to move at a determined speed (in rpm)

Parameters:
vvelocity in rpm (revolutions per minute)
Returns:
ERR_NOERR if no error sending the command to the driver
ERR_WRI if it isn't possible to communicate with the driver

Implements MotorDriverInterface.

Definition at line 665 of file mcdc3006s.cpp.

int Mcdc3006s::save_to_flash ( ) [virtual]

Save current configuration params to FLASH memory of the drive, so the nest time the drive is turned on it loads this configuration. WARNING!!! It should not be used more than 10,000 times because the FLASH memory could get damaged!!!

Returns:
ERR_COM if an error communicating with driver occurs
ERR_NOERR if the save is done correctly

The EEPSAV command always responds with the character string “EEPROM writing done” after successful saving of the current settings in the data Flash memory, or with “Flash defect”, if the save has failed.

Implements MotorDriverInterface.

Definition at line 681 of file mcdc3006s.cpp.

int Mcdc3006s::set_baudrate ( int  baud) [virtual]

tells to the driver at which baudrate we want to operate

Parameters:
baudis the baudrate of the communication.
Returns:
ERR_NOERR if the configuration is successful
ERR_OUTOFRANGE if the parameter baud is not in the expected values
ERR_WRI if it is not possible to write to the driver the configuration

Implements MotorDriverInterface.

Definition at line 589 of file mcdc3006s.cpp.

int Mcdc3006s::set_config ( driverConf_t  dc) [virtual]

Function that configures the driver from a driverConf_t type.

Parameters:
dcis where dc configuration is read in order to write it into the driver
Returns:
ERR_NOERR if success
ERR_CONF if any error occurs

Implements MotorDriverInterface.

Definition at line 412 of file mcdc3006s.cpp.

int Mcdc3006s::set_cur_lim ( int  cl) [virtual]

loads continuous current limit

Parameters:
clcurrent limit in mA Range = [0 - 12000mA]
Returns:
ERR_NOERR if everything goes correct
ERR_WRI if could not write to the driver

Implements MotorDriverInterface.

Definition at line 555 of file mcdc3006s.cpp.

int Mcdc3006s::set_home_position ( long int  home) [virtual]

Sets the current position as the given value. NOTE: Use only during the calibration phase. This function sends to the driver the Home command. The home commands tells to the driver which is the current position. For example If we send home = 0 we are telling to the driver that the current position is 0 position (and it should used as a reference).

Parameters:
homeis the given position in pulses. This parameter specifies which is the current position.
Returns:
ERR_NOERR if everything works correctly
ERR_WRI in case of error when writing in the driver descriptor file

Implements MotorDriverInterface.

Definition at line 720 of file mcdc3006s.cpp.

int Mcdc3006s::set_max_acc ( long int  maxAcc) [virtual]

sets the maximum acceleration allowed by the driver in revolutions/s^2

Parameters:
maxAccmaximum acceleration in revolutions/s^2
Returns:
ERR_NOERR if everything goes correct
ERR_WRI if could not write to the driver

Implements MotorDriverInterface.

Definition at line 521 of file mcdc3006s.cpp.

int Mcdc3006s::set_max_dec ( long int  maxDec) [virtual]

sets the maximum deceleration allowed by the driver in revolutions/s^2

Parameters:
maxDecmaximum deceleration in r/sec2
Returns:
ERR_NOERR if everything goes correct
ERR_WRI if could not write to the driver

Implements MotorDriverInterface.

Definition at line 538 of file mcdc3006s.cpp.

int Mcdc3006s::set_max_pos ( long int  maxPos) [virtual]

Sets the maximum absolute position in pulses.

Parameters:
maxPosin pulses
Returns:
ERR_NOERR if everything has gone correctly
ERR_OUTOFRANGE if maxPos is below or equal 0 (maxPos must be higher than 0).
ERR_WRI if could not write to the driver
ERR_POSLIMIT if it is not possible to activate the limits

Implements MotorDriverInterface.

Definition at line 445 of file mcdc3006s.cpp.

int Mcdc3006s::set_max_vel ( long int  maxVel) [virtual]

Sets the maximum speed allowed by the driver in rpm.

Parameters:
maxVelin r.p.m.
Returns:
ERR_NOERR if everything goes correct
ERR_WRI if could not write to the driver

Implements MotorDriverInterface.

Definition at line 504 of file mcdc3006s.cpp.

int Mcdc3006s::set_min_pos ( long int  minPos) [virtual]

Sets the minimum absolute position in pulses.

Parameters:
minPosis the minimum absolute position in pulses
Returns:
ERR_NOERR if everything has gone correctly
ERR_OUTOFRANGE if minPos is higher or equal than 0 (minPos must be lower than 0).
ERR_WRI if could not write to the driver
ERR_POSLIMIT if it is not possible to activate the limits

Implements MotorDriverInterface.

Definition at line 475 of file mcdc3006s.cpp.

int Mcdc3006s::set_peak_cur_lim ( int  pcl) [virtual]

loads peak current limit

Parameters:
pclcurrent limit in mA Range = [0 - 12000mA]
Returns:
ERR_NOERR if everything goes correct
ERR_WRI if could not write to the driver

Implements MotorDriverInterface.

Definition at line 572 of file mcdc3006s.cpp.


Member Data Documentation

Definition at line 352 of file mcdc3006s.h.


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


maggie_motor_drivers
Author(s): Raul Perula-Martinez
autogenerated on Mon Sep 14 2015 03:06:39