kmot.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define KMOT_VERSION(ver)   ((ver>>4)&0xf)
#define KMOT_REVISION(ver)   (ver&0xf)
#define KMOT_ORDER_MASK
#define MOT_FWVersion   0x00
#define MOT_Mode   0x28
#define MOT_SetPointSource   0x29
#define MOT_HWOptions   0x2A
#define MOT_SWOptions   0x2B
#define MOT_ControlTyp   0x2C
#define MOT_ErrorFlags   0x2D
#define MOT_StatusFlags   0x2E
#define MOT_SetPointLL   0x2F
#define MOT_SetPointLH   0x30
#define MOT_SetPointHL   0x31
#define MOT_SetPointHH   0x32
#define MOT_Filter   0x33
#define MOT_PositionLL   0x34
#define MOT_PositionLH   0x35
#define MOT_PositionHL   0x36
#define MOT_PositionHH   0x37
#define MOT_SpeedLL   0x38
#define MOT_SpeedHL   0x39
#define MOT_TorqueL   0x3A
#define MOT_TorqueH   0x3B
#define MOT_TorqueBiasL   0x3C
#define MOT_TorqueBiasH   0x3D
#define MOT_KpSpeedL   0x3E
#define MOT_KpSpeedH   0x3F
#define MOT_KdSpeedL   0x40
#define MOT_KdSpeedH   0x41
#define MOT_KiSpeedL   0x42
#define MOT_KiSpeedH   0x43
#define MOT_SampleTimeL   0x44
#define MOT_SampleTimeH   0x45
#define MOT_BlockedTime   0x46
#define MOT_IntGenPeriod   0x47
#define MOT_IntGenAmplitude   0x48
#define MOT_IntGenOffset   0x49
#define MOT_SoftStopMinLL   0x4A
#define MOT_SoftStopMinLH   0x4B
#define MOT_SoftStopMinHL   0x4C
#define MOT_SoftStopMinHH   0x4D
#define MOT_SoftStopMaxLL   0x4E
#define MOT_SoftStopMaxLH   0x4F
#define MOT_SoftStopMaxHL   0x50
#define MOT_SoftStopMaxHH   0x51
#define MOT_Acceleration   0x52
#define MOT_Unused   0x53
#define MOT_StaticFriction   0x54
#define MOT_HWCurrentLimit   0x55
#define MOT_SWCurrentLimitL   0x56
#define MOT_SWCurrentLimitH   0x57
#define MOT_MinSampleTimeH   0x59
#define MOT_MinSampleTimeL   0x58
#define MOT_PID_OUTH   0x5D
#define MOT_PID_OUTL   0x5C
#define MOT_MinSpeedL   0x5E
#define MOT_MinSpeedH   0x5F
#define MOT_NearTargetMargin   0x60
#define MOT_KpPosL   0x61
#define MOT_KpPosH   0x62
#define MOT_KdPosL   0x63
#define MOT_KdPosH   0x64
#define MOT_KiPosL   0x65
#define MOT_KiPosH   0x66
#define MOT_KpTorqueL   0x67
#define MOT_KpTorqueH   0x68
#define MOT_KdTorqueL   0x69
#define MOT_KdTorqueH   0x6A
#define MOT_KiTorqueL   0x6B
#define MOT_KiTorqueH   0x6C
#define MOT_MaxSpeedL   0x6D
#define MOT_MaxSpeedH   0x6E
#define MOT_Prescale   0x70
#define MOT_SpeedMultL   0x71
#define MOT_SpeedMultH   0x72
#define MOT_VelocityPrescaler   0x73

Enumerations

enum  kMotMode {
  kMotModeIdle = 0, kMotModeNormal = 1, kMotModeStopMotor = 2, kMotModeSleep = 3,
  kMotModeReset = 4, kMotModeSaveE2PROM = 5, kMotModeSearchLimit = 6
}
enum  kMotRegType {
  kMotRegOpenLoop = 0, kMotRegPos = 1, kMotRegPosProfile = 2, kMotRegSpeed = 3,
  kMotRegSpeedProfile = 4, kMotRegCurrent = 5, kMotRegTorque = 5, kMotRegZeroFriction = 6
}
enum  kMotMesureType { kMotMesPos = kMotRegPos, kMotMesSpeed = kMotRegSpeed, kMotMesCurrent = kMotRegCurrent, kMotMesTorque = kMotRegTorque }
enum  kMotPointSource {
  kMotPtSrcExtI2C = 0, kMotPtSrcExtAnalog = 1, kMotPtSrcSquare = 2, kMotPtSrcTriangle = 3,
  kMotPtSrcSinus = 4
}
enum  kMotHWOptions {
  kMotHWOptIdle = (0<<0), kMotHWOptNormal = (1<<0), kMotHWOptAnSetPtInEn = (1<<1), kMotHWOptLed = (1<<2),
  kMotHWOptEncRes4x = (0<<3), kMotHWOptEncRes1x = (1<<3), kMotHWOptTorqueInv = (1<<4), kMotHWOptDriverOpt1 = (1<<5),
  kMotHWOptDriverOpt2 = (1<<6), kMotHWOptDriverOpt3 = (1<<7)
}
enum  kMotSWOptions {
  kMotSWOptSepD = (1<<0), kMotSWOptWindup = (1<<1), kMotSWOptSoftStopMin = (1<<2), kMotSWOptSoftStopMax = (1<<3),
  kMotSWOptSoftStopErr = (1<<4), kMotSWOptStopMotorBlk = (1<<5), kMotSWOptCurrentCtrl = (1<<6), kMotSWOptDirectionInv = (1<<7)
}
enum  kMotErrorFlags {
  kMotErrorSampleTimeTooSmall = (1<<0), kMotErrorWDTOverflow = (1<<1), kMotErrorBrownOut = (1<<2), kMotErrorSoftStopMotor = (1<<3),
  kMotErrorMotorBlocked = (1<<4), kMotErrorPosOutOfRange = (1<<5), kMotErrorSpeedOutOfRange = (1<<6), kMotErrorTorqueOutOfRange = (1<<7)
}
enum  kMotStatusFlags {
  kMotStatusMoveDet = (1<<0), kMotStatusDir = (1<<1), kMotStatusOnSetPt = (1<<2), kMotStatusNearSetPt = (1<<3),
  kMotStatusCmdSat = (1<<4), kMotStatusWindup = (1<<5), kMotStatusSoftCurCtrl = (1<<6), kMotStatusSoftStop = (1<<7)
}

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_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_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_SetMargin (knet_dev_t *dev, int margin)
void kmot_GetSpeedMultiplier (knet_dev_t *dev, unsigned short *mult)
void kmot_SetSpeedMultiplier (knet_dev_t *dev, int mode)
void kmot_SetPrescale (knet_dev_t *dev, int mode)
void kmot_SetVelocityPrescale (knet_dev_t *dev, int mode)


Define Documentation

#define KMOT_ORDER_MASK

#define KMOT_REVISION ( ver   )     (ver&0xf)

Definition at line 22 of file kmot.h.

Referenced by kmot_ipFirmware(), main(), and revisionOS().

#define KMOT_VERSION ( ver   )     ((ver>>4)&0xf)

Definition at line 21 of file kmot.h.

Referenced by kmot_ipFirmware(), main(), and revisionOS().

#define MOT_Acceleration   0x52

Definition at line 100 of file kmot.h.

Referenced by kmot_SetSpeedProfile().

#define MOT_BlockedTime   0x46

Definition at line 85 of file kmot.h.

Referenced by kmot_SearchLimits(), and kmot_SetBlockedTime().

#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

Definition at line 40 of file kmot.h.

Referenced by kmot_GetStatus(), and kmot_ResetError().

#define MOT_Filter   0x33

Definition at line 48 of file kmot.h.

Referenced by kmot_SetFilterOrder().

#define MOT_FWVersion   0x00

Definition at line 33 of file kmot.h.

Referenced by kmot_GetFWVersion().

#define MOT_HWCurrentLimit   0x55

system (0..255)

Definition at line 105 of file kmot.h.

#define MOT_HWOptions   0x2A

Definition at line 37 of file kmot.h.

Referenced by kmot_GetOptions(), and kmot_SetOptions().

#define MOT_IntGenAmplitude   0x48

Definition at line 87 of file kmot.h.

Referenced by kmot_SetPointSource().

#define MOT_IntGenOffset   0x49

Definition at line 88 of file kmot.h.

Referenced by kmot_SetPointSource().

#define MOT_IntGenPeriod   0x47

Definition at line 86 of file kmot.h.

Referenced by kmot_SetPointSource().

#define MOT_KdPosH   0x64

Definition at line 126 of file kmot.h.

#define MOT_KdPosL   0x63

Definition at line 125 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KdSpeedH   0x41

Definition at line 77 of file kmot.h.

#define MOT_KdSpeedL   0x40

Definition at line 76 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KdTorqueH   0x6A

Definition at line 135 of file kmot.h.

#define MOT_KdTorqueL   0x69

Definition at line 134 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KiPosH   0x66

Definition at line 129 of file kmot.h.

#define MOT_KiPosL   0x65

Definition at line 128 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KiSpeedH   0x43

Definition at line 80 of file kmot.h.

#define MOT_KiSpeedL   0x42

Definition at line 79 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KiTorqueH   0x6C

Definition at line 138 of file kmot.h.

#define MOT_KiTorqueL   0x6B

Definition at line 137 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KpPosH   0x62

Definition at line 123 of file kmot.h.

#define MOT_KpPosL   0x61

Definition at line 122 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KpSpeedH   0x3F

Definition at line 74 of file kmot.h.

#define MOT_KpSpeedL   0x3E

Definition at line 73 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_KpTorqueH   0x68

Definition at line 132 of file kmot.h.

#define MOT_KpTorqueL   0x67

Definition at line 131 of file kmot.h.

Referenced by kmot_ConfigurePID().

#define MOT_MaxSpeedH   0x6E

Definition at line 141 of file kmot.h.

#define MOT_MaxSpeedL   0x6D

Definition at line 140 of file kmot.h.

Referenced by kmot_SetSpeedProfile().

#define MOT_MinSampleTimeH   0x59

the Interrup Service Routine

Definition at line 111 of file kmot.h.

#define MOT_MinSampleTimeL   0x58

Definition at line 112 of file kmot.h.

#define MOT_MinSpeedH   0x5F

Definition at line 118 of file kmot.h.

#define MOT_MinSpeedL   0x5E

Definition at line 117 of file kmot.h.

Referenced by kmot_SetMinSpeed().

#define MOT_Mode   0x28

#define MOT_NearTargetMargin   0x60

Definition at line 120 of file kmot.h.

Referenced by kmot_SetMargin().

#define MOT_PID_OUTH   0x5D

Definition at line 114 of file kmot.h.

#define MOT_PID_OUTL   0x5C

Definition at line 115 of file kmot.h.

#define MOT_PositionHH   0x37

Definition at line 53 of file kmot.h.

#define MOT_PositionHL   0x36

Definition at line 52 of file kmot.h.

#define MOT_PositionLH   0x35

Definition at line 51 of file kmot.h.

#define MOT_PositionLL   0x34

Definition at line 50 of file kmot.h.

Referenced by kmot_GetMeasure(), and kmot_SetPosition().

#define MOT_Prescale   0x70

Definition at line 143 of file kmot.h.

Referenced by kmot_SetPrescale().

#define MOT_SampleTimeH   0x45

Definition at line 83 of file kmot.h.

Referenced by kmot_SetSampleTime().

#define MOT_SampleTimeL   0x44

Definition at line 82 of file kmot.h.

Referenced by kmot_SetSampleTime().

#define MOT_SetPointHH   0x32

Definition at line 46 of file kmot.h.

#define MOT_SetPointHL   0x31

Definition at line 45 of file kmot.h.

#define MOT_SetPointLH   0x30

Definition at line 44 of file kmot.h.

#define MOT_SetPointLL   0x2F

Definition at line 43 of file kmot.h.

Referenced by kmot_SearchLimits(), and kmot_SetPoint().

#define MOT_SetPointSource   0x29

Definition at line 36 of file kmot.h.

Referenced by kmot_SetPoint(), and kmot_SetPointSource().

#define MOT_SoftStopMaxHH   0x51

Definition at line 98 of file kmot.h.

#define MOT_SoftStopMaxHL   0x50

Definition at line 97 of file kmot.h.

#define MOT_SoftStopMaxLH   0x4F

Definition at line 96 of file kmot.h.

#define MOT_SoftStopMaxLL   0x4E

Definition at line 95 of file kmot.h.

Referenced by kmot_SearchLimits(), and kmot_SetLimits().

#define MOT_SoftStopMinHH   0x4D

Definition at line 93 of file kmot.h.

#define MOT_SoftStopMinHL   0x4C

Definition at line 92 of file kmot.h.

#define MOT_SoftStopMinLH   0x4B

Definition at line 91 of file kmot.h.

#define MOT_SoftStopMinLL   0x4A

Definition at line 90 of file kmot.h.

Referenced by kmot_SearchLimits(), and kmot_SetLimits().

#define MOT_SpeedHL   0x39

Definition at line 56 of file kmot.h.

#define MOT_SpeedLL   0x38

Definition at line 55 of file kmot.h.

Referenced by kmot_GetMeasure().

#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_StaticFriction   0x54

Definition at line 103 of file kmot.h.

#define MOT_StatusFlags   0x2E

Definition at line 41 of file kmot.h.

Referenced by kmot_GetStatus().

#define MOT_SWCurrentLimitH   0x57

Definition at line 109 of file kmot.h.

#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

Definition at line 38 of file kmot.h.

Referenced by kmot_GetOptions(), and kmot_SetOptions().

#define MOT_TorqueBiasH   0x3D

Definition at line 71 of file kmot.h.

#define MOT_TorqueBiasL   0x3C

Definition at line 70 of file kmot.h.

#define MOT_TorqueH   0x3B

Definition at line 67 of file kmot.h.

#define MOT_TorqueL   0x3A

Definition at line 66 of file kmot.h.

Referenced by kmot_GetMeasure().

#define MOT_Unused   0x53

speed profile (0..255)

Definition at line 102 of file kmot.h.

#define MOT_VelocityPrescaler   0x73

Definition at line 149 of file kmot.h.

Referenced by kmot_SetVelocityPrescale().


Enumeration Type Documentation

Enumerator:
kMotErrorSampleTimeTooSmall 
kMotErrorWDTOverflow  Sample Time Too Small
kMotErrorBrownOut  WatchDog Timer Overflow
kMotErrorSoftStopMotor  Brown-Out
kMotErrorMotorBlocked  Software stopped Motor
kMotErrorPosOutOfRange  Motor Blocked
kMotErrorSpeedOutOfRange  Position Out Of Range
kMotErrorTorqueOutOfRange  Speed Out Of Range

Definition at line 239 of file kmot.h.

Enumerator:
kMotHWOptIdle 
kMotHWOptNormal  Idle Mode
kMotHWOptAnSetPtInEn  Normal Control Mode
kMotHWOptLed  Analog SetPoint Input
kMotHWOptEncRes4x  Led (0=Dis,1=En)
kMotHWOptEncRes1x  Encoder 4x Resolution
kMotHWOptTorqueInv  Encoder 1x Resolution
kMotHWOptDriverOpt1  Torque Inversion
kMotHWOptDriverOpt2  Driver Option 1
kMotHWOptDriverOpt3  Driver Option 2

Definition at line 207 of file kmot.h.

Enumerator:
kMotMesPos 
kMotMesSpeed  Position
kMotMesCurrent  Speed
kMotMesTorque  Current

Definition at line 184 of file kmot.h.

enum kMotMode

Enumerator:
kMotModeIdle 
kMotModeNormal  Idle
kMotModeStopMotor  Normal Control Mode
kMotModeSleep  Stop Motor
kMotModeReset  Sleep
kMotModeSaveE2PROM  Reset
kMotModeSearchLimit  Save Config Param in E2PROM

Definition at line 155 of file kmot.h.

Enumerator:
kMotPtSrcExtI2C 
kMotPtSrcExtAnalog  External IC
kMotPtSrcSquare  External Analog - not implemented
kMotPtSrcTriangle  Internal Square Wave Generator
kMotPtSrcSinus  Internal Triangle Generator

Definition at line 195 of file kmot.h.

Enumerator:
kMotRegOpenLoop 
kMotRegPos  Open Loop
kMotRegPosProfile  Position
kMotRegSpeed  Position Profile
kMotRegSpeedProfile  Speed
kMotRegCurrent  Speed Profile
kMotRegTorque  Current
kMotRegZeroFriction  Torque

Definition at line 169 of file kmot.h.

Enumerator:
kMotStatusMoveDet 
kMotStatusDir  Movement detected
kMotStatusOnSetPt  Direction (0:Neg, 1:Pos)
kMotStatusNearSetPt  On Set Point
kMotStatusCmdSat  Near Set Point
kMotStatusWindup  Command Saturated
kMotStatusSoftCurCtrl  Antireset Windup
kMotStatusSoftStop  Sofware Current Control Active

Definition at line 254 of file kmot.h.

Enumerator:
kMotSWOptSepD 
kMotSWOptWindup  Seperate D
kMotSWOptSoftStopMin  Antireset Windup
kMotSWOptSoftStopMax  SoftStop MIN
kMotSWOptSoftStopErr  SoftStop MAX
kMotSWOptStopMotorBlk  Error on SoftStop
kMotSWOptCurrentCtrl  Stop Motor when blocked
kMotSWOptDirectionInv  Current Control by Soft.

Definition at line 224 of file kmot.h.


Function Documentation

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

Parameters:
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().

Here is the call graph for this function:

void kmot_GetFWVersion ( knet_dev_t dev,
unsigned int *  version 
)

This function get the firmware version and revision number.

Parameters:
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().

Here is the call graph for this function:

long kmot_GetMeasure ( knet_dev_t dev,
int  regtype 
)

This function read a measure from a given motor.

Parameters:
dev K-Net Device Descriptor
regtype Type of regulation
Returns:
the measured position or torque depending on the 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().

Here is the call graph for this function:

void kmot_GetOptions ( knet_dev_t dev,
unsigned char *  software,
unsigned char *  hardware 
)

This function gets the software options and hardware options.

Parameters:
dev K-Net Device Descriptor
software Software Options
hardware Hardware Options
Software Options:

  • bit 0 : Use alternate algorithm PID derivation. The derivate part is calculated using the process variable rather than the error
  • bit 1 : Activate the anti reset windup routine
  • bit 2 : Stop the motor if the min position is reached
  • bit 3 : Stop the motor if the max position is reached
  • bit 4 : Generate an error when position is out of limits, in this case the error must be re- seted before any further commands can be executed.
  • bit 5 : Stop the motor if the blocked condition is met
  • bit 6 : Activate software current limitation (Not implemented)
  • bit 7 : Invert the motor direction

Hardware Options:

  • bit 0 : Startup mode (0 = idle mode, 1 = control mode)
  • bit 1 : Use analog input for setpoint (Not Implemented)
  • bit 2 : Not Implemented
  • bit 3 : Resolution for the encoder (0 = 100%, 1 = 25%)
  • bit 4 : Invert the internal current measurement
  • bit 5 : Not Implemented
  • bit 6 : Not Implemented
  • bit 7 : Not Implemented

Definition at line 218 of file kmot.c.

References knet_read8(), MOT_HWOptions, and MOT_SWOptions.

Referenced by option().

Here is the call graph for this function:

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.

void kmot_GetStatus ( knet_dev_t dev,
unsigned char *  status,
unsigned char *  error 
)

This function gets the status flags and error flags.

Parameters:
dev K-Net Device Descriptor
status Status Flags
error Error Flags
Error Flags:

  • bit 0 : Sample time too small
  • bit 1 : Watchdog timer overflow
  • bit 2 : Brown-out
  • bit 3 : Software stoped motor (if softstop enabled)
  • bit 4 : Motor blocked (if motorblock enabled)
  • bit 5 : Position out of range
  • bit 6 : Speed out of range
  • bit 7 : Torque out of range

Status flags:

  • bit 0 : Movement detected
  • bit 1 : Direction 0=negative 1=positive
  • bit 2 : On setpoint
  • bit 3 : Near setpoint
  • bit 4 : Command saturated
  • bit 5 : Antireset windup active
  • bit 6 : Software current control active
  • bit 7 : Softstop active

Definition at line 141 of file kmot.c.

References knet_read8(), MOT_ErrorFlags, and MOT_StatusFlags.

Referenced by kmot_ipStatus(), main(), and status().

Here is the call graph for this function:

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.

Parameters:
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().

Here is the call graph for this function:

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.

Parameters:
dev K-Net Device Descriptor corresponding to the motor

Definition at line 609 of file kmot.c.

References kMotModeSaveE2PROM, knet_write8(), and MOT_Mode.

Here is the call graph for this function:

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.

Parameters:
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
Returns:
A value:
  • -1 on timeout
  • 0 on success

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().

Here is the call graph for this function:

void kmot_SetBlockedTime ( knet_dev_t dev,
int  time 
)

kmot_SetBlockedTime -

Parameters:
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().

Here is the call graph for this function:

void kmot_SetFilterOrder ( knet_dev_t dev,
int  order 
)

kmot_SetFilterOrder -

Parameters:
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.

Here is the call graph for this function:

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.

Parameters:
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().

Here is the call graph for this function:

void kmot_SetMargin ( knet_dev_t dev,
int  margin 
)

kmot_SetMargin -

Parameters:
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().

Here is the call graph for this function:

void kmot_SetMode ( knet_dev_t dev,
int  mode 
)

kmot_SetMode -

Parameters:
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().

Here is the call graph for this function:

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.

Parameters:
dev K-Net Device Descriptor to the corresponding motor
hwOptions Hardware Option Flags
swOptions Software Option Flags
Software Option Flags:

  • kMotSWOptSepD : use alternate algorithm PID derivation
  • kMotSWOptWindup : activate the anti reset windup routine
  • kMotSWOptSoftStopMin : stop the motor if the min position is reached
  • kMotSWOptSoftStopMax : stop the motor if the max position is reached
  • kMotSwOptStopErr : generate an error when position is out of limits in this case the error must be rested before any further commands can be executed
  • kMotSWOptStopMotorBlk : stop the motor if the blocked condition is met (No movement, and current over the limit for the blocked time period).
  • kMotSWOptCurrentCtrl : activate software current limitation (Not implemented)
  • kMotSWOptDirectionInv : invert the motor direction

Hardware Option Flags:

  • kMotHWOptIdle : Idle Startup Mode
  • kMotHWOptNormal : Normal Control Startup Mode
  • kMotHWOptAnSetPtInEn : use analog input for setpoint (Not Implemented)
  • kMotHWOptLed : Not Implemented
  • kMotHWOptEncRes4x : 4x 100% resolution for the encoder
  • kMotHWOptEncRes1x : 1x 25% resolution for the encoder
  • kMotHWOptTorqueInv : invert the internal current measurement
  • kMotHWOptDriverOpt1 : Not Implemented
  • kMotHWOptDriverOpt2 : Not Implemented
  • kMotHWOptDriverOpt3 : Not Implemented

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().

Here is the call graph for this function:

void kmot_SetPoint ( knet_dev_t dev,
int  regtype,
long  setPoint 
)

This function sets a given target point for a given motor.

Parameters:
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().

Here is the call graph for this function:

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.

Parameters:
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().

Here is the call graph for this function:

void kmot_SetPosition ( knet_dev_t dev,
long  position 
)

This function sets the position counter to the given value for a given motor.

Parameters:
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().

Here is the call graph for this function:

void kmot_SetPrescale ( knet_dev_t dev,
int  mode 
)

kmot_SetPrescale -

Parameters:
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().

Here is the call graph for this function:

void kmot_SetSampleTime ( knet_dev_t dev,
int  sample 
)

kmot_SetSampleTime -

Parameters:
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().

Here is the call graph for this function:

void kmot_SetSpeedMultiplier ( knet_dev_t dev,
int  mode 
)

kmot_SetSpeedMultiplier -

Parameters:
dev KNet Device Descriptor corresponding to the motor
prescale 

Definition at line 700 of file kmot.c.

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.

Parameters:
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().

Here is the call graph for this function:

void kmot_SetVelocityPrescale ( knet_dev_t dev,
int  mode 
)

kmot_SetVelocityPrescale -

Parameters:
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().

Here is the call graph for this function:


Generated on Wed Dec 15 11:49:29 2010 for KoreBot Library by  doxygen 1.5.5