Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
openinterface.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/select.h>
#include "openinterface.h"
#include "config.h"
#include "def.h"
#include "general.h"

Go to the source code of this file.

Functions

openinterface_topeninterface_open (char *device_path)
 
int openinterface_close (openinterface_t *ois)
 
int openinterface_start (openinterface_t *ois)
 
int openinterface_full (openinterface_t *ois)
 
int openinterface_drive (openinterface_t *ois, int velocity, int radius)
 
int openinterface_drive_direct (openinterface_t *ois, int right, int left)
 
int openinterface_sensor_get (openinterface_t *ois, const unsigned char id, const unsigned char len, unsigned char *data)
 
int openinterface_sensors_update (openinterface_t *ois, const unsigned int sensor_id, const unsigned int size)
 
int openinterface_distance_get (openinterface_t *ois)
 
int openinterface_angle_get (openinterface_t *ois)
 
int openinterface_LEDs (openinterface_t *ois, int play, int advance, unsigned char power_color, unsigned char power_intensity)
 

Detailed Description

Author
Eriks Zaharans
Version
1.0

DESCRIPTION

Open Interface library.

Definition in file openinterface.c.

Function Documentation

int openinterface_angle_get ( openinterface_t ois)

Get change of angle

Parameters
opisPointer to OpenInterface structure
Returns
change of angle (degree)

Definition at line 320 of file openinterface.c.

int openinterface_close ( openinterface_t ois)

Close OpenInterface connection

Parameters
opisPointer to openInterface structure
Returns
s_OK if successful, s_ERROR if failed

Definition at line 63 of file openinterface.c.

int openinterface_distance_get ( openinterface_t ois)

Get travelled distance

Parameters
opisPointer to OpenInterface structure
Returns
travelled distance (mm)

Definition at line 301 of file openinterface.c.

int openinterface_drive ( openinterface_t ois,
int  velocity,
int  radius 
)

Sends Drive Command

Parameters
opisPointer to OpenInterface structure
velocityDrive velocity
radiusRadius of circle (curve)
Returns
s_OK if successful, s_ERROR if failed

Definition at line 119 of file openinterface.c.

int openinterface_drive_direct ( openinterface_t ois,
int  right,
int  left 
)

Sends Direct Drive Command

Parameters
opisPointer to OpenInterface structure
rightRight wheel velocity
leftleft wheel velocity
Returns
s_OK if successful, s_ERROR if failed

Definition at line 150 of file openinterface.c.

int openinterface_full ( openinterface_t ois)

Enable full control of OpenInterface

Parameters
opisPointer to OpenInterface structure
Returns
s_OK if successful, s_ERROR if failed

Definition at line 103 of file openinterface.c.

int openinterface_LEDs ( openinterface_t ois,
int  play,
int  advance,
unsigned char  power_color,
unsigned char  power_intensity 
)

Control LEDs

Parameters
opisPointer to OpenInterface structure
playLight up PLAY LED (0 - off, 1 - on)
advanceLight up ADVANCE LED (0 - off, 1 - on)
power_colorColor of POWER LED (0 - green, 255 - red, intermediate values - intermediate colors)
power_intensityIntensity of POWER LED (0-255)
Returns
s_OK if successful, s_ERROR if failed

Definition at line 343 of file openinterface.c.

openinterface_t* openinterface_open ( char *  device_path)

Open OpenInterface connection

Parameters
device_pathPath to device
Returns
Pointer to openInterface structure

Definition at line 35 of file openinterface.c.

int openinterface_sensor_get ( openinterface_t ois,
const unsigned char  id,
const unsigned char  len,
unsigned char *  data 
)

Get one sensor request readings

Parameters
opisPointer to OpenInterface structure
idID of the sensor packet
lenNumber of bytes to be read
dataPonter to memory where to store data
Returns
s_OK if successful, s_ERROR if failed

Definition at line 182 of file openinterface.c.

int openinterface_sensors_update ( openinterface_t ois,
const unsigned int  sensor_id,
const unsigned int  size 
)

Updates all sensor data

Parameters
opisPointer to OpenInterface structure
oissPointer to OpenInterface sensor structure
sensor_idID of sensor packet
sizeNumber of bytes in sensor packet
Returns
s_OK if successful, s_ERROR if failed

Definition at line 231 of file openinterface.c.

int openinterface_start ( openinterface_t ois)

Start OpenInterface connection

Parameters
opisPointer to OpenInterface structure
Returns
s_OK if successful, s_ERROR if failed

Definition at line 89 of file openinterface.c.