void
build_trajectory_stop_smooth_trajectory_phi() //This function allows to create a trapezium shaped motion command
{
	for (int i = 0; i < 50; i++)
	{
		motion_commands_vector[i].v = 4.0;
		motion_commands_vector[i].phi = 0.0;//t * (max_phi / t1);
		motion_commands_vector[i].time = 0.1;//delta_t;
	}
	//printf("i = %d, NUM_MOTION_COMMANDS_PER_VECTOR = %d\n", i, NUM_MOTION_COMMANDS_PER_VECTOR);
	for (int i = 0; i < 999; i++)
	{
		send_trajectory_to_robot();
	}
}
Esempio n. 2
0
static void
generate_next_motion_command(void)
{
	carmen_ackerman_traj_point_t waypoint;
	int waypoint_index = 0;
	int waypoint_status = 0;

	if (!autonomous_status)
		return;

	waypoint = g_robot_position;
	if (current_state == BEHAVIOR_SELECTOR_FOLLOWING_LANE)
		waypoint_status = next_waypoint(&waypoint, &waypoint_index);

	if (current_state == BEHAVIOR_SELECTOR_PARKING)
		waypoint_status = next_waypoint_astar(&waypoint);

	if (waypoint_status > 0) /* Goal reached? */
	{
		//	clear_current_trajectory();
		stop_robot();
		return;
	}

	if (waypoint_status < 0) /* There is no path to the goal? */
	{
		//	clear_current_trajectory();
		stop_robot();
		return;
	}

	if (current_state == BEHAVIOR_SELECTOR_FOLLOWING_LANE)
		send_trajectory_to_robot(path.path + waypoint_index, path.path_size - waypoint_index);

	if (current_state == BEHAVIOR_SELECTOR_PARKING)
		publish_astar_path(path.path + waypoint_index, path.path_size - waypoint_index, g_robot_position);
	//teste_stop(0.1, 2.0);

}