ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 4210

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

RoBIOS Library Functions

Semantics:

Set the given motors to the same given speed

QuadHandle QuadInit (DeviceSemantics semantics);

Input:

(semantics) semantic

Output:

(returncode) QuadHandle or 0 for error

Semantics:

Initialize given Quadrature-Decoder (up to 8 decoders are

possible)

int QuadRelease (QuadHandle handle);

Input:

(handle) sum of decoder-handles to be released

Output:

0 = ok

Semantics:

-1 = error wrong handle

Release one or more Quadrature-Decoder

int QuadReset (QuadHandle handle);

Input:

(handle) sum of decoder-handles to be reset

Output:

0 = ok

Semantics:

-1 = error wrong handle

Reset one or more Quadrature-Decoder

int QuadRead (QuadHandle handle);

Input:

(handle) ONE decoder-handle

Output:

32bit counter-value (0 to 2^32-1)

Semantics:

a wrong handle will ALSO result in an 0 counter-value!!

Read actual Quadrature-Decoder counter

DeviceSemantics QUADGetMotor (DeviceSemantics semantics);

Input:

(handle) ONE decoder-handle

Output:

semantic of the corresponding motor

Semantics:

0 = wrong handle

Get the semantic of the corresponding motor

float QUADODORead (QuadHandle handle);

Input:

(handle) ONE decoder-handle

Output:

meters since last odometer-reset

Semantics:

Get the distance from the last resetpoint of a single motor!

It is not the overall meters driven since the last reset!

It is just the nr of meters left to go back to the startpoint.

Useful to implement a PID-control

int QUADODOReset (QuadHandle handle);

Input:

(handle) sum of decoder-handles to be reset

Output:

0 = ok

Semantics:

-1 = error wrong handle

Resets the simple odometer(s) to define the startpoint

B.5.12 Driving Interface vZ

This is a high level wheel control API using the motor and quad primitives to drive the robot.

Data Types:

typedef float meterPerSec; typedef float radPerSec; typedef float meter; typedef float radians;

typedef struct

{meter x; meter y;

401


B RoBIOS Operating System

radians phi; } PositionType;

typedef struct

{meterPerSec v; radPerSec w;

} SpeedType;

VWHandle VWInit (DeviceSemantics semantics, int Timescale);

Input:

(semantics) semantic

Output:

(Timescale) prescale value for 100Hz IRQ (1 to ...)

(returncode) VWHandle or 0 for error

Semantics:

Initialize given VW-Driver (only 1 can be initialized!)

The motors and encoders are automatically reserved!!

The Timescale allows to adjust the tradeoff between

accuracy (scale=1, update at 100Hz) and speed(scale>1,

update at 100/scale Hz).

int VWRelease (VWHandle

handle);

Input:

(handle) VWHandle to be released

Output:

0 = ok

Semantics:

-1 = error wrong handle

Release

VW-Driver, stop motors

int VWSetSpeed (VWHandle handle, meterPerSec v, radPerSec w);

Input:

(handle) ONE VWHandle

(v) new

linear speed

Output:

(w) new

rotation speed

0 = ok

Semantics:

-1 = error wrong handle

Set the

new speed: v(m/s) and w(rad/s not degree/s)

int VWGetSpeed (VWHandle handle, SpeedType* vw);

Input:

(handle) ONE VWHandle

Output:

(vw) pointer to record to store actual v, w values

0 = ok

Semantics:

-1 = error wrong handle

Get the

actual speed: v(m/s) and w(rad/s not degree/s)

int VWSetPosition (VWHandle handle, meter x, meter y, radians phi); Input: (handle) ONE VWHandle

(x)new x-position

(y)new y-position (phi) new heading

Output:

0

= ok

Semantics:

-1 = error wrong handle

Set the

new position: x(m), y(m) phi(rad not degree)

int VWGetPosition (VWHandle handle, PositionType* pos);

Input:

(handle) ONE VWHandle

Output:

(pos) pointer to record to store actual position (x,y,phi)

0

= ok

Semantics:

-1

= error wrong handle

Get the

actual position: x(m), y(m) phi(rad not degree)

int VWStartControl (VWHandle handle, float Vv, float Tv, float Vw, float Tw);

Input:

(handle)

ONE VWHandle

(Vv) the

parameter for the proportional component of the

v-controller

(Tv) the

parameter for the integrating component of the

v-controller

(Vw) the

parameter for the proportional component of the

w-controller

(Tv) the

parameter for the integrating component of the

w-controller

402


RoBIOS Library Functions

Output:

0 = ok

Semantics:

-1 = error wrong handle

Enable the PI-controller for the vw-interface and set

the parameters.

As default the PI-controller is deactivated when the

vw-interface is initialized. The controller tries to keep the

desired speed (set with VWSetSpeed) stable by adapting the

energy of the involved motors.

The parameters for the controller have to be choosen carefully!

The formula for the controller is:

t

new(t) = V*(diff(t) + 1/T * ³diff(t)dt )

0

V: a value usually around 1.0

T: a value usually between 0 and 1.0

After enabling the controller the last set speed (VWSetSpeed)

is taken as the speed to be held stable.

int VWStopControl (VWHandle handle);

Input:

(handle) ONE VWHandle

Output:

0 = ok

Semantics:

-1 = error wrong handle

Disable the controller immediately. The vw-interface continues

normally with the last valid speed of the controller.

int VWDriveStraight (VWHandle handle, meter delta, meterpersec v) Input: (handle) ONE VWHandle

(delta) distance to drive in m (pos. -> forward) (neg. -> backward)

Output:

(v)

speed to drive with (always positive!)

0 = ok

Semantics:

-1 = error wrong handle

Drives distance "delta" with speed v straight ahead

(forward or backward).

Any subsequent call of VWDriveStraight, -Turn, -Curve or

VWSetSpeed, while this one is still being executed, results in

an immediate interruption of this command

int VWDriveTurn (VWHandle handle, radians delta, radPerSec w)

Input:

(handle)

ONE VWHandle

(delta)

degree to turn in radians (pos. -> counter-clockwise)

(w)

(neg. -> clockwise)

Output:

speed to turn with (always positive!)

0 = ok

Semantics:

-1 = error wrong handle

turns about "delta" with speed w on the spot (clockwise

or counter-clockwise)

any subsequent call of VWDriveStraight, -Turn, -Curve or

VWSetSpeed, while this one is still being executed, results in

an immediate interruption

of this command

int VWDriveCurve (VWHandle handle, meter delta_l, radians delta_phi,

Input:

meterpersec v)

(handle)

ONE VWHandle

(delta_l) length of curve_segment to drive in m

(pos. -> forward)

(neg. -> backward)

(delta_phi) degree to turn in radians

(pos. -> counter-clockwise)

(neg. -> clockwise)

Output:

(v)

speed to drive with (always positive!)

0 = ok

Semantics:

-1 = error wrong handle

drives a curve segment of length "delta_l" with overall vehicle

403


B RoBIOS Operating System

turn

of "delta_phi"

with

speed v (forw. or backw. / clockw. or counter-clockw.).

any subsequent call of VWDriveStraight, -Turn, -Curve or

VWSetSpeed, while this one is still being executed,

results in an immediate interruption of this command

float VWDriveRemain (VWHandle handle)

Input:

(handle) ONE VWHandle

Output:

0.0

= previous VWDriveX command has been completed

Semantics:

any other value = remaining distance to goal

remaining distance to goal set by VWDriveStraight, -Turn

(for

-Curve only the remaining part of delta_l is reported)

int VWDriveDone (VWHandle handle)

Input:

(handle) ONE VWHandle

Output:

-1 =

error wrong handle

0 =

vehicle is still in motion

Semantics:

1 =

previous VWDriveX command has been completed

checks if previous VWDriveX() command has been completed

int VWDriveWait (VWHandle handle)

Input:

(handle) ONE VWHandle

Output:

-1 =

error wrong handle

Semantics:

0 =

previous VWDriveX command has been completed

blocks the calling process until the previous VWDriveX()

command has been completed

int VWStalled (VWHandle handle)

Input:

(handle) ONE VWHandle

Output:

-1 =

error wrong handle

0 =

vehicle is still in motion or

1 =

no motion command is active

at least one vehicle motor is stalled during

Semantics:

VW driving command

checks if at least one of the vehicle's motors is stalled

right now

B.5.13 Bumper and Infrared Sensors

Tactile bumpers and infrared proximity sensors have been used in some previous robot models. They are currently not used for the SoccerBots, but may be used, e.g. for integrating additional sensors.

BumpHandle BUMPInit (DeviceSemantics semantics);

Input:

(semantics)

semantic

Output:

(returncode) BumpHandle or 0 for error

Semantics:

Initialize given bumper (up to 16 bumpers are possible)

int BUMPRelease (BumpHandle

handle);

Input:

(handle) sum of bumper-handles to be released

Output:

(returncode)

0 = ok

errors (nothing is released):

0x11110000

= totally wrong handle

0x0000xxxx

= the handle parameter in which only those

bits remained set that are connected to a releasable

Semantics:

Release one

TPU-channel

or more bumper

int BUMPCheck (BumpHandle handle, int* timestamp);

Input:

(handle) ONE bumper-handle

(timestamp)

pointer to an int where the timestamp is placed

404