robot.h File Reference

Robot`s data structures. More...

#include <stdint.h>
#include <stdio.h>
#include <mcl.h>
#include <RobotType.h>
#include "RobotTypeArr.h"
#include "roboevent.h"
#include <fsm.h>
#include "fsmloc.h"

Include dependency graph for robot.h:

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

Go to the source code of this file.

Classes

struct  robo_pos
struct  bottle_sens
struct  robo_priv

Defines

#define LAS_CNT   12
#define LAS_MEAS_CNTI   0
#define LAS_MEAS_PERI   1
#define LAS_MEAS_DATAI   2
#define FSM_CNT   5
#define FSM(id)   (&robot.fsm[FSM_ID_##id])
#define FSM_GET_BY_ID(id)   (&robot.fsm[FSM_ID_##id])
 Returns pointer to struct fsm identified by the id.
#define __robot_lock_act_pos   lock_act_pos
#define __robot_lock_est_pos   lock
#define __robot_lock_goal   lock
#define __robot_lock_IRsensors   lock
#define __robot_lock_joy   lock
#define __robot_lock_laser_recv   lock
#define __robot_lock_new_trajectory   lock
#define __robot_lock_sharpsOpponent   lock
#define __robot_lock_sharpsWaste   lock
#define ROBOT_LOCK(var)   (pthread_mutex_lock(&robot.__robot_lock_##var))
 Locks the robot structure.
#define ROBOT_UNLOCK(var)   (pthread_mutex_unlock(&robot.__robot_lock_##var))
 Unlocks the robot structure.
#define DEBUG
 DEBUG MACROS.
#define PROG_NAME   "robot"
#define DBG(f, a...)   printf(f, ## a)
#define DBGPROG(f, a...)   printf(PROG_NAME ": " f, ## a)
#define ROBOT_WIDTH_MM   290
#define ROBOT_ROTATION_RADIUS_MM   (254/2)
#define LASER_CENTER_OFFSET_MM   50 /*FIXME*/
#define ROBOT_WHEEL_RADIUS_MM   40
#define ROBOT_AXIS_TO_BACK_MM   75
#define ROBOT_AXIS_TO_FRONT_MM   183
#define ROBOT_AXIS_TO_BELT_MM   280
#define PLAYGROUND_WIDTH_MM   3000
#define PLAYGROUND_HEIGHT_MM   2100
#define TRAJ_FOLLOWER_PRIO   255
#define TRAJ_RECALC_PRIO   0
#define SET_THREAD_PRIORITY(tid, prio)

Enumerations

enum  robot_fsm_id {
  FSM_ID_MAIN = 0, FSM_ID_DET = 1, FSM_ID_LOC = 2, FSM_ID_MOTION = 3,
  FSM_ID_PICKUP = 4
}
enum  bottle_sens_state { NOTHING = 0, FAR, CLOSE }
enum  { ROBO_COMPETING = 0, ROBO_TESTING }

Functions

void initOrte ()
void terminateOrte ()
int robot_init ()
 Initializes the robot.
int robot_start ()
 Starts the robot threads.
int robot_exit ()
 Signals all the robot threads to finish.
int robot_wait ()
 Wait for finishing the robot threads after calling robot_exit().
int robot_destroy ()
 Stops the robot.
 FSM_STATE_DECL (main_init)
 FSM_STATE_DECL (start_pickup)
 FSM_STATE_DECL (move_init)
 FSM_STATE_DECL (det_start)
 FSM_STATE_DECL (loc_init)

Variables

struct robo_priv robot


Detailed Description

Robot`s data structures.

Copyright: (c) 2007 DCE Eurobot Dragon Team CTU FEE - Department of Control Engineering Contacts: Tran Duy Khanh <trandk1@fel.cvut.cz> License: GNU GPL v.2

Definition in file robot.h.


Define Documentation

#define ROBOT_LOCK ( var   )     (pthread_mutex_lock(&robot.__robot_lock_##var))

Locks the robot structure.

Parameters:
var Field in the structure you are going to work with.

Definition at line 147 of file robot.h.

Referenced by new_goal(), new_trajectory(), robot_goto(), robot_trajectory_add_final_point(), robot_trajectory_add_point(), robot_trajectory_new_ex(), trajctory_recalc(), and trajectory_follower().

#define ROBOT_UNLOCK ( var   )     (pthread_mutex_unlock(&robot.__robot_lock_##var))

Unlocks the robot structure.

Parameters:
var Field in the structure, which was locked by ROBOT_LOCK.

Definition at line 153 of file robot.h.

Referenced by new_goal(), new_trajectory(), robot_goto(), robot_trajectory_add_final_point(), robot_trajectory_add_point(), robot_trajectory_new_ex(), trajctory_recalc(), and trajectory_follower().

#define SET_THREAD_PRIORITY ( tid,
prio   ) 

Value:

sched_param param; \
pthread_attr_t tattr; \
pthread_attr_init (&tattr); \
pthread_attr_getschedparam (&tattr, &param); \
param.sched_priority = prio;\
pthread_attr_setschedparam (&tattr, &param);

Definition at line 209 of file robot.h.


Enumeration Type Documentation

anonymous enum

Enumerator:
ROBO_COMPETING 
ROBO_TESTING 

Definition at line 133 of file robot.h.

enum bottle_sens_state

Enumerator:
NOTHING 
FAR 
CLOSE 

Definition at line 45 of file robot.h.

enum robot_fsm_id

Enumerator:
FSM_ID_MAIN 
FSM_ID_DET 
FSM_ID_LOC 
FSM_ID_MOTION 
FSM_ID_PICKUP 

Definition at line 34 of file robot.h.


Function Documentation

int robot_destroy (  ) 

Stops the robot.

All resources alocated by robot_init() or robot_start() are dealocated here.

Returns:
0

Definition at line 150 of file robot.c.

References DBG, FSM_CNT, fsm_destroy(), and robot_trajectory_stop().

Here is the call graph for this function:

int robot_exit (  ) 

Signals all the robot threads to finish.

Returns:
0

Definition at line 118 of file robot.c.

References __fsm_signal(), EV_EXIT, and FSM_CNT.

Here is the call graph for this function:

int robot_init (  ) 

Initializes the robot.

Setup fields in robot structure, initializes FSMs and ORTE.

Returns:
0

Definition at line 50 of file robot.c.

References FSM_CNT, fsm_init(), and ROBO_TESTING.

Here is the call graph for this function:

int robot_start (  ) 

Starts the robot threads.

Don't exit() in case of error.

Returns:
0

Definition at line 86 of file robot.c.

References FSM_CNT, and fsm_start().

Here is the call graph for this function:

int robot_wait (  ) 

Wait for finishing the robot threads after calling robot_exit().

*

Returns:
0

Definition at line 134 of file robot.c.

References FSM_CNT.


Generated on Thu Sep 13 11:28:29 2007 for DCE-Eurobot by  doxygen 1.5.3