4 * Movement test: goto test.
6 * Copyright: (c) 2007 CTU Dragons
7 * CTU FEE - Department of Control Engineering
12 #include <movehelper.h>
15 #include <path_planner.h>
27 UL_LOG_CUST(ulogd_lineavoid); /* Log domain name = ulogd + name of the file */
29 FSM_STATE_DECL(robot_goto_test);
30 FSM_STATE_DECL(error);
33 /* Where we are at the begining? */
39 FSM_TRANSITION(robot_goto_test);
40 if (!robot.localization_works) {
41 robot_set_est_pos_trans(PLAYGROUND_WIDTH_M/2,
42 PLAYGROUND_HEIGHT_M/2,
50 FSM_STATE(robot_goto_test)
53 static bool direction = false;
54 struct TrajectoryConstraints tc = trajectoryConstraintsDefault;
58 robot_get_est_pos(&px, &py, &phi);
60 goalx = MAP_PLAYGROUND_WIDTH_M - 0.35;
64 goaly = MAP_PLAYGROUND_HEIGHT_M / 2.0;
67 ul_logdeb("making the robot move to %f, %f\n", goalx, goaly);
68 robot_goto_notrans(goalx, goaly, NO_TURN(), &tc);
70 direction = !direction;
73 FSM_TRANSITION(error);
76 ul_logdeb("Goal is not reachable\n");
77 FSM_TRANSITION(robot_goto_test);
96 if (rv) error(1, errno, "robot_init() returned %d\n", rv);
99 robot.fsm.main.debug_states = 1;
100 robot.fsm.motion.debug_states = 1;
101 robot.obstacle_avoidance_enabled = true;
103 robot.fsm.main.state = &fsm_state_main_init;
106 if (rv) error(1, errno, "robot_start() returned %d\n", rv);