]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Robot's multi-purpose data have been moved to robodata library placed at
authorTran Duy Khanh <trandk1@fel.cvut.cz>
Fri, 11 Apr 2008 11:51:20 +0000 (13:51 +0200)
committerTran Duy Khanh <trandk1@fel.cvut.cz>
Fri, 11 Apr 2008 11:51:20 +0000 (13:51 +0200)
src/robodata/.
Robot's private data for the Eurobot 2007 have been moved to robot_eb2007
library.

22 files changed:
build/linux/robodata [new symlink]
build/ppc/robodata [new symlink]
src/robodata/Makefile [new file with mode: 0644]
src/robodata/Makefile.omk [new file with mode: 0644]
src/robodata/robodata.h [new file with mode: 0644]
src/robofsm/.gitignore
src/robofsm/Makefile.omk
src/robofsm/fsmdet.c
src/robofsm/fsmdisplay.cc
src/robofsm/fsmjoy.c
src/robofsm/fsmloc.c
src/robofsm/fsmmove.cc
src/robofsm/fsmpickup.c
src/robofsm/homologation.cc
src/robofsm/movehelper.cc
src/robofsm/movehelper.h
src/robofsm/roboevent_eb2007.py [moved from src/robofsm/roboevent.py with 100% similarity]
src/robofsm/roboorte.c
src/robofsm/robot_eb2007.c [moved from src/robofsm/robot.c with 98% similarity]
src/robofsm/robot_eb2007.h [moved from src/robofsm/robot.h with 66% similarity]
src/robofsm/serva.h
src/robofsm/testcollavoid.cc

diff --git a/build/linux/robodata b/build/linux/robodata
new file mode 120000 (symlink)
index 0000000..4b8ae51
--- /dev/null
@@ -0,0 +1 @@
+../../src/robodata
\ No newline at end of file
diff --git a/build/ppc/robodata b/build/ppc/robodata
new file mode 120000 (symlink)
index 0000000..4b8ae51
--- /dev/null
@@ -0,0 +1 @@
+../../src/robodata
\ No newline at end of file
diff --git a/src/robodata/Makefile b/src/robodata/Makefile
new file mode 100644 (file)
index 0000000..08cf5ff
--- /dev/null
@@ -0,0 +1,14 @@
+# 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
+
diff --git a/src/robodata/Makefile.omk b/src/robodata/Makefile.omk
new file mode 100644 (file)
index 0000000..79db11e
--- /dev/null
@@ -0,0 +1,3 @@
+# -*- makefile -*-
+
+include_HEADERS = robodata.h
diff --git a/src/robodata/robodata.h b/src/robodata/robodata.h
new file mode 100644 (file)
index 0000000..c111a4b
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * 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, &param); \
+param.sched_priority = prio;\
+pthread_attr_setschedparam (&tattr, &param);
+
+#endif /* ROBODATA_H */
index f22e3bba1e046d0349a955c61c445746bbb8992b..4e5c9fb1c35f8805918adc66d6e16f24257947d8 100644 (file)
@@ -1,2 +1,2 @@
-roboevent.c
-roboevent.h
+roboevent_eb2007.c
+roboevent_eb2007.h
index 62aa1f9deebc0c9c8ac780a2259a66a29190d4e7..0ab94d830441da9ce5283c1be24595904a5148ee 100644 (file)
@@ -10,53 +10,55 @@ LOCAL_CONFIG_H = robot_config.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
 
index a96d4e00835c5c90cb93dafeb8b5a3ca6a1c24e5..4a97d657a0250d6459447de1bf7c141c0bbb940e 100644 (file)
@@ -9,8 +9,9 @@
  */
 
 #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>
index 8a11660ca418c9ffaac456f25963d529b80a2c13..1b62d6139d978c2dd5aa8d6ab7cedae5462fae04 100644 (file)
@@ -6,7 +6,8 @@
  */
 #define FSM_DISPLAY
 
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
 #include <signal.h>
 #include <pthread.h>
 #include <unistd.h>
index 78346557ed6a5b7d9dcbd3c19c61ead9565c8783..658e3c912527087e4d72e2743194d65cfdb55098 100644 (file)
@@ -9,8 +9,9 @@
  */
 
 #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>
index ea88fabe84d4b29a01bf494d37f544a6e9705d4f..c30d70cb3b1157015a9020699107b135228e7637 100644 (file)
@@ -14,7 +14,7 @@
 #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 */
index 9765d2caffcb4b62d70e44ea7a2d7cea6d7e7aab..db70d527049dd88c2a1bd35f6b2b81a10457d932 100644 (file)
@@ -9,7 +9,8 @@
 #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>
index 518cd3f97f36b4bd81d3c82a2289362ff062c113..8e47e7d474e6bfaf27137d0a7d7d2ea133a338b4 100644 (file)
@@ -1,6 +1,7 @@
 #define FSM_PICKUP
 
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
 #include <fsm.h>
 #include <sharp.h>
 #include "serva.h"
index 0f9d3a3383d084718bc9b660bab657a4a17f19c1..9efd1603efedf3b5078ff7d31d073de2f2072102 100644 (file)
@@ -14,7 +14,8 @@
  *     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"
index 79401c2aa76fd2d679e531f52e261a00f9fb3528..a063c6999489a02e3d5792305733994626ac7832 100644 (file)
@@ -9,7 +9,8 @@
  */
 
 #include "trgen.h"
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
 #include "movehelper.h"
 #include <path_simplifier.h>
 #include <stdio.h>
index 4592090b9c15fbf0642971326b9817c9bdb4872e..807458b705c94532144a16df810f18cfddb9bebb 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef MOVEHELPER_H
 #define MOVEHELPER_H
 
-#include "robot.h"
+#include <robodata.h>
+#include <robot_eb2007.h>
 #include "trgenconstr.h"
 #include <math.h>
 
index 19d54bcde1d9b4e239d4d8e795f6ac9a35d6b45b..39515165edae8ec8ff42b4ad7b12c79020968810 100644 (file)
@@ -13,7 +13,7 @@
 #include <stdio.h>
 #endif
 
-#include "robot.h"
+#include <robot_eb2007.h>
 #include <RobotType.h>
 #include <math.h>
 #include <string.h>
similarity index 98%
rename from src/robofsm/robot.c
rename to src/robofsm/robot_eb2007.c
index 88c592c3abe65502095ac63ccc604e39914689d5..c98c5e66f2429cb3bb0ddd260cdc742123ce9694 100644 (file)
@@ -1,4 +1,4 @@
-#include "robot.h"
+#include <robot_eb2007.h>
 #include <signal.h>
 #include <unistd.h>
 #include "serva.h"
@@ -21,7 +21,7 @@ static char *fsm_name[] = {
        [FSM_ID_PICKUP] = "pickup"
 };
 
-struct robo_priv robot;
+struct robot_eb2007 robot;
 
 static void block_signals()
 {
similarity index 66%
rename from src/robofsm/robot.h
rename to src/robofsm/robot_eb2007.h
index 3cef2e5dbe2342addec3c23d94b7ae61c0a3e04f..7dab009aa172d6ef7263249383e854da70d130cf 100644 (file)
@@ -1,53 +1,52 @@
 /**
- * @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,
@@ -61,13 +60,6 @@ enum bottle_sens_state {
        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;  
@@ -90,8 +82,8 @@ struct bottle_sens {
 #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;
@@ -148,32 +140,9 @@ struct robo_priv {
 
        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" {
@@ -198,32 +167,9 @@ FSM_STATE_DECL(joy_init);
 }
 #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, &param); \
-param.sched_priority = prio;\
-pthread_attr_setschedparam (&tattr, &param);
-
-#endif /* __robot__ */
+
+#endif /* ROBOT_EB2007_H */
index 32ca942bafe829440af0b6cc1eba840f6e69a829..2df1767895149d8450b1402507e561b12268ca93 100644 (file)
@@ -1,4 +1,4 @@
-#include "robot.h"
+#include <robot_eb2007.h>
 
 #define FRONT_DOOR_UP 20
 #define FRONT_DOOR_DOWN 251
index e3b3f7c0a0adf922648e490639283b6d45303e47..b178fff33d9d0d0bc10b78d3012069872f53b583 100644 (file)
@@ -21,7 +21,7 @@
 #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)},