src/robodata/.
Robot's private data for the Eurobot 2007 have been moved to robot_eb2007
library.
--- /dev/null
+../../src/robodata
\ No newline at end of file
--- /dev/null
+../../src/robodata
\ No newline at end of file
--- /dev/null
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+ @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
--- /dev/null
+# -*- makefile -*-
+
+include_HEADERS = robodata.h
--- /dev/null
+/**
+ * robodata.h 08/04/11
+ *
+ * Multi-purpose structures and defines for robots.
+ *
+ * Copyright: (c) 2008 DCE Eurobot Dragon Team
+ * CTU FEE - Department of Control Engineering
+ * License: GNU GPL v.2
+ */
+
+#ifndef ROBODATA_H
+#define ROBODATA_H
+
+/* robot's mode */
+enum {
+ ROBO_COMPETING = 0,
+ ROBO_TESTING
+};
+
+/**
+ * FSM MACROS
+ */
+#define FSM(id) (&robot.fsm[FSM_ID_##id])
+#define FSM_GET_BY_ID(fsm_id) (&robot.fsm[FSM_ID_##fsm_id])
+
+/**
+ * LOCKING MANIPULATION
+ */
+
+/**
+ * Locks the robot structure.
+ * @param var Field in the structure you are going to work with.
+ */
+#define ROBOT_LOCK(var) (pthread_mutex_lock(&robot.__robot_lock_##var))
+
+/**
+ * Unlocks the robot structure.
+ * @param var Field in the structure, which was locked by ROBOT_LOCK.
+ */
+#define ROBOT_UNLOCK(var) (pthread_mutex_unlock(&robot.__robot_lock_##var))
+
+/**
+ * DEBUG MACROS
+ */
+#ifdef DEBUG
+#define PROG_NAME "robot"
+#define DBG(f, a...) printf(f, ## a)
+#define DBGPROG(f, a...) printf(PROG_NAME ": " f, ## a)
+#else
+#define DBG(f, a...) do { } while(0)
+#define DBGPROG(f, a...) do { } while(0)
+#endif
+
+/**
+ * THREAD PRIORITIES
+ */
+#define SET_THREAD_PRIORITY(tid,prio) \
+sched_param param; \
+pthread_attr_t tattr; \
+pthread_attr_init (&tattr); \
+pthread_attr_getschedparam (&tattr, ¶m); \
+param.sched_priority = prio;\
+pthread_attr_setschedparam (&tattr, ¶m);
+
+#endif /* ROBODATA_H */
-roboevent.c
-roboevent.h
+roboevent_eb2007.c
+roboevent_eb2007.h
bin_PROGRAMS += homologation
homologation_SOURCES = homologation.cc
-bin_PROGRAMS += joystick
-joystick_SOURCES = joystick.cc
-
-bin_PROGRAMS += testpickup
-testpickup_SOURCES = testpickup.cc
-
-bin_PROGRAMS += testcollavoid
-testcollavoid_SOURCES = testcollavoid.cc
-
-bin_PROGRAMS += rectangle
-rectangle_SOURCES = rectangle.cc
-
-bin_PROGRAMS += line
-line_SOURCES = line.cc
-
-bin_PROGRAMS += odotest
-odotest_SOURCES = odometry.cc
-
-bin_PROGRAMS += follower
-follower_SOURCES = follower.cc
+#bin_PROGRAMS += joystick
+#joystick_SOURCES = joystick.cc
+#
+#bin_PROGRAMS += testpickup
+#testpickup_SOURCES = testpickup.cc
+#
+#bin_PROGRAMS += testcollavoid
+#testcollavoid_SOURCES = testcollavoid.cc
+#
+#bin_PROGRAMS += rectangle
+#rectangle_SOURCES = rectangle.cc
+#
+#bin_PROGRAMS += line
+#line_SOURCES = line.cc
+#
+#bin_PROGRAMS += odotest
+#odotest_SOURCES = odometry.cc
+#
+#bin_PROGRAMS += follower
+#follower_SOURCES = follower.cc
# Test application for robot_goto
-bin_PROGRAMS += goto
-goto_SOURCES = robot_goto.cc
+#bin_PROGRAMS += goto
+#goto_SOURCES = robot_goto.cc
# Library with general support functions for the robot
-lib_LIBRARIES += robot
-robot_SOURCES = serva.c robot.c roboorte.c fsmmove.cc \
+lib_LIBRARIES += robot_eb2007
+robot_eb2007_SOURCES = serva.c robot_eb2007.c roboorte.c fsmmove.cc \
fsmpickup.c fsmdet.c fsmjoy.c \
- movehelper.cc roboevent.c fsmdisplay.cc
+ movehelper.cc roboevent_eb2007.c fsmdisplay.cc
+include_HEADERS += robot_eb2007.h
-bin_PROGRAMS += test_timer
-test_timer_SOURCES = test_timer.c
+#bin_PROGRAMS += test_timer
+#test_timer_SOURCES = test_timer.c
# Libraries linked to all programs in this Makefile
-lib_LOADLIBES = robot fsm_loc mcl laser-nav robomath robottype pthread \
+lib_LOADLIBES = robot_eb2007 fsm_loc mcl laser-nav robomath robottype pthread \
rt m orte pathplan sharp map fsm rbtree motion
lib_LIBRARIES += fsm_loc
fsm_loc_SOURCES = fsmloc.c
# Automatic generation of event definition files
-include-pass-local: $(SOURCES_DIR)/roboevent.c $(SOURCES_DIR)/roboevent.h
+include-pass-local: $(SOURCES_DIR)/roboevent_eb2007.c $(SOURCES_DIR)/roboevent_eb2007.h
-$(SOURCES_DIR)/roboevent.c $(SOURCES_DIR)/roboevent.h: $(SOURCES_DIR)/roboevent.py
+$(SOURCES_DIR)/roboevent_eb2007.c $(SOURCES_DIR)/roboevent_eb2007.h: $(SOURCES_DIR)/roboevent_eb2007.py
@$(QUIET_CMD_ECHO) " EVENTGEN roboevent"
- $(Q)cd $(SOURCES_DIR) && python $(SOURCES_DIR)/../fsm/eventgen.py roboevent
+ $(Q)cd $(SOURCES_DIR) && python $(SOURCES_DIR)/../fsm/eventgen.py roboevent_eb2007
+include_HEADERS += roboevent_eb2007.h
*/
#define FSM_DETECT
-#include "robot.h"
-#include "fsm.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
+#include <fsm.h>
#include "movehelper.h"
#include "serva.h"
#include <math.h>
*/
#define FSM_DISPLAY
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
#include <signal.h>
#include <pthread.h>
#include <unistd.h>
*/
#define FSM_JOYSTICK
-#include "robot.h"
-#include "fsm.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
+#include <fsm.h>
#include "movehelper.h"
#include "serva.h"
#include <math.h>
#include <robomath.h>
#include <laser-nav.h>
#include <mcl.h>
-#include "robot.h"
+#include <robot_eb2007.h>
#include <fsm.h>
/* FIXME: not used, need to updated with the new mcl api */
#include <time.h>
#include "trgen.h"
#include "balet.h"
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
#include <pthread.h>
#include <path_planner.h>
#include <signal.h>
#define FSM_PICKUP
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
#include <fsm.h>
#include <sharp.h>
#include "serva.h"
* test enemy avoidance
*/
#define FSM_MAIN
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
#include <fsm.h>
#include <unistd.h>
#include "serva.h"
*/
#include "trgen.h"
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
#include "movehelper.h"
#include <path_simplifier.h>
#include <stdio.h>
#ifndef MOVEHELPER_H
#define MOVEHELPER_H
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
#include "trgenconstr.h"
#include <math.h>
#include <stdio.h>
#endif
-#include "robot.h"
+#include <robot_eb2007.h>
#include <RobotType.h>
#include <math.h>
#include <string.h>
-#include "robot.h"
+#include <robot_eb2007.h>
#include <signal.h>
#include <unistd.h>
#include "serva.h"
[FSM_ID_PICKUP] = "pickup"
};
-struct robo_priv robot;
+struct robot_eb2007 robot;
static void block_signals()
{
/**
- * @file
+ * robot_eb2007.h 07/04/18
*
- * Robot`s data structures.
+ * Robot's data structures for the Eurobot 2007.
*
* 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
*/
-#ifndef __robot__
-#define __robot__
+#ifndef ROBOT_EB2007_H
+#define ROBOT_EB2007_H
#include <stdint.h>
#include <stdio.h>
#include <mcl.h>
+#include <trgenconstr.h>
#include <RobotType.h>
-#include "RobotTypeArr.h"
-#include "roboevent.h"
-#include <fsm.h>
+#include <RobotTypeArr.h>
#include <robodim_eb2007.h>
-#include <trgenconstr.h>
-
-#define LAS_CNT 12 /* dont forget to change CRA!! */
-/* index of information in times array */
-#define LAS_MEAS_CNTI 0 /* counter index of measured times */
-#define LAS_MEAS_PERI 1 /* period index */
-#define LAS_MEAS_DATAI 2 /* data index */
+#include <roboevent_eb2007.h>
+#include <fsm.h>
-/* Select robot color. If we are BLUE, no coordinate transformation is
- * performed. */
+/* Select robot color. If we are BLUE, no coordinate transformation will
+ * be performed. */
// #define WE_ARE_RED
#define WE_ARE_BLUE
+/**
+ * FSM
+ */
/* amount of FSM */
#define FSM_CNT 6
/* FSM ids */
enum robot_fsm_id {
- FSM_ID_MAIN = 0,
- FSM_ID_DET = 1,
- FSM_ID_LOC = 2,
- FSM_ID_MOTION = 3,
- FSM_ID_PICKUP = 4,
- FSM_ID_JOY = 5
+ FSM_ID_MAIN = 0,
+ FSM_ID_DET = 1,
+ FSM_ID_LOC = 2,
+ FSM_ID_MOTION = 3,
+ FSM_ID_PICKUP = 4,
+ FSM_ID_JOY = 5
};
-#define FSM(id) (&robot.fsm[FSM_ID_##id])
-#define FSM_GET_BY_ID(fsm_id) (&robot.fsm[FSM_ID_##fsm_id])
+#define LAS_CNT 12 /* dont forget to change CRA!! */
+/* index of information in times array */
+#define LAS_MEAS_CNTI 0 /* counter index of measured times */
+#define LAS_MEAS_PERI 1 /* period index */
+#define LAS_MEAS_DATAI 2 /* data index */
enum {
WASTE_BOTTLE,
CLOSE
};
-/* robot`s position configuration */
-struct robo_pos {
- double x; /* X position [m] */
- double y; /* Y position [m] */
- double phi; /* head angle [rad] */
-};
-
struct bottle_sens {
uint8_t sens1;
uint8_t sens2;
#define __robot_lock_waste_cnt lock
#define __robot_lock_frontDoorAngle lock
-/* robot`s main data structure */
-struct robo_priv {
+/* robot's main data structure */
+struct robot_eb2007 {
long long cnt;
unsigned char mode;
pthread_mutex_t lock;
int bottle_under_belt;
int waste_cnt;
-}; /* robo_priv */
-
-/* robot`s mode */
-enum {
- ROBO_COMPETING = 0,
- ROBO_TESTING
-};
-
-/* robot`s global data structure */
-extern struct robo_priv robot;
-
-/* locking manipulation */
-
-/**
- * Locks the robot structure.
- * @param var Field in the structure you are going to work with.
- */
-#define ROBOT_LOCK(var) (pthread_mutex_lock(&robot.__robot_lock_##var))
-
-/**
- * Unlocks the robot structure.
- * @param var Field in the structure, which was locked by ROBOT_LOCK.
- */
-#define ROBOT_UNLOCK(var) (pthread_mutex_unlock(&robot.__robot_lock_##var))
-
+}; /* robot_eb2007 */
+extern struct robot_eb2007 robot;
#ifdef __cplusplus
extern "C" {
}
#endif
-
-/**
- * DEBUG MACROS
- */
-#ifndef DEBUG
-#define DEBUG
-#endif
-#ifdef DEBUG
-#define PROG_NAME "robot"
-#define DBG(f, a...) printf(f, ## a)
-#define DBGPROG(f, a...) printf(PROG_NAME ": " f, ## a)
-#else
-#define DBG(f, a...) do { } while(0);
-#define DBGPROG(f, a...) do { } while(0);
-#endif
-
/*Thread priorities*/
#define TRAJ_FOLLOWER_PRIO 255 /* As high as possible */
#define UPDATE_MAP_PRIO 10 /* Priority of the thread for updating map with detected obstacles. */
#define TRAJ_RECALC_PRIO 0 /* As low as possible */
-#define SET_THREAD_PRIORITY(tid,prio) \
-sched_param param; \
-pthread_attr_t tattr; \
-pthread_attr_init (&tattr); \
-pthread_attr_getschedparam (&tattr, ¶m); \
-param.sched_priority = prio;\
-pthread_attr_setschedparam (&tattr, ¶m);
-
-#endif /* __robot__ */
+
+#endif /* ROBOT_EB2007_H */
-#include "robot.h"
+#include <robot_eb2007.h>
#define FRONT_DOOR_UP 20
#define FRONT_DOOR_DOWN 251
#include <robomath.h>
/* fixed points of the trayectory */
-struct robo_pos trayectory[] = {
+struct position_type trayectory[] = {
{0.0, 0.0, 0.0},
{2.98, 1.88, 0.0},
{2.98, 0, DEG2RAD(270)},