#include <time.h>
#include "trgen.h"
#include "balet.h"
-#include <robodata.h>
+#include "robodata.h"
#include <robot.h>
#include <pthread.h>
#include <path_planner.h>
#include <robomath.h>
#include "motion-control.h"
#include <hokuyo.h>
+ #include <ul_log.h>
+
+ UL_LOG_CUST(ulogd_fsmmove); /* Log domain name = ulogd + name of the file */
#ifdef MOTION_DEBUG
- #define DBG(format, ...) printf(format, ##__VA_ARGS__)
+ #define DBG(format, ...) ul_logdeb(format, ##__VA_ARGS__)
#else
#define DBG(format, ...)
#endif
Pos pos;
if (!t) {
- printf("ERROR: No trajectory\n");
+ ul_logerr("ERROR: No trajectory\n");
return TARGET_ERROR;
}
// FIXME: This is duplicite code with new_goal. Remove this
case TARGET_OK:
break;
case TARGET_ERROR:
- printf("Target error on recalculation_in_progress\n");
+ ul_logerr("Target error on recalculation_in_progress\n");
break;
case TARGET_INACC:
break;
switch (ret) {
case TARGET_OK: FSM_TRANSITION(movement); break;
case TARGET_INACC: FSM_TRANSITION(wait_and_try_again); break;
- case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL); printf("Target error\n"); break;
+ case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL); ul_logerr("Target error\n"); break;
}
free(FSM_EVENT_PTR);
break;
case TARGET_INACC: FSM_TRANSITION(wait_and_try_again); break;
// Fatal error during planning
case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL);
- printf("Target error\n");
+ ul_logerr("Target error\n");
/* FIXME (Filip): shouldn't transition to wait_for_command be here?
No, probably not, if an error occurs, robot won't move any more
and we can recognize the error. */
switch (recalculate_trajectory()) {
case TARGET_OK: FSM_TRANSITION(movement); break;
case TARGET_INACC: FSM_TRANSITION(wait_and_try_again); break;
- case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL); printf("Target error\n"); break;
+ case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL); ul_logerr("Target error\n"); break;
}
break;
case EV_MOVE_STOP:
// Target inaccessible because of an obstacle
case TARGET_INACC:
FSM_TRANSITION(wait_and_try_again);
- printf("Inaccessible\n");
+ ul_logerr("Inaccessible\n");
FSM_TIMER(1000);
/* FIXME (Filip): this could happen forever */
break;
// Fatal error during planning
- case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL); printf("Target error\n"); break;
+ case TARGET_ERROR: FSM_SIGNAL(MAIN, EV_MOTION_DONE, NULL); ul_logerr("Target error\n"); break;
}
break;
case EV_TRAJECTORY_DONE:
#endif
#define FSM_MAIN
-#include <robodata.h>
#include <robot.h>
#include <fsm.h>
#include <unistd.h>
#include <trgen.h>
#include "match-timing.h"
#include "eb2010misc.h"
+ #include <ul_log.h>
+
+ UL_LOG_CUST(ulogd_homologation); /* Log domain name = ulogd + name of the file */
/************************************************************************
* Trajectory constraints used, are initialized in the init state
{
pthread_t thid;
#ifdef WAIT_FOR_START
- printf("WAIT_FOR_START mode set\n");
+ ul_logdeb("WAIT_FOR_START mode set\n");
#else
- printf("WAIT_FOR_START mode NOT set\n");
+ ul_logdeb("WAIT_FOR_START mode NOT set\n");
#endif
#ifdef COMPETITION
- printf("COMPETITION mode set\n");
+ ul_logdeb("COMPETITION mode set\n");
#else
- printf("COMPETITION mode NOT set\n");
+ ul_logdeb("COMPETITION mode NOT set\n");
#endif
switch (FSM_EVENT) {
case EV_ENTRY:
case EV_TIMER:
FSM_TIMER(500);
act_vidle((VIDLE_UP - VIDLE_DOWN)*cnt/3 + VIDLE_DOWN, VIDLE_FAST_SPEED);
- printf("--------------------cnt: %d\n", cnt);
+ ul_logdeb("--------------------cnt: %d\n", cnt);
cnt++;
if(cnt >= 3) {
robot_exit();
case EV_ENTRY: {
double x, y, phi;
robot_get_est_pos(&x, &y, &phi);
- printf("approach_next_corn: puck cnt: %d, est pos %.3f, %.3f, %.3f\n",
+ ul_logdeb("approach_next_corn: puck cnt: %d, est pos %.3f, %.3f, %.3f\n",
cnt, x, y, phi);
corn_to_get = choose_next_corn();
} else {
x = PLAYGROUND_WIDTH_M - corn_to_get->position.x;
}
- printf("x = %.3f, %.3f \n", x, corn_to_get->position.y);
+ ul_logdeb("x = %.3f, %.3f \n", x, corn_to_get->position.y);
remove_wall_around_corn(x, corn_to_get->position.y);
robot_goto_trans(PLAYGROUND_WIDTH_M - 0.4, 0.15, ARRIVE_FROM(DEG2RAD(-90), 0.02), &tcFast);
where_to_go = TURN_AROUND;
//#define MOTION_DEBUG
#ifdef MOTION_DEBUG
- #define DBG(format, ...) printf(format, ##__VA_ARGS__)
+ #define DBG(format, ...) ul_logdeb(format, ##__VA_ARGS__)
#define DBGflush() fflush(stdout)
#else
#define DBG(format, ...)
#include <time.h>
#include "trgen.h"
#include "balet.h"
-#include <robodata.h>
+#include "robodata.h"
#include <robot.h>
#include <pthread.h>
#include <path_planner.h>
#include <map.h>
#include "robot_config.h"
#include <robomath.h>
+ #include <ul_log.h>
+
+ UL_LOG_CUST(ulogd_motion_control); /* Log domain name = ulogd + name of the file */
#define MOTION_CONTROL
#include "motion-control.h"
#ifdef MOTION_PRINT_REF
static double last_t;
if (t < last_t) last_t = t; // Switched to a new trajectory
- printf("rx=%5.02f ry=%5.02f, rphi=%4.0f v=%-4.02f omega=%-4.02f, time=%lf dt=%lf \n", ref_pos.x, ref_pos.y, ref_pos.phi/M_PI*180, ref_pos.v, ref_pos.omega, t, t-last_t);
+ ul_logdeb("rx=%5.02f ry=%5.02f, rphi=%4.0f v=%-4.02f omega=%-4.02f, time=%lf dt=%lf \n", ref_pos.x, ref_pos.y, ref_pos.phi/M_PI*180, ref_pos.v, ref_pos.omega, t, t-last_t);
fflush(stdout);
last_t = t;
#endif
*/
#include <trgen.h>
-#include <robodata.h>
+#include "robodata.h"
#include <robot.h>
#include <movehelper.h>
#include <path_simplifier.h>
#include <robomath.h>
#include <mcl_robot.h>
#include <string.h>
+ #include <ul_log.h>
+
+ UL_LOG_CUST(ulogd_movehelper); /* Log domain name = ulogd + name of the file */
#if 0
struct TrajectoryConstraints trajectoryConstraintsDefault = {
FSM_SIGNAL(MOTION, EV_NEW_TARGET, target);
robot.new_trajectory = NULL;
} else {
- printf("%s: Error - No trajectory\n", __FUNCTION__);
+ ul_logerr("%s: Error - No trajectory\n", __FUNCTION__);
}
}
#include <orte.h>
#include <roboorte_robottype.h>
-#include <robodata.h>
+#include "robodata.h"
#include <robot.h>
#include <movehelper.h>
#include <math.h>
#include <string.h>
#include <can_msg_def.h>
#include <actuators.h>
+ #include <ul_log.h>
+
+ UL_LOG_CUST(ulogd_robot_orte); /* Log domain name = ulogd + name of the file */
#ifdef ORTE_DEBUG
- #define DBG(format, ...) printf(format, ##__VA_ARGS__)
+ #define DBG(format, ...) ul_logdeb(format, ##__VA_ARGS__)
#else
#define DBG(format, ...)
#endif
if (!instance->start_condition) {
robot.status[COMPONENT_START] = STATUS_WARNING;
robot.start_state = START_PLUGGED_IN;
- printf("START_PLUGGED_IN\n");
+ ul_logmsg("START_PLUGGED_IN\n");
}
break;
if (instance->start_condition) {
FSM_SIGNAL(MAIN, EV_START, NULL);
robot.start_state = COMPETITION_STARTED;
- printf("STARTED\n");
+ ul_logmsg("STARTED\n");
}
break;