void init_ipc() {

  carmen_localize_subscribe_globalpos_message(NULL,
					      (carmen_handler_t)localize_handler,
					      CARMEN_SUBSCRIBE_LATEST);

  carmen_roomnav_subscribe_room_message(NULL, (carmen_handler_t)room_handler,
					CARMEN_SUBSCRIBE_LATEST);

  carmen_roomnav_subscribe_path_message(NULL, (carmen_handler_t)path_handler,
					CARMEN_SUBSCRIBE_LATEST);

  carmen_roomnav_subscribe_goal_changed_message(NULL,
						(carmen_handler_t)
						goal_changed_handler,
						CARMEN_SUBSCRIBE_LATEST);
}
int main(int argc, char **argv)
{
  char filename[1024];
  char key;

  carmen_ipc_initialize(argc, argv);
  carmen_param_check_version(argv[0]);	

  if(argc < 2) 
    carmen_die("usage: %s <logfile>\n", argv[0]);

  sprintf(filename, "%s", argv[1]);

  outfile = carmen_fopen(filename, "r");
  if (outfile != NULL) {
    fprintf(stderr, "Overwrite %s? ", filename);
    scanf("%c", &key);
    if (toupper(key) != 'Y')
      exit(-1);
    carmen_fclose(outfile);
  }
  outfile = carmen_fopen(filename, "w");
  if(outfile == NULL)
    carmen_die("Error: Could not open file %s for writing.\n", filename);
  carmen_logwrite_write_header(outfile);

  carmen_robot_subscribe_frontlaser_message(NULL, 
					    (carmen_handler_t)robot_frontlaser_handler, 
					    CARMEN_SUBSCRIBE_ALL);
  localize_msg = (carmen_localize_globalpos_message *)
    calloc(1, sizeof(carmen_localize_globalpos_message));
  carmen_test_alloc(localize_msg);
  carmen_localize_subscribe_globalpos_message(localize_msg, NULL, CARMEN_SUBSCRIBE_ALL);

  logger_starttime = carmen_get_time();


  signal(SIGINT, shutdown_module);
  carmen_ipc_dispatch();
  return 0;
}
示例#3
0
int main(int argc, char **argv)
{
  char filename[1024];
  char key;
  int num_scanned;

  /* initialize connection to IPC network */
  carmen_ipc_initialize(argc, argv);
  carmen_param_check_version(argv[0]);	

  /* open logfile, check if file overwrites something */
  if(argc < 2) 
    carmen_die("usage: %s <logfile>\n", argv[0]);
  sprintf(filename, "%s", argv[1]);

  outfile = carmen_fopen(filename, "r");
  if (outfile != NULL) {
    fprintf(stderr, "Overwrite %s? ", filename);
    num_scanned = scanf("%c", &key);
    if (toupper(key) != 'Y')
      exit(-1);
    carmen_fclose(outfile);
  }
  outfile = carmen_fopen(filename, "w");
  if(outfile == NULL)
    carmen_die("Error: Could not open file %s for writing.\n", filename);
  carmen_logwrite_write_header(outfile);


  get_logger_params(argc, argv);

  if  ( !(log_odometry && log_laser && log_robot_laser ) )
    carmen_warn("\nWARNING: You are neither logging laser nor odometry messages!\n");
  


  if (log_params)
    get_all_params();

  register_ipc_messages();


  if (log_odometry) 
    carmen_base_subscribe_odometry_message(NULL, (carmen_handler_t)
					   base_odometry_handler, 
					   CARMEN_SUBSCRIBE_ALL);

  if (log_sonars) 
    carmen_base_subscribe_sonar_message(NULL, (carmen_handler_t)
					   base_sonar_handler, 
					   CARMEN_SUBSCRIBE_ALL);
  if (log_bumpers) 
    carmen_base_subscribe_bumper_message(NULL, (carmen_handler_t)
					   base_bumper_handler, 
					   CARMEN_SUBSCRIBE_ALL);

  if (log_arm) 
    carmen_arm_subscribe_state_message(NULL, (carmen_handler_t)
				       arm_state_handler, 
				       CARMEN_SUBSCRIBE_ALL);

  if (log_pantilt) {
    carmen_pantilt_subscribe_scanmark_message (NULL, (carmen_handler_t)
					       pantilt_scanmark_handler, 
					       CARMEN_SUBSCRIBE_ALL);
    
    carmen_pantilt_subscribe_laserpos_message (NULL, (carmen_handler_t)
					       pantilt_laserpos_handler, 
					       CARMEN_SUBSCRIBE_ALL);
  }

  if (log_robot_laser) {
    carmen_robot_subscribe_frontlaser_message(NULL, (carmen_handler_t)
					      robot_frontlaser_handler, 
					      CARMEN_SUBSCRIBE_ALL);
    carmen_robot_subscribe_rearlaser_message(NULL, (carmen_handler_t)
					     robot_rearlaser_handler, 
					     CARMEN_SUBSCRIBE_ALL);
  }

  if (log_laser) {
    carmen_laser_subscribe_laser1_message(NULL, (carmen_handler_t)
					  laser_laser1_handler, 
					  CARMEN_SUBSCRIBE_ALL);
    carmen_laser_subscribe_laser2_message(NULL, (carmen_handler_t)
					  laser_laser2_handler, 
					  CARMEN_SUBSCRIBE_ALL);
    carmen_laser_subscribe_laser3_message(NULL, (carmen_handler_t)
					  laser_laser3_handler, 
					  CARMEN_SUBSCRIBE_ALL);
    carmen_laser_subscribe_laser4_message(NULL, (carmen_handler_t)
					  laser_laser4_handler, 
					  CARMEN_SUBSCRIBE_ALL);
    carmen_laser_subscribe_laser5_message(NULL, (carmen_handler_t)
					  laser_laser5_handler, 
					  CARMEN_SUBSCRIBE_ALL);
  }

  if (log_localize) {
    carmen_localize_subscribe_globalpos_message(NULL, (carmen_handler_t)
						localize_handler,
						CARMEN_SUBSCRIBE_ALL);
  }

  if (log_simulator) {

    carmen_simulator_subscribe_truepos_message(NULL, (carmen_handler_t)  
					       carmen_simulator_truepos_handler,
					       CARMEN_SUBSCRIBE_ALL);
  }

  if (log_imu) {

    carmen_imu_subscribe_imu_message(NULL, (carmen_handler_t)  
				     imu_handler,
				     CARMEN_SUBSCRIBE_ALL);
  }
  
  
  if (log_gps) {
    carmen_gps_subscribe_nmea_message( NULL,
				       (carmen_handler_t) ipc_gps_gpgga_handler,
				       CARMEN_SUBSCRIBE_ALL );
    
    carmen_gps_subscribe_nmea_rmc_message( NULL,
					   (carmen_handler_t) ipc_gps_gprmc_handler,
					   CARMEN_SUBSCRIBE_ALL );
  }
  
  if (log_motioncmds) {
  	 carmen_robot_subscribe_vector_move_message( NULL,
  	 					 (carmen_handler_t) robot_vector_move_handler,
  	 					 CARMEN_SUBSCRIBE_ALL );
  	 carmen_robot_subscribe_follow_trajectory_message( NULL,
  	 					 (carmen_handler_t) robot_follow_trajectory_handler,
  	 					 CARMEN_SUBSCRIBE_ALL );
	 carmen_robot_subscribe_velocity_message( NULL,
	 					 (carmen_handler_t) robot_velocity_handler,
	 					 CARMEN_SUBSCRIBE_ALL );		
	 carmen_base_subscribe_velocity_message( NULL,
	 					 (carmen_handler_t) base_velocity_handler,
	 					 CARMEN_SUBSCRIBE_ALL );							 			 
  }

  carmen_logger_subscribe_comment_message( NULL,
  	 					 (carmen_handler_t) logger_comment_handler,
  	 					 CARMEN_SUBSCRIBE_ALL );

  signal(SIGINT, shutdown_module);
  logger_starttime = carmen_get_time();
  carmen_ipc_dispatch();
  return 0;
}
示例#4
0
void Carmen_Thread::register_handlers() {

    carmen_map_t map;


    carmen_map_get_gridmap(&map);
    set_map(&map);

    emit_map_changed_signal(map);

    carmen_map_subscribe_gridmap_update_message(
        NULL,
        (carmen_handler_t)map_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_grid_mapping_subscribe_message(NULL,
                                          (carmen_handler_t)grid_map_handler,
                                          CARMEN_SUBSCRIBE_LATEST);

    carmen_localize_ackerman_subscribe_globalpos_message(
        NULL,
        (carmen_handler_t)globalpos_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_simulator_ackerman_subscribe_truepos_message(
        NULL,
        (carmen_handler_t)truepos_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_simulator_subscribe_truepos_message(
        NULL,
        (carmen_handler_t)truepos_handler_diff,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_localize_ackerman_subscribe_particle_message(
        NULL,
        (carmen_handler_t)particle_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_localize_subscribe_globalpos_message(
        NULL,
        (carmen_handler_t)globalpos_handler_diff,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_laser_subscribe_frontlaser_message(
        NULL,
        (carmen_handler_t)laser_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_localize_ackerman_subscribe_sensor_message(
        NULL,
        (carmen_handler_t)localize_laser_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_navigator_ackerman_subscribe_plan_message(
        NULL,
        (carmen_handler_t)plan_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_navigator_subscribe_plan_message(
        NULL,
        (carmen_handler_t)plan_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_navigator_ackerman_subscribe_status_message(
        NULL,
        (carmen_handler_t) navigator_status_handler,
        CARMEN_SUBSCRIBE_LATEST);

    IPC_setMsgQueueLength(CARMEN_GRID_MAPPING_MESSAGE_NAME, 1);

    carmen_rrt_planner_subscribe_robot_tree_message(
        NULL,
        (carmen_handler_t)rrt_planner_robot_tree_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_rrt_planner_subscribe_goal_tree_message(
        NULL,
        (carmen_handler_t)rrt_planner_goal_tree_handler,
        CARMEN_SUBSCRIBE_LATEST);

    carmen_rrt_planner_subscribe_status_message(
        NULL,
        (carmen_handler_t)rrt_status_handler,
        CARMEN_SUBSCRIBE_LATEST);
}
示例#5
0
文件: hmap.c 项目: Paresh1693/carmen
static void ipc_init() {

  carmen_localize_subscribe_globalpos_message(NULL, (carmen_handler_t) localize_handler,
					      CARMEN_SUBSCRIBE_LATEST);
  carmen_map_subscribe_map_zone_message(NULL, (carmen_handler_t) map_zone_handler, CARMEN_SUBSCRIBE_LATEST);
}