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 robot_set_est_pos_trans(PLAYGROUND_WIDTH_M/2,
41 PLAYGROUND_HEIGHT_M/2,
48 FSM_STATE(robot_goto_test)
51 static bool direction = false;
52 struct TrajectoryConstraints tc = trajectoryConstraintsDefault;
56 robot_get_est_pos(&px, &py, &phi);
58 goalx = MAP_PLAYGROUND_WIDTH_M - 0.35;
62 goaly = MAP_PLAYGROUND_HEIGHT_M / 2.0;
65 ul_logdeb("making the robot move to %f, %f\n", goalx, goaly);
66 robot_goto_notrans(goalx, goaly, NO_TURN(), &tc);
68 direction = !direction;
71 FSM_TRANSITION(error);
74 ul_logdeb("Goal is not reachable\n");
75 FSM_TRANSITION(robot_goto_test);
94 if (rv) error(1, errno, "robot_init() returned %d\n", rv);
97 robot.fsm.main.debug_states = 1;
98 robot.fsm.motion.debug_states = 1;
99 robot.obstacle_avoidance_enabled = true;
101 robot.fsm.main.state = &fsm_state_main_init;
104 if (rv) error(1, errno, "robot_start() returned %d\n", rv);