Modules | Enumerations

Functions which handle the Laus-Tracker. More...

Modules

 Advanced informations
 

Enumerations

enum  eLausTrackerOrientation
 clusters the orientation More...
 
enum  eLausTrackerSelectMask
 clusters bit masks for the requests of the Laus-Tracker More...
 
enum  eLausTrackerGet
 clusters select values for reading data from the Laus-Tracker More...
 

Request Funktions

void lausTracker_request (eLausTrackerSelectMask bitmask, eRequestType request)
 Requests new data from the Laus-Tracker. More...
 
eLausTrackerSelectMask lausTracker_received (eLausTrackerSelectMask bitmask)
 Indicates if new data for the selected data blocks were received. More...
 
eLausTrackerSelectMask lausTracker_changed (eLausTrackerSelectMask bitmask)
 Indicates if new data changed the selected data blocks. More...
 

Access Funktions

uint8_t lausTracker_get (eLausTrackerGet select)
 Returns the last stored version of the selected value. More...
 

Detailed Description

Functions which handle the Laus-Tracker.

The Laus-Tracker system is explained within related pages:
Laustracker (German)

For sending and receiving data on the PC, there exists a ROS module. However, a simplified Python counterpart to the TUC-Bot example is given here - it can be used to test the connection to the robot:
lausTracker.py and packedCom.py

example

/*******************************************************************************
* examples/lausTracker.c *
* ====================== *
* *
* Version: 1.0.6 *
* Date : 06.12.17 *
* Author : Peter Weissig *
* *
* If you are changing this file, you may also consider to update *
* demos/diagnosticTool/diagnosticTool.c *
*******************************************************************************/
//*********************************<Included files>*****************************
#include <tucbot/tucbot.h>
#include <tucbot_additionals/packedCom.h>
#include <tucbot_additionals/lausTracker.h>
//*********************************<Methods>************************************
void testLausTracker(void);
int main(void);
//*********************************[testLausTracker]****************************
void testLausTracker(void) {
uint8_t menu_pos = 0;
uint8_t flag_redraw_menu = 0xFF;
uint8_t value_count = 0;
uint8_t temp;
lcdclr();
lcdstr_p(PSTR("lausTracker ###"));
while (1) {
// redraw menu
if (flag_redraw_menu) {
flag_redraw_menu = 0x00;
lcdxy(0,1);
if (menu_pos == 0) {
lcdstr_p(PSTR("self @(#,#,#)" ));
} else {
lcdstr_p(PSTR("rival @(#,#) " ));
}
mdelay(400);
}
// check if buttons were pushed
// middle button --> toggle menu
mdelay(100);
if (menu_pos == 0) {
menu_pos = 1;
} else {
menu_pos = 0;
}
flag_redraw_menu = 0xFF;
}
// update display (general)
if (temp != value_count) {
value_count = temp;
lcdxy(13,0); uint16tostr(lcdout,temp,3);
}
// update display depending on menu position
if (menu_pos == 0) {
lcdxy( 8,1);
lcdxy(10,1);
lcdxy(12,1);
lcdout('E');
break;
lcdout('S');
break;
lcdout('W');
break;
lcdout('N');
break;
}
}
} else {
lcdxy( 8,1);
lcdxy(10,1);
}
}
mdelay(100);
}
}
//*********************************[main]***************************************
int main (void) {
init_tucbot(0xFF);
testLausTracker();
return (0);
}

Enumeration Type Documentation

◆ eLausTrackerGet

clusters select values for reading data from the Laus-Tracker

See also
lausTracker_get()
Enumerator
kLausTrackerGetSelfX 

constant (1): x-coordinate of one self's robot (0...7)

kLausTrackerGetSelfY 

constant (2): y-coordinate of one self's robot (0...7)

kLausTrackerGetSelfOrientation 

constant (3): orientation of one self's robot
see also eLausTrackerOrientation

kLausTrackerGetRivalX 

constant (4): x-coordinate of opponent's robot (0...7)

kLausTrackerGetRivalY 

constant (5): y-coordinate of opponent's robot (0...7)

◆ eLausTrackerOrientation

clusters the orientation

See also
lausTracker_get()
Enumerator
kLausTrackerOrientationSouth 

constant (0): heading south (negative y-direction)

kLausTrackerOrientationNorth 

constant (1): heading north (positive y-direction)

kLausTrackerOrientationEast 

constant (2): heading east (positive x-direction)

kLausTrackerOrientationWest 

constant (3): heading west (negative x-direction)

◆ eLausTrackerSelectMask

clusters bit masks for the requests of the Laus-Tracker

See also
lausTracker_request(), lausTracker_received() and lausTracker_changed()
Enumerator
kLausTrackerSelectNone 

bit mask (0x00): select no data block

kLausTrackerSelectSelf 

bit mask (0x01): select one self's robot
see also sLausTrackerSelf

kLausTrackerSelectRival 

bit mask (0x02): select opponent's robot
see also sLausTrackerRival

kLausTrackerSelectAll 

bit mask (0x03): select all data blocks

Function Documentation

◆ lausTracker_changed()

eLausTrackerSelectMask lausTracker_changed ( eLausTrackerSelectMask  bitmask)

Indicates if new data changed the selected data blocks.

Parameters
bitmaskbit mask of the selected data blocks - see also eLausTrackerSelectMask
The parameter is used to only return the value of the masked changed-bits. All other values(bits) are set to 0.
Returns
bitfield of the selected data blocks - see also eLausTrackerSelectMask
If a data block is changed its related bit will be 1, otherwise 0.
If only one data block is selected the return value can be interpreted as a boolean expression.
See also
lausTracker_received(), lausTracker_request() and lausTracker_get()
Examples
lausTracker.c.

◆ lausTracker_get()

uint8_t lausTracker_get ( eLausTrackerGet  select)

Returns the last stored version of the selected value.

This function relies on the internal data blocks sLausTrackerSelf and sLausTrackerRival - for new data use lausTracker_request().

Parameters
selectvalue of the selected data - see also eLausTrackerGet
Returns
8-bit unsigned integer
select description
kLausTrackerGetSelfX
kLausTrackerGetSelfY
one self's robot position
kLausTrackerGetSelfOrientation ones self's robot orientation
kLausTrackerGetSelfX
kLausTrackerGetSelfY
opponent's robot position
See also
lausTracker_request()
Examples
lausTracker.c.

◆ lausTracker_received()

eLausTrackerSelectMask lausTracker_received ( eLausTrackerSelectMask  bitmask)

Indicates if new data for the selected data blocks were received.

Parameters
bitmaskbit mask of the selected data blocks - see also eLausTrackerSelectMask
The parameter is used to only return the value of the masked received-bits. All other values(bits) are set to 0.
Returns
bitfield of the selected data blocks - see also eLausTrackerSelectMask
If a data block is received its related bit will be 1, otherwise 0.
If only one data block is selected the return value can be interpreted as a boolean expression.
See also
lausTracker_changed(), lausTracker_request() and lausTracker_get()

◆ lausTracker_request()

void lausTracker_request ( eLausTrackerSelectMask  bitmask,
eRequestType  request 
)

Requests new data from the Laus-Tracker.

For details on the request schema see The general request.

Involved data blocks are:
sLausTrackerSelf and sLausTrackerRival

Parameters
bitmaskbit mask of the selected data blocks - see also eLausTrackerSelectMask
requestSee also eRequestType
See also
lausTracker_get()
Examples
lausTracker.c.
leds_set
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
kLausTrackerGetSelfX
@ kLausTrackerGetSelfX
constant (1): x-coordinate of one self's robot (0...7)
Definition: lausTracker.h:161
buttons_get
eButtonMask buttons_get(eButtonMask bitmask)
Returns the last stored value of the selected buttons.
kLausTrackerGetRivalY
@ kLausTrackerGetRivalY
constant (5): y-coordinate of opponent's robot (0...7)
Definition: lausTracker.h:170
kButtonMiddle
@ kButtonMiddle
bit mask (0x08): middle button
Definition: buttons.h:35
kLausTrackerGetSelfY
@ kLausTrackerGetSelfY
constant (2): y-coordinate of one self's robot (0...7)
Definition: lausTracker.h:163
kLausTrackerOrientationEast
@ kLausTrackerOrientationEast
constant (2): heading east (positive x-direction)
Definition: lausTracker.h:33
kLedOn
@ kLedOn
constant (0xFF): turn leds on
Definition: leds.h:63
kLausTrackerSelectSelf
@ kLausTrackerSelectSelf
Definition: lausTracker.h:145
lausTracker_get
uint8_t lausTracker_get(eLausTrackerGet select)
Returns the last stored version of the selected value.
kLausTrackerOrientationNorth
@ kLausTrackerOrientationNorth
constant (1): heading north (positive y-direction)
Definition: lausTracker.h:31
buttons_request
void buttons_request(eRequestType request)
Requests new data from the buttons.
lausTracker_request
void lausTracker_request(eLausTrackerSelectMask bitmask, eRequestType request)
Requests new data from the Laus-Tracker.
kLausTrackerOrientationWest
@ kLausTrackerOrientationWest
constant (3): heading west (negative x-direction)
Definition: lausTracker.h:35
kLausTrackerOrientationSouth
@ kLausTrackerOrientationSouth
constant (0): heading south (negative y-direction)
Definition: lausTracker.h:29
kRequestContinuous
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
kLausTrackerGetRivalX
@ kLausTrackerGetRivalX
constant (4): x-coordinate of opponent's robot (0...7)
Definition: lausTracker.h:168
kLedMiddle
@ kLedMiddle
bit mask (0x08): middle led
Definition: leds.h:44
kLedOff
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
uint16tostr
void uint16tostr(void *out, uint16_t number, uint8_t digits)
Converts an unsigned integer to a string and passes it to an output function.
packedCom_activate
void packedCom_activate(void)
Turns the reception of data packets on.
lcdclr
void lcdclr(void)
Clears the display.
packedCom_get
uint8_t packedCom_get(ePackedComGet select)
Returns the last stored selected value.
lcdxy
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
kLausTrackerSelectAll
@ kLausTrackerSelectAll
bit mask (0x03): select all data blocks
Definition: lausTracker.h:151
kPackedComGetPacketCount
@ kPackedComGetPacketCount
constants (2): number of correct received packets
Definition: packedCom.h:264
lcdstr_p
void lcdstr_p(const char *send_data)
Writes a string located in the flash to the display.
lcdout
void lcdout(uint8_t data)
Writes one byte to the display.
kLausTrackerSelectRival
@ kLausTrackerSelectRival
Definition: lausTracker.h:148
init_tucbot
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
mdelay
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.
kLausTrackerGetSelfOrientation
@ kLausTrackerGetSelfOrientation
Definition: lausTracker.h:165
lausTracker_changed
eLausTrackerSelectMask lausTracker_changed(eLausTrackerSelectMask bitmask)
Indicates if new data changed the selected data blocks.