コード例 #1
0
int
main(int argc, char **argv)
{
	signal(SIGINT, signal_handler);

	carmen_ipc_initialize(argc, argv);

	carmen_param_check_version(argv[0]);

	define_messages();

	//read_parameters(argc, argv);

	//select_wave_form();

	carmen_ipc_addPeriodicTimer(timer_period, timer_handler, NULL);
	//build_trajectory_stop_smooth_trajectory_phi();
	//carmen_ipc_addPeriodicTimer(timer_period, phi_handler, NULL);
	//carmen_ipc_addPeriodicTimer(4.0, vel_handler, NULL);
	carmen_ipc_dispatch();

	return 0;
}
コード例 #2
0
int
main(int argc, char **argv)
{
	double x, y, theta, timestamp;
	int num_messages_per_second;

	if (argc < 5)
	{
		printf("Use %s <num messages per second> <x> <y> <theta>\n", argv[0]);
		exit(-1);
	}

	num_messages_per_second = atoi(argv[1]);

	x = atof(argv[2]);
	y = atof(argv[3]);
	theta = atof(argv[4]);

	carmen_ipc_initialize(argc, argv);
	define_messages();

	double sleep_time = (1.0 / (double) num_messages_per_second) * 10e5;

	while (1)
	{
		timestamp = carmen_get_time();

		publish_fused(x, y, theta, timestamp);
		publish_globalpos(x, y, theta, timestamp);
		usleep((int) sleep_time);

		printf("Published globalpos(%lf, %lf, %lf) at timestamp %lf\n", x, y, theta, timestamp);
	}

	return 0;
}