Go to the source code of this file.
Functions | |
void | kmot_GetFWVersion (knet_dev_t *dev, unsigned int *version) |
void | kmot_GetStatus (knet_dev_t *dev, unsigned char *status, unsigned char *error) |
void | kmot_GetSpeedMultiplier (knet_dev_t *dev, unsigned short *mult) |
void | kmot_GetOptions (knet_dev_t *dev, unsigned char *software, unsigned char *hardware) |
void | kmot_ConfigurePID (knet_dev_t *dev, int regtype, int16_t Kp, int16_t Kd, int16_t Ki) |
void | kmot_SetPointSource (knet_dev_t *dev, int regtype, int wavetype, int period, int amplitude, int offset) |
long | kmot_GetMeasure (knet_dev_t *dev, int regtype) |
void | kmot_SetPosition (knet_dev_t *dev, long position) |
void | kmot_SetSpeedProfile (knet_dev_t *dev, int maxspeed, int acceleration) |
void | kmot_SetMinSpeed (knet_dev_t *dev, int minspeed) |
void | kmot_SetLimits (knet_dev_t *dev, int regtype, long softStopMin, long softStopMax) |
int | kmot_SearchLimits (knet_dev_t *dev, int8_t blockedTime, int32_t setPoint, int32_t *minpos, int32_t *maxpos, unsigned int timeout) |
void | kmot_SetOptions (knet_dev_t *dev, int hwOptions, int swOptions) |
void | kmot_SetPoint (knet_dev_t *dev, int regtype, long setPoint) |
void | kmot_SaveConfig (knet_dev_t *dev) |
void | kmot_ResetError (knet_dev_t *dev) |
void | kmot_SetBlockedTime (knet_dev_t *dev, int time) |
void | kmot_SetSampleTime (knet_dev_t *dev, int sample) |
void | kmot_SetFilterOrder (knet_dev_t *dev, int order) |
void | kmot_SetMode (knet_dev_t *dev, int mode) |
void | kmot_SetPrescale (knet_dev_t *dev, int mode) |
void | kmot_SetSpeedMultiplier (knet_dev_t *dev, int mode) |
void | kmot_SetVelocityPrescale (knet_dev_t *dev, int mode) |
void | kmot_SetMargin (knet_dev_t *dev, int margin) |
Support for the KoreMotor board.
Definition in file kmot.c.
void kmot_ConfigurePID | ( | knet_dev_t * | dev, | |
int | regtype, | |||
int16_t | Kp, | |||
int16_t | Kd, | |||
int16_t | Ki | |||
) |
This function configures the PID controller using a given regulation mode. Please refer to the kMotRegType Definition
dev | K-Net Device Descriptor | |
regtype | Type of regulation | |
Kp | PID Proportional Constant | |
Kd | PID Differential Constant | |
Ki | PID Integral Constant |
Definition at line 241 of file kmot.c.
References KMOT_ORDER_MASK, kMotRegPos, kMotRegPosProfile, kMotRegSpeed, kMotRegSpeedProfile, kMotRegTorque, knet_set_order(), knet_write16(), MOT_KdPosL, MOT_KdSpeedL, MOT_KdTorqueL, MOT_KiPosL, MOT_KiSpeedL, MOT_KiTorqueL, MOT_KpPosL, MOT_KpSpeedL, and MOT_KpTorqueL.
Referenced by init(), initMot(), InitMotor(), kmot_ipConfigPID(), kmot_ipInitMotor(), main(), and setpid().
void kmot_GetFWVersion | ( | knet_dev_t * | dev, | |
unsigned int * | version | |||
) |
This function get the firmware version and revision number.
dev | K-Net Device Descriptor to the corresponding motor | |
version | A pointer to a variable that will receive the firmware version number. |
Definition at line 102 of file kmot.c.
References knet_read8(), and MOT_FWVersion.
Referenced by kmot_ipFirmware(), main(), and revisionOS().
long kmot_GetMeasure | ( | knet_dev_t * | dev, | |
int | regtype | |||
) |
This function read a measure from a given motor.
dev | K-Net Device Descriptor | |
regtype | Type of regulation |
Definition at line 316 of file kmot.c.
References KMOT_ORDER_MASK, kMotRegOpenLoop, kMotRegPos, kMotRegPosProfile, kMotRegSpeed, kMotRegSpeedProfile, kMotRegTorque, knet_read16(), knet_read32(), knet_set_order(), MOT_PositionLL, MOT_SpeedLL, and MOT_TorqueL.
Referenced by braitenbergAvoidance(), kmot_ipMeasure(), kmot_log_task(), left(), main(), measure(), right(), and test().
void kmot_GetOptions | ( | knet_dev_t * | dev, | |
unsigned char * | software, | |||
unsigned char * | hardware | |||
) |
This function gets the software options and hardware options.
dev | K-Net Device Descriptor | |
software | Software Options | |
hardware | Hardware Options |
Hardware Options:
Definition at line 218 of file kmot.c.
References knet_read8(), MOT_HWOptions, and MOT_SWOptions.
Referenced by option().
void kmot_GetSpeedMultiplier | ( | knet_dev_t * | dev, | |
unsigned short * | mult | |||
) |
This function gets the pid speed multiplier.
Definition at line 158 of file kmot.c.
References knet_read8(), MOT_SpeedMultH, and MOT_SpeedMultL.
Referenced by multiplier().
void kmot_GetStatus | ( | knet_dev_t * | dev, | |
unsigned char * | status, | |||
unsigned char * | error | |||
) |
This function gets the status flags and error flags.
dev | K-Net Device Descriptor | |
status | Status Flags | |
error | Error Flags |
Status flags:
Definition at line 141 of file kmot.c.
References knet_read8(), MOT_ErrorFlags, and MOT_StatusFlags.
Referenced by kmot_ipStatus(), main(), and status().
void kmot_ResetError | ( | knet_dev_t * | dev | ) |
This function resets the error register for the given motor, all controls are disabled while any error is active.
dev | K-Net Device Descriptor corresponding to the motor |
Definition at line 623 of file kmot.c.
References knet_write8(), and MOT_ErrorFlags.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), kmot_ipResetError(), koa_init_task(), main(), and statusclear().
void kmot_SaveConfig | ( | knet_dev_t * | dev | ) |
This function saves the current configuration for the given motor to the controller EEPROM. This EEPROM keeps the configuration even if the controller is switch off.
dev | K-Net Device Descriptor corresponding to the motor |
Definition at line 609 of file kmot.c.
References kMotModeSaveE2PROM, knet_write8(), and MOT_Mode.
int kmot_SearchLimits | ( | knet_dev_t * | dev, | |
int8_t | blockedTime, | |||
int32_t | setPoint, | |||
int32_t * | minpos, | |||
int32_t * | maxpos, | |||
unsigned int | timeout | |||
) |
This function searches the system mechanical limits.
The blocked time can adjust the test sensitivity and the current limit used for blocked detection is the one set with kmot_SetLimits. The given speed is used to perform the test. The min and max positions are retruned with the minpos and maxpos parameters. The speed regulator must be properly configured before calling the search limit routine. This function is blocking and will not return until the search cycle is completed or until the number of given retry has been reached.
dev | K-Net Device Descriptor corresponding to the motor | |
blockedTime | ||
setPoint | ||
minpos | Minimal mechanical position | |
maxpos | Maximal mechanical position | |
timeout | Timeout value in milli-seconds |
Definition at line 474 of file kmot.c.
References kb_getTime(), KMOT_ORDER_MASK, kMotModeSearchLimit, knet_read(), knet_read32(), knet_set_order(), knet_write32(), knet_write8(), MOT_BlockedTime, MOT_ControlTyp, MOT_Mode, MOT_SetPointLL, MOT_SoftStopMaxLL, and MOT_SoftStopMinLL.
Referenced by koa_init_task(), and main().
void kmot_SetBlockedTime | ( | knet_dev_t * | dev, | |
int | time | |||
) |
kmot_SetBlockedTime -
dev | K-Net Device Descriptor corresponding to the motor | |
time |
Definition at line 635 of file kmot.c.
References knet_write8(), and MOT_BlockedTime.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), koa_init_task(), and main().
void kmot_SetFilterOrder | ( | knet_dev_t * | dev, | |
int | order | |||
) |
kmot_SetFilterOrder -
dev | KNet Device Descriptor corresponding to the motor e | |
order | didastelmotor_getVersion( 1 , &version ); |
Definition at line 662 of file kmot.c.
References knet_write8(), and MOT_Filter.
void kmot_SetLimits | ( | knet_dev_t * | dev, | |
int | regtype, | |||
long | softStopMin, | |||
long | softStopMax | |||
) |
This function sets the limits for the given regulation.
The exact behavior when a measure reaches a limit depends on the controller options.
dev | K-Net Device Descriptor corresponding to the motor | |
regtype | Type of regulation | |
softStopMin | Minimal Software Stop Value | |
softStopMax | Maximal Software Stop Value |
Definition at line 424 of file kmot.c.
References KMOT_ORDER_MASK, kMotRegPos, kMotRegPosProfile, kMotRegTorque, knet_set_order(), knet_write16(), knet_write32(), MOT_SoftStopMaxLL, MOT_SoftStopMinLL, and MOT_SWCurrentLimitL.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), and main().
void kmot_SetMargin | ( | knet_dev_t * | dev, | |
int | margin | |||
) |
kmot_SetMargin -
dev | KNet Device Descriptor corresponding to the motor | |
margin |
Definition at line 742 of file kmot.c.
References knet_write8(), and MOT_NearTargetMargin.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), and main().
void kmot_SetMinSpeed | ( | knet_dev_t * | dev, | |
int | minspeed | |||
) |
This function sets the minimum speed for the tapezoidal profile
The trapezoidal speed profile start with this minimal value to avoid a too low speed value that the PID won't be able to regulate.
dev | K-Net Device Descriptor corresponding to the motor | |
minspeed | Minimal speed to start the trapeze |
Definition at line 402 of file kmot.c.
References KMOT_ORDER_MASK, knet_set_order(), knet_write16(), and MOT_MinSpeedL.
void kmot_SetMode | ( | knet_dev_t * | dev, | |
int | mode | |||
) |
kmot_SetMode -
dev | KNet Device Descriptor corresponding to the motor | |
mode |
Definition at line 674 of file kmot.c.
References knet_write8(), and MOT_Mode.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), left(), left2(), left3(), main(), motStop(), right(), right2(), right3(), and stop().
void kmot_SetOptions | ( | knet_dev_t * | dev, | |
int | hwOptions, | |||
int | swOptions | |||
) |
This function sets the options for the given controller. Each SW and HW option parameters is a OR field of option flags.
dev | K-Net Device Descriptor to the corresponding motor | |
hwOptions | Hardware Option Flags | |
swOptions | Software Option Flags |
Hardware Option Flags:
Definition at line 555 of file kmot.c.
References knet_write8(), MOT_HWOptions, and MOT_SWOptions.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), main(), and setoption().
void kmot_SetPoint | ( | knet_dev_t * | dev, | |
int | regtype, | |||
long | setPoint | |||
) |
This function sets a given target point for a given motor.
dev | K-Net Device Descriptor corresponding to the motor | |
regtype | Type of regulation | |
setPoint |
Definition at line 569 of file kmot.c.
References KMOT_ORDER_MASK, kMotModeNormal, kMotPtSrcExtI2C, knet_read(), knet_set_order(), knet_write32(), knet_write8(), MOT_ControlTyp, MOT_Mode, MOT_SetPointLL, and MOT_SetPointSource.
Referenced by braitenbergAvoidance(), kmot_ipSetPos(), kmot_ipSetSpeed(), koa_net_bothcam(), koa_net_camera(), koa_net_camera2(), left(), left2(), left3(), main(), motMove(), motSpeed(), moveat(), moveatprofile(), openloop(), right(), right2(), right3(), setspeed(), setspeedprofile(), settorque(), and test().
void kmot_SetPointSource | ( | knet_dev_t * | dev, | |
int | regtype, | |||
int | wavetype, | |||
int | period, | |||
int | amplitude, | |||
int | offset | |||
) |
This function selects a source for the target point. Usually the setpoint is given by the application with knet commnands, on some cases, an internal signal generator can provide a variable setpoint.
dev | K-Net Device Descriptor | |
regtype | Type of regluation. See kMotRegType | |
wavetype | Target Point Source. See kMotPointSource | |
period | Period [0..255] | |
amplitude | Amplitude [0..255] | |
offset | Offset [-128..127] |
Definition at line 292 of file kmot.c.
References knet_write8(), MOT_ControlTyp, MOT_IntGenAmplitude, MOT_IntGenOffset, MOT_IntGenPeriod, MOT_Mode, and MOT_SetPointSource.
Referenced by kmot_ipSetPointSource().
void kmot_SetPosition | ( | knet_dev_t * | dev, | |
long | position | |||
) |
This function sets the position counter to the given value for a given motor.
dev | K-Net Device Descriptor corresponding to the motor | |
position | New position value |
Definition at line 365 of file kmot.c.
References KMOT_ORDER_MASK, knet_set_order(), knet_write32(), and MOT_PositionLL.
Referenced by setpos().
void kmot_SetPrescale | ( | knet_dev_t * | dev, | |
int | mode | |||
) |
kmot_SetPrescale -
dev | KNet Device Descriptor corresponding to the motor | |
prescale |
Definition at line 687 of file kmot.c.
References knet_write8(), and MOT_Prescale.
Referenced by prescaler().
void kmot_SetSampleTime | ( | knet_dev_t * | dev, | |
int | sample | |||
) |
kmot_SetSampleTime -
dev | K-Net Device Descriptor corresponding to the motor | |
sample |
Definition at line 647 of file kmot.c.
References KMOT_ORDER_MASK, knet_set_order(), knet_write8(), MOT_SampleTimeH, and MOT_SampleTimeL.
Referenced by init(), initMot(), InitMotor(), kmot_ipInitMotor(), main(), and setsampletime().
void kmot_SetSpeedMultiplier | ( | knet_dev_t * | dev, | |
int | mode | |||
) |
kmot_SetSpeedMultiplier -
dev | KNet Device Descriptor corresponding to the motor | |
prescale |
Definition at line 700 of file kmot.c.
References knet_write8(), MOT_SpeedMultH, and MOT_SpeedMultL.
Referenced by setmultiplier().
void kmot_SetSpeedProfile | ( | knet_dev_t * | dev, | |
int | maxspeed, | |||
int | acceleration | |||
) |
This function sets the profile for position regulation.
The trapezoidal speed profile is calculated using the acceleration until the maxspeed is reached. -acceleration is used to decelerate until target position is reached.
dev | K-Net Device Descriptor corresponding to the motor | |
maxspeed | Maximal speed to reach | |
acceleration | Acceleration |
Definition at line 383 of file kmot.c.
References KMOT_ORDER_MASK, knet_set_order(), knet_write16(), knet_write8(), MOT_Acceleration, and MOT_MaxSpeedL.
Referenced by configspeedprofile(), init(), initMot(), InitMotor(), kmot_ipInitMotor(), and main().
void kmot_SetVelocityPrescale | ( | knet_dev_t * | dev, | |
int | mode | |||
) |
kmot_SetVelocityPrescale -
dev | KNet Device Descriptor corresponding to the motor | |
prescale |
Definition at line 730 of file kmot.c.
References knet_write8(), and MOT_VelocityPrescaler.
Referenced by velprescaler().