int i,pt;
- hokuyo_init(HOKUYO_DEVICE);
+ hokuyo_init(HOKUYO_DEVICE); // FIXME: temporarily commented out by Filip 04.04.2009:
// Open output file
#if 0
output=fopen("hoklog","w");
# Libraries linked to all programs in this Makefile
lib_LOADLIBES = robot mcl robomath roboorte robottype robottype \
pthread rt m orte pathplan sharp map fsm uoled oledlib \
- rbtree motion robodim sercom
+ rbtree motion robodim sercom actlib
# Automatic generation of event definition files
include-pass_HOOKS = roboevent.c roboevent.h
#define CHELA_OPEN 0x30
#define CHELA_LOOSE 0x80
-#define CHELA_LEFT_CLOSED 0x00
-#define CHELA_RIGHT_CLOSED 0xFF
-#define CHELA_LEFT_OPEN 0xD0
-#define CHELA_RIGHT_OPEN 0x30
-#define CHELA_LEFT_TIGHT 0x60
-#define CHELA_RIGHT_TIGHT 0xA0
-
/* FIXME: (temporary, LPCs not ready) Timeout */
#define CHELA_TIMEOUT 0x07
#include <robot.h>
#include <fsm.h>
+#include "actuators.h"
/* ***********************************************************
* STATE DECLARATIONS
FSM_STATE(wait_for_command) {
switch (FSM_EVENT) {
case EV_ENTRY:
+ act_belts(BELTS_OFF, BELTS_OFF);
+ act_chelae(CHELA_OPEN, CHELA_OPEN);
// TODO
// put actuators to defined initial positions
break;
/**
* Timer to go to tray.
*
+ * FIXME: rename this function?
*/
void *wait_to_deposition(void *arg)
{
FSM_STATE_DECL(init);
FSM_STATE_DECL(wait_for_start);
/* movement states */
+FSM_STATE_DECL(go_somewhere);
/************************************************************************
* INITIAL AND STARTING STATES
FSM_STATE(wait_for_start)
{
+ #ifdef COMPETITON
+ printf("COMPETITION mode set");
+ #endif
switch (FSM_EVENT) {
#ifdef WAIT_FOR_START
case EV_START: {
#else
case EV_ENTRY:
#endif
- robot_set_est_pos_trans(ROBOT_WIDTH_M/2,
- PLAYGROUND_HEIGHT_M - ROBOT_AXIS_TO_BACK_M,
- DEG2RAD(-45));
+ robot_set_est_pos_trans(ROBOT_WIDTH_M,
+ PLAYGROUND_HEIGHT_M - ROBOT_AXIS_TO_BACK_M - 0.1,
+ DEG2RAD(-90));
/* start to do something */
ROBOT_LOCK(state);
robot.state = COMPETITION_STARTED;
ROBOT_UNLOCK(state);
+ FSM_TRANSITION(go_somewhere);
break;
case EV_LASER_POWER:
break;
* MOVEMENT STATES
************************************************************************/
+FSM_STATE(go_somewhere)
+{
+ switch (FSM_EVENT) {
+ case EV_ENTRY: {
+ //struct TrajectoryConstraints tc = trajectoryConstraintsDefault;
+ //tc.maxv /= 4.0;
+ //robot_trajectory_new(&tc);
+
+ //robot_trajectory_add_point_trans(PLAYGROUND_WIDTH_M - 0.8, 1.0);
+ /* robot_trajectory_add_final_point_trans(PLAYGROUND_WIDTH_M - 0.6,
+ 0.4, TURN(DEG2RAD(90))); */
+
+ /* robot_trajectory_add_final_point_trans(ROBOT_WIDTH_M,
+ 1.5, NO_TURN()); */
+ robot_stop();
+ FSM_TIMER(500);
+ //robot_send_speed(0.5,0.5);
+ }
+ break;
+ case EV_TIMER:
+ robot_stop();
+ break;
+ case EV_EXIT:
+ break;
+ default: break; // FIXME: we do not want this
+ }
+}
+
void robot_move_by(double distance, struct final_heading *heading, struct TrajectoryConstraints *tc);
+/* FIXME: not used anywhere */
static inline void robot_translate_coordinates(double *x, double *y, double *phi)
{
if (x) {
/* init ORTE domain, create publishers, subscribers, .. */
rv = robot_init_orte();
+ act_init(&robot.orte);
return rv;
}
# Libraries linked to all programs in this Makefile
lib_LOADLIBES = robot mcl robodim laser-nav robomath uoled oledlib \
sercom roboorte robottype pthread rt m orte pathplan \
- sharp map fsm rbtree motion
+ sharp map fsm rbtree motion actlib
tempRect->setZValue(1);
/* blue starting area */
- tempRect = addRect(QRectF(11, 1, 100, 100), QPen(QBrush(Qt::blue),
+ tempRect = addRect(QRectF(11, 1, 100, 100), QPen(QBrush(Qt::green),
1, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin),
- QBrush(Qt::blue));
+ QBrush(Qt::green));
tempRect->setZValue(3);
/* red starting area */
void RobomonAtlantis::pick()
{
- act_picker(CHELA_LEFT_TIGHT, CHELA_RIGHT_TIGHT, BELTS_OUT, BELTS_OUT,
- CHELA_TIMEOUT);
+ // TODO: send signal to the fsmact
}
void RobomonAtlantis::setBelts(int value)