kmotLE_test.c File Reference

Include dependency graph for kmotLE_test.c:

Go to the source code of this file.

Defines

#define timercpy(a, b)

Functions

static void ctrlc_handler (int sig)
int quit (int argc, char *argv[], void *data)
int stop (int argc, char *argv[], void *data)
int setsampletime (int argc, char *argv[], void *data)
int configspeedprofile (int argc, char *argv[], void *data)
int setpid (int argc, char *argv[], void *data)
void * kmot_log_task (void *arg)
int stoplog (int argc, char *argv[], void *data)
int startlog (int argc, char *argv[], void *data)
int init (int argc, char *argv[], void *data)
int setspeed (int argc, char *argv[], void *data)
int setspeedprofile (int argc, char *argv[], void *data)
int velprescaler (int argc, char *argv[], void *data)
int prescaler (int argc, char *argv[], void *data)
int setmultiplier (int argc, char *argv[], void *data)
int multiplier (int argc, char *argv[], void *data)
int settorque (int argc, char *argv[], void *data)
int openloop (int argc, char *argv[], void *data)
int setpos (int argc, char *argv[], void *data)
int moveat (int argc, char *argv[], void *data)
int moveatprofile (int argc, char *argv[], void *data)
int measure (int argc, char *argv[], void *data)
int test (int argc, char *argv[], void *data)
int statusclear (int argc, char *argv[], void *data)
int setoption (int argc, char *argv[], void *data)
int option (int argc, char *argv[], void *data)
int status (int argc, char *argv[], void *data)
int help (int argc, char *argv[], void *data)
int main (int argc, char *argv[])
void kmot_GetSpeedMultiplier (knet_dev_t *dev, unsigned short *mult)
void kmot_SetSpeedMultiplier (knet_dev_t *dev, int mode)

Variables

static int quitReq = 0
static int stopReq = 0
static int currentCommand = 0
static FILE * logfile
static knet_dev_tmotor
static pthread_t log_task
static kb_command_t cmds []
static char buf [1024]


Define Documentation

#define timercpy ( a,
 ) 

Value:

(a)->tv_sec = (b)->tv_sec; \
 (a)->tv_usec = (b)->tv_usec;

Definition at line 135 of file kmotLE_test.c.


Function Documentation

int configspeedprofile ( int  argc,
char *  argv[],
void *  data 
)

Set the speed profile for the current controller. The speed profile is only used for the regSpeedProfile mode (refer to KoreMotor documentation). syntax: setspeedprofile <max speed>=""> <acceleration>

Definition at line 82 of file kmotLE_test.c.

References kmot_SetSpeedProfile().

Here is the call graph for this function:

static void ctrlc_handler ( int  sig  )  [static]

Make sure the program terminate properly on a ctrl-c

Definition at line 43 of file kmotLE_test.c.

References stopReq.

int help ( int  argc,
char *  argv[],
void *  data 
)

Display a list of available commands.

Definition at line 453 of file koala_GoAutomation.c.

int init ( int  argc,
char *  argv[],
void *  data 
)

Initialize all the parameters for the current controller. This command must be called before using any other command, and the parameters should be modified for the type of motors and encoder used before using the program.

Definition at line 227 of file kmotLE_test.c.

References kmot_ConfigurePID(), kmot_ResetError(), kmot_SetBlockedTime(), kmot_SetLimits(), kmot_SetMargin(), kmot_SetMode(), kmot_SetOptions(), kmot_SetSampleTime(), kmot_SetSpeedProfile(), kMotModeIdle, kMotRegCurrent, kMotRegPos, kMotRegSpeed, kMotSWOptStopMotorBlk, and kMotSWOptWindup.

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_log_task ( void *  arg  ) 

The data logging task

Definition at line 142 of file kmotLE_test.c.

References currentCommand, kmot_GetMeasure(), kMotMesCurrent, kMotMesPos, kMotMesSpeed, logfile, position, and timercpy.

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.

int main ( int  argc,
char *  argv[] 
)

int measure ( int  argc,
char *  argv[],
void *  data 
)

Get a set of measures from the current motor. This control returns the speed, position and current for the motor.

Definition at line 425 of file kmotLE_test.c.

References kmot_GetMeasure(), kMotMesCurrent, kMotMesPos, and kMotMesSpeed.

Here is the call graph for this function:

int moveat ( int  argc,
char *  argv[],
void *  data 
)

Set a new position regulation target for the current motor. The position will be reached using the speed profile and speed PID. The controller must be properly initialized before using regulation. syntax: setpos <target position>="">

Definition at line 392 of file kmotLE_test.c.

References currentCommand, kmot_SetPoint(), and kMotRegPos.

Here is the call graph for this function:

int moveatprofile ( int  argc,
char *  argv[],
void *  data 
)

Set a new position regulation target for the current motor. The position will be reached using the speed profile and speed PID. The controller must be properly initialized before using regulation. syntax: setpos <target poistion>="">

Definition at line 410 of file kmotLE_test.c.

References currentCommand, kmot_SetPoint(), and kMotRegPosProfile.

Here is the call graph for this function:

int multiplier ( int  argc,
char *  argv[],
void *  data 
)

Get the speed multiplier for the current motor. The controller must be properly initialized before using regulation. syntax: getmultiplier

Definition at line 334 of file kmotLE_test.c.

References kmot_GetSpeedMultiplier().

Here is the call graph for this function:

int openloop ( int  argc,
char *  argv[],
void *  data 
)

Set a new open loop command for the current motor. The controller must be properly initialized. syntax: openloop <command>

Definition at line 363 of file kmotLE_test.c.

References currentCommand, kmot_SetPoint(), and kMotRegOpenLoop.

Here is the call graph for this function:

int option ( int  argc,
char *  argv[],
void *  data 
)

Read and print the option settings of the current controller. The content of the software option register and the hardware option register will be displayed.

Definition at line 507 of file kmotLE_test.c.

References kmot_GetOptions(), kMotHWOptAnSetPtInEn, kMotHWOptEncRes1x, kMotHWOptNormal, kMotHWOptTorqueInv, kMotSWOptSepD, kMotSWOptSoftStopErr, kMotSWOptSoftStopMax, kMotSWOptSoftStopMin, kMotSWOptStopMotorBlk, and kMotSWOptWindup.

Here is the call graph for this function:

int prescaler ( int  argc,
char *  argv[],
void *  data 
)

Set a new speed prescaler for the current motor. The controller must be properly initialized before using regulation. syntax: prescaler <value[0..3]>

Definition at line 305 of file kmotLE_test.c.

References currentCommand, and kmot_SetPrescale().

Here is the call graph for this function:

int quit ( int  argc,
char *  argv[],
void *  data 
)

Quit the program.

Definition at line 51 of file kmotLE_test.c.

References quitReq.

int setmultiplier ( int  argc,
char *  argv[],
void *  data 
)

Set a new speed multiplierr for the current motor. The controller must be properly initialized before using regulation. syntax: multiplier <value[1..32768]>

Definition at line 319 of file kmotLE_test.c.

References currentCommand, and kmot_SetSpeedMultiplier().

Here is the call graph for this function:

int setoption ( int  argc,
char *  argv[],
void *  data 
)

Set the controller Software and Hardware options. Check the kmot.c documentation for details about option flags. Syntax: setoption <hardware> <software>

Definition at line 492 of file kmotLE_test.c.

References kmot_SetOptions().

Here is the call graph for this function:

int setpid ( int  argc,
char *  argv[],
void *  data 
)

Set the PID controller gains for the given motor. syntax: setpid <regulation type>=""> <Kp> <Ki> <Kd>

regulation types are: pos, posprofile, speed, speedprofile, and torque.

Definition at line 99 of file kmotLE_test.c.

References kmot_ConfigurePID(), kMotRegPos, kMotRegPosProfile, kMotRegSpeed, kMotRegSpeedProfile, and kMotRegTorque.

Here is the call graph for this function:

int setpos ( int  argc,
char *  argv[],
void *  data 
)

Set a new position regulation target for the current motor. The controller must be properly initialized before using regulation. syntax: setpos <target position>="">

Definition at line 378 of file kmotLE_test.c.

References kmot_SetPosition().

Here is the call graph for this function:

int setsampletime ( int  argc,
char *  argv[],
void *  data 
)

Set the SampleTime register (refer to KoreMotor documentation). syntax: setsampletime <sampletime>

Definition at line 68 of file kmotLE_test.c.

References kmot_SetSampleTime().

Here is the call graph for this function:

int setspeed ( int  argc,
char *  argv[],
void *  data 
)

Set a new speed regulation target for the current motor. The controller must be properly initialized before using regulation. syntax: setspeed <target speed>="">

Definition at line 252 of file kmotLE_test.c.

References currentCommand, kmot_SetPoint(), and kMotRegSpeed.

Here is the call graph for this function:

int setspeedprofile ( int  argc,
char *  argv[],
void *  data 
)

Set a new position regulation target for the current motor. The position will be reached using the speed profile and speed PID. The controller must be properly initialized before using regulation. syntax: setpos <target poistion>="">

Definition at line 268 of file kmotLE_test.c.

References currentCommand, kmot_SetPoint(), and kMotRegSpeedProfile.

Here is the call graph for this function:

int settorque ( int  argc,
char *  argv[],
void *  data 
)

Set a new torque regulation target for the current motor. The controller must be properly initialized before using regulation. syntax: settorque <target torque>="">

Definition at line 349 of file kmotLE_test.c.

References currentCommand, kmot_SetPoint(), and kMotRegTorque.

Here is the call graph for this function:

int startlog ( int  argc,
char *  argv[],
void *  data 
)

Start logging motor measurements to the given file.

Definition at line 204 of file kmotLE_test.c.

References KB_ERROR_PTHREAD, KB_FATAL, kmot_log_task(), and log_task.

Here is the call graph for this function:

int status ( int  argc,
char *  argv[],
void *  data 
)

Read and print the status of the current controller. The content of the status register and error register will be displayed.

Definition at line 556 of file kmotLE_test.c.

References kmot_GetStatus(), kMotErrorBrownOut, kMotErrorMotorBlocked, kMotErrorPosOutOfRange, kMotErrorSampleTimeTooSmall, kMotErrorSoftStopMotor, kMotErrorSpeedOutOfRange, kMotErrorTorqueOutOfRange, kMotErrorWDTOverflow, kMotStatusCmdSat, kMotStatusDir, kMotStatusMoveDet, kMotStatusNearSetPt, kMotStatusOnSetPt, kMotStatusSoftCurCtrl, kMotStatusSoftStop, kMotStatusWindup, and status().

Here is the call graph for this function:

int statusclear ( int  argc,
char *  argv[],
void *  data 
)

Reset the error register of the motor controller.

Definition at line 482 of file kmotLE_test.c.

References kmot_ResetError().

Here is the call graph for this function:

int stop ( int  argc,
char *  argv[],
void *  data 
)

Stop the current motor (set mode to stop motor mode).

Definition at line 59 of file kmotLE_test.c.

References kmot_SetMode(), and kMotModeStopMotor.

Here is the call graph for this function:

int stoplog ( int  argc,
char *  argv[],
void *  data 
)

Stop logging motor measurements.

Definition at line 193 of file kmotLE_test.c.

References KB_ERROR_PTHREAD, KB_FATAL, and log_task.

int test ( int  argc,
char *  argv[],
void *  data 
)

Launch a test routine which oscillates from (current pos + delta) and (current pos - delta). The position changes every 2 seconds. The routine can be stoped using the "stop" command. syntax: test <delta>

Definition at line 444 of file kmotLE_test.c.

References kmot_GetMeasure(), kmot_SetPoint(), kMotMesPos, kMotRegPos, status(), and stopReq.

Here is the call graph for this function:

int velprescaler ( int  argc,
char *  argv[],
void *  data 
)

Set a new velocity reductionprescaler for the current motor. The controller must be properly initialized before using regulation. syntax: velprescaler <value[0..3]>

  • 0 = 1:1
  • 1 = 1:4
  • 2 = 1:16
  • 3 = 1:64

Definition at line 291 of file kmotLE_test.c.

References currentCommand, and kmot_SetVelocityPrescale().

Here is the call graph for this function:


Variable Documentation

char buf[1024] [static]

Main program to process the command line.

Definition at line 672 of file kmotLE_test.c.

kb_command_t cmds[] [static]

The command table contains: command name : min number of args : max number of args : the function to call

Definition at line 622 of file kmotLE_test.c.

int currentCommand = 0 [static]

Definition at line 34 of file kmotLE_test.c.

pthread_t log_task [static]

Definition at line 38 of file kmotLE_test.c.

FILE* logfile [static]

Definition at line 36 of file kmotLE_test.c.

knet_dev_t* motor [static]

Definition at line 37 of file kmotLE_test.c.

int quitReq = 0 [static]

Definition at line 32 of file kmotLE_test.c.

int stopReq = 0 [static]

Definition at line 33 of file kmotLE_test.c.


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