Go to the source code of this file.
#define KMOT_ORDER_MASK |
Value:
Definition at line 27 of file kmot.h.
Referenced by kmot_ConfigurePID(), kmot_GetMeasure(), kmot_SearchLimits(), kmot_SetLimits(), kmot_SetMinSpeed(), kmot_SetPoint(), kmot_SetPosition(), kmot_SetSampleTime(), and kmot_SetSpeedProfile().
#define KMOT_REVISION | ( | ver | ) | (ver&0xf) |
#define KMOT_VERSION | ( | ver | ) | ((ver>>4)&0xf) |
#define MOT_Acceleration 0x52 |
#define MOT_BlockedTime 0x46 |
#define MOT_ControlTyp 0x2C |
Definition at line 39 of file kmot.h.
Referenced by kmot_SearchLimits(), kmot_SetPoint(), and kmot_SetPointSource().
#define MOT_ErrorFlags 0x2D |
#define MOT_Filter 0x33 |
#define MOT_FWVersion 0x00 |
#define MOT_HWOptions 0x2A |
#define MOT_IntGenAmplitude 0x48 |
#define MOT_IntGenOffset 0x49 |
#define MOT_IntGenPeriod 0x47 |
#define MOT_KdPosL 0x63 |
#define MOT_KdSpeedL 0x40 |
#define MOT_KdTorqueL 0x69 |
#define MOT_KiPosL 0x65 |
#define MOT_KiSpeedL 0x42 |
#define MOT_KiTorqueL 0x6B |
#define MOT_KpPosL 0x61 |
#define MOT_KpSpeedL 0x3E |
#define MOT_KpTorqueL 0x67 |
#define MOT_MaxSpeedL 0x6D |
#define MOT_MinSpeedL 0x5E |
#define MOT_Mode 0x28 |
Definition at line 35 of file kmot.h.
Referenced by kmot_SaveConfig(), kmot_SearchLimits(), kmot_SetMode(), kmot_SetPoint(), and kmot_SetPointSource().
#define MOT_NearTargetMargin 0x60 |
#define MOT_PositionLL 0x34 |
#define MOT_Prescale 0x70 |
#define MOT_SampleTimeH 0x45 |
#define MOT_SampleTimeL 0x44 |
#define MOT_SetPointLL 0x2F |
#define MOT_SetPointSource 0x29 |
#define MOT_SoftStopMaxLL 0x4E |
#define MOT_SoftStopMinLL 0x4A |
#define MOT_SpeedLL 0x38 |
#define MOT_SpeedMultH 0x72 |
Definition at line 146 of file kmot.h.
Referenced by kmot_GetSpeedMultiplier(), and kmot_SetSpeedMultiplier().
#define MOT_SpeedMultL 0x71 |
Definition at line 145 of file kmot.h.
Referenced by kmot_GetSpeedMultiplier(), and kmot_SetSpeedMultiplier().
#define MOT_StatusFlags 0x2E |
#define MOT_SWCurrentLimitL 0x56 |
limiting with RC-filter
[U = 5V / 255 * CurrentLimit]
Definition at line 108 of file kmot.h.
Referenced by kmot_SetLimits().
#define MOT_SWOptions 0x2B |
#define MOT_TorqueL 0x3A |
#define MOT_VelocityPrescaler 0x73 |
enum kMotErrorFlags |
enum kMotHWOptions |
enum kMotMesureType |
enum kMotMode |
enum kMotPointSource |
enum kMotRegType |
enum kMotStatusFlags |
enum kMotSWOptions |
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 | |||
) |
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_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 | |||
) |
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().