kh3moves.h File Reference

This file contains definitions needed to use movement functions for the robot. More...

#include "macros.h"
#include <korebot/korebot.h>

Include dependency graph for kh3moves.h:

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

Go to the source code of this file.

Defines

#define KH3_WHEELDIST   89.5
 Distance between khepera wheels in [mm].
#define KH3_ROBOTRADIUS   = 65.0
 Robot radius in [mm] - Khepera III is almost a perfect circle.

Functions

int kh3_mm2pulse (double dist)
 converts distance in millimeters to Khepera's pulses
void kh3_showMaskMsg (const unsigned char value, const unsigned char mask, const char *success, const char *failure)
 Shows a message, if a all bits given in the mask are set.
void kmot_SetDefaultSpeedProfile (knet_dev_t *mot)
 Sets the default speed profile we like.
int kh3_initMot (knet_dev_t *mot)
 Inits a motor by setting some default values.
int kh3_initRobot (void)
 Initialize the robot.
int kh3_motInfo (int showLeftMot, int showRightMot)
 Print information about left or right motor.
int kh3_moveRelative (int left, int right)
 Moves both wheels relative to the current position.
int kh3_forw (double left, double right)
 Move the robot forward.
int kh3_back (double left, double right)
 Move the robot backward.
int kh3_stop (void)
 Stop the motors.
int kh3_reset (void)
 Resets both motors (initializes them).
int kh3_speed (double lSpeed, double rSpeed)
 Set constant speed for motors.
int kh3_sideAwareSpeed (double innerSpeed, double outerSpeed, char guardSide)
 Sets the speed for the inner and outer wheel, according to the side the robot is following.
int kh3_sideAwareRotate (double angle, char guardSide)
 Rotatates the robot towards or away from the wall.
int kh3_left (double angle)
 Turn robot to the left, around its centre.
int kh3_right (double angle)
 Turn robot to the right, around its centre.
int kh3_arcLeft (double angle, double center)
 Let the robot walk on a left arc.
int kh3_arcRight (double angle, double center)
 Let the robot walk on a right arc.
int kh3_isMoving (void)
 Tells if the robot is currently moving.

Variables

knet_dev_t * dsPic
 Khepera's status information device.
knet_dev_t * lMot
 Khepera's left motor.
knet_dev_t * rMot
 Khepera's right motor.


Detailed Description

This file contains definitions needed to use movement functions for the robot.

Version:
Id
kh3moves.h,v 1.13 2008/09/18 12:59:02 prokop Exp

Definition in file kh3moves.h.


Define Documentation

#define KH3_ROBOTRADIUS   = 65.0

Robot radius in [mm] - Khepera III is almost a perfect circle.

Definition at line 36 of file kh3moves.h.

#define KH3_WHEELDIST   89.5

Distance between khepera wheels in [mm].

Definition at line 34 of file kh3moves.h.


Function Documentation

int kh3_arcLeft ( double  angle,
double  center 
)

Let the robot walk on a left arc.

Parameters:
angle rotation (walk) angle in degrees
center distance from robot's centre to the arc's centre
Returns:
0 on success, -1 on failure

Definition at line 480 of file kh3moves.c.

int kh3_arcRight ( double  angle,
double  center 
)

Let the robot walk on a right arc.

Parameters:
angle rotation (walk) angle in degrees
center distance from robot's centre to the arc's centre
Returns:
0 on success, -1 on failure

Definition at line 484 of file kh3moves.c.

int kh3_back ( double  left,
double  right 
)

Move the robot backward.

positions can be negative, in which case this function would be identical to "kh3_forw".

Parameters:
left Distance for the left motor in [mm]
right Distance for the right motor in [mm]
Returns:
0 on success, -1 on failure

Definition at line 290 of file kh3moves.c.

int kh3_forw ( double  left,
double  right 
)

Move the robot forward.

Parameters:
left Distance for the left motor in [mm]
right Distance for the right motor in [mm]
Returns:
0 on success, -1 on failure
positions can be negative, in which case this function would be identical to "kh3_back".

Definition at line 286 of file kh3moves.c.

int kh3_initMot ( knet_dev_t *  mot  ) 

Inits a motor by setting some default values.

Parameters:
mot Motor to initialize
Returns:
-1 on error, 0 on success

Definition at line 179 of file kh3moves.c.

int kh3_initRobot ( void   ) 

Initialize the robot.

This aquires the pointers to Khepera's PIC controllers motors, battery, sensors, etc.

Returns:
0 on success, -1 on init errors and -2 if Khepera's devices could not be found

Definition at line 224 of file kh3moves.c.

int kh3_isMoving ( void   ) 

Tells if the robot is currently moving.

Returns:
1 if the robots is moving, 0 if it stopped

Definition at line 488 of file kh3moves.c.

int kh3_left ( double  angle  ) 

Turn robot to the left, around its centre.

Parameters:
angle rotation angle in degrees
Returns:
0 on success, -1 on failure

Definition at line 362 of file kh3moves.c.

int kh3_mm2pulse ( double  dist  ) 

converts distance in millimeters to Khepera's pulses

Parameters:
dist distance in [mm]
Returns:
motor pulses corresponding to the distance This function is for internal use only.

Definition at line 67 of file kh3moves.c.

int kh3_motInfo ( int  showLeftMot,
int  showRightMot 
)

Print information about left or right motor.

Parameters:
showLeftMot show information about left motor (boolean)
showRightMot show information about right motor (boolean)
Returns:
1 on success, 0 on failure (e.g. uninitialized motor)

Definition at line 247 of file kh3moves.c.

int kh3_moveRelative ( int  left,
int  right 
)

Moves both wheels relative to the current position.

This is a helper function for almost every other move related function

Parameters:
left relative position for the left motor
right relative position for the right motor
Returns:
0 on success, -1 on failure

Definition at line 264 of file kh3moves.c.

int kh3_reset ( void   ) 

Resets both motors (initializes them).

Returns:
0 on success, -1 on failure

Definition at line 304 of file kh3moves.c.

int kh3_right ( double  angle  ) 

Turn robot to the right, around its centre.

Parameters:
angle rotation angle in degrees
Returns:
0 on success, -1 on failure

Definition at line 371 of file kh3moves.c.

void kh3_showMaskMsg ( const unsigned char  value,
const unsigned char  mask,
const char *  success,
const char *  failure 
)

Shows a message, if a all bits given in the mask are set.

Parameters:
value bit field in question
mask mask to apply to the bit field
success message which will be shown if the bit is set
failure message which will be shown if the bit is not set

Definition at line 71 of file kh3moves.c.

int kh3_sideAwareRotate ( double  angle,
char  guardSide 
)

Rotatates the robot towards or away from the wall.

Parameters:
angle The angle to go (in degrees). Positive values rotate the robot's front away from the wall, negative towards.
guardSide The side, one of GUARD_SIDE_LEFT or GUARD_SIDE_RIGHT
Returns:
0 on success or a negative value on failures

Definition at line 380 of file kh3moves.c.

int kh3_sideAwareSpeed ( double  innerSpeed,
double  outerSpeed,
char  guardSide 
) [inline]

Sets the speed for the inner and outer wheel, according to the side the robot is following.

Parameters:
innerSpeed speed for the inner wheel in [mm/s]
outerSpeed speed for the outer wheel in [mm/s]
guardSide guard's side, one of GUARD_SIDE_LEFT or GUARD_SIDE_RIGHT
Returns:
0 on success, a negative value on failure

Definition at line 348 of file kh3moves.c.

int kh3_speed ( double  lSpeed,
double  rSpeed 
)

Set constant speed for motors.

Parameters:
lSpeed Speed for the left motor [mm/s]
rSpeed Speed for the right motor [mm/s]
Returns:
0 on success, -1 on failure Speed is specified in millimeters pers second.

Definition at line 314 of file kh3moves.c.

int kh3_stop ( void   ) 

Stop the motors.

Returns:
0 on success, -1 on failure

Definition at line 294 of file kh3moves.c.

void kmot_SetDefaultSpeedProfile ( knet_dev_t *  mot  ) 

Sets the default speed profile we like.

Parameters:
mot motor for which the profile will be set

Definition at line 175 of file kh3moves.c.


Variable Documentation

knet_dev_t* dsPic

Khepera's status information device.

Khepera status device.

Definition at line 58 of file kh3moves.c.

knet_dev_t* lMot

Khepera's left motor.

Definition at line 60 of file kh3moves.c.

knet_dev_t* rMot

Khepera's right motor.

Definition at line 62 of file kh3moves.c.


Generated on Sun Sep 28 21:20:01 2008 for Guard by  doxygen 1.5.6