#include <string.h>
#include <ul_log.h>
#include "guard.hpp"
+#include "events.h"
UL_LOG_CUST(ulogd_movehelper); /* Log domain name = ulogd + name of the file */
MoveHelper& MoveHelper::add_final_point_notrans(double x_m, double y_m, move_target_heading heading)
{
move_target *target;
-
+ printf("%s\n", __FUNCTION__);
if (t) {
if (heading.operation == TOP_ARRIVE_FROM) {
double ax, ay;
target->heading = heading;
target->trajectory = t;
target->use_planning = false;
- /*TODO*/FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
+// /*TODO*/FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
+ robot.sched.queue_event(robot.MOTION, new EV_NEW_TARGET(target));
t = NULL;
} else {
ul_logerr("%s: Error - No trajectory\n", __FUNCTION__);
*/
void MoveHelper::stop()
{
- FSM_SIGNAL(MOTION, EV_MOVE_STOP, NULL);
+ robot.sched.queue_event(robot.MOTION, new EV_MOVE_STOP());
+ //FSM_SIGNAL(MOTION, EV_MOVE_STOP, NULL);
}
target->use_planning = planning;
if (tc) target->tc = *tc;
else target->tc = trajectoryConstraintsDefault;
-
- /*TODO*/FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
+
+ robot.sched.queue_event(robot.MOTION, new EV_NEW_TARGET(target));
+// /*TODO*/FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
}
/**
double x, y, phi;
- robot.get_est_pos(&x, &y, &phi);
+ robot.get_est_pos(x, y, phi);
x += distance*cos(phi);
y += distance*sin(phi);
target->y = y;
target->heading = heading;
target->trajectory = t;
- /*TODO*/FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
+ robot.sched.queue_event(robot.MOTION, new EV_NEW_TARGET(target));
+// /*TODO*/FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
delete t;
}
#include <ul_log.h>
#include "guard.hpp"
#include "robot.h"
+#include "events.h"
UL_LOG_CUST(ulogd_robot_orte); /* Log domain name = ulogd + name of the file */
{
struct robot_pos_type *instance = (struct robot_pos_type *)vinstance;
- robot.get_est_pos(&instance->x, &instance->y, &instance->phi);
+ robot.get_est_pos(instance->x, instance->y, instance->phi);
}
void send_dummy_cb(const ORTESendInfo *info, void *vinstance,
robot.status[COMPONENT_START] = STATUS_OK;
/* Competition starts when plugged out */
if (instance->start_condition) {
- FSM_SIGNAL(MAIN, EV_START, NULL);
+ robot.sched.queue_event(robot.MAIN, new EV_START());
+ //FSM_SIGNAL(MAIN, EV_START, NULL);
robot.start_state = COMPETITION_STARTED;
ul_logmsg("STARTED\n");
}
instance->response.right != last_response_right &&
instance->response.left == act.jaw_left_get_last_request() &&
instance->response.left == act.jaw_right_get_last_request())
- FSM_SIGNAL(MAIN, EV_JAWS_DONE, NULL);
+ robot.sched.queue_event(robot.MAIN, new EV_JAWS_DONE());
+
+// FSM_SIGNAL(MAIN, EV_JAWS_DONE, NULL);
last_response_left = instance->response.left;
last_response_right = instance->response.right;
if (instance->response != last_response &&
instance->response == act.lift_get_last_request())
- FSM_SIGNAL(MAIN, EV_LIFT_DONE, NULL);
+ robot.sched.queue_event(robot.MAIN, new EV_LIFT_DONE());
+
+// FSM_SIGNAL(MAIN, EV_LIFT_DONE, NULL);
last_response = instance->response;
break;
case DEADLINE:
if (!last_strategy && instance->strategy) {
/* strategy switching */
- FSM_SIGNAL(MAIN, EV_SWITCH_STRATEGY, NULL);
+ robot.sched.queue_event(robot.MAIN, new EV_SWITCH_STRATEGY());
+
+// FSM_SIGNAL(MAIN, EV_SWITCH_STRATEGY, NULL);
}
last_strategy = instance->strategy;
break;
switch (info->status) {
case NEW_DATA:
if (instance->bumper_right_across || instance->bumper_left_across || instance->bumper_rear_left || instance->bumper_rear_right)
- FSM_SIGNAL(MOTION, EV_OBSTACLE_BEHIND, NULL);
+robot.sched.queue_event(robot.MOTION, new EV_OBSTACLE_BEHIND());
+
+ // FSM_SIGNAL(MOTION, EV_OBSTACLE_BEHIND, NULL);
if (instance->bumper_left || instance->bumper_right) {
- FSM_SIGNAL(MOTION, EV_OBSTACLE_SIDE, NULL);
+ robot.sched.queue_event(robot.MOTION, new EV_OBSTACLE_SIDE());
+
+ // FSM_SIGNAL(MOTION, EV_OBSTACLE_SIDE, NULL);
}
break;
case DEADLINE: