void InflationLayer::onInitialize()
{
  {
    boost::unique_lock < boost::shared_mutex > lock(*access_);
    ros::NodeHandle nh("~/" + name_), g_nh;
    current_ = true;
    seen_ = NULL;
    need_reinflation_ = false;

    dynamic_reconfigure::Server<costmap_2d::InflationPluginConfig>::CallbackType cb = boost::bind(
        &InflationLayer::reconfigureCB, this, _1, _2);
  
    if(dsrv_ != NULL){
      dsrv_->clearCallback();
      dsrv_->setCallback(cb);
    }
    else
    {
      dsrv_ = new dynamic_reconfigure::Server<costmap_2d::InflationPluginConfig>(ros::NodeHandle("~/" + name_));
      dsrv_->setCallback(cb);
    }

  }

  matchSize();
}
示例#2
0
int parseCommand(token *tok, char **s)
{
	int line;
	int r;

	if (matchNumber(tok, s))
	{
		line = tok->n;
		if (!matchWhiteSpace(tok, s)) // delete line
			return deleteLine(line);
		else	// add line
		{
			matchString(tok, s);
			return insertLine(line, tok->s);
		}
	}

	if (matchSize(tok, s))
	{
		puts(itos(programGetSize()));
		return 1;
	}

	if (matchFree(tok, s))
	{
		puts(itos(programGetFree()));
		return 1;
	}

  if (matchClear(tok, s))
	{
		programInit();
		return 1;
	}

	if (matchBye(tok, s))
	{
		exit(0);
	}

	if (parseRun(tok, s))
		return 1;
	else if (errorGet() != ERROR_OK) return 0;

	if (parseList(tok, s))
		return 1;
	else if (errorGet() != ERROR_OK) return 0;

	programSetMode(progModeImmediate);
	r = parseLine(tok, s);
	programSetMode(progModeStored);

	return r;
}
void GridLayer::onInitialize()
{
  ros::NodeHandle nh("~/" + name_);
  current_ = true;
  default_value_ = NO_INFORMATION;
  matchSize();

  dsrv_ = new dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig>(nh);
  dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig>::CallbackType cb = boost::bind(
      &GridLayer::reconfigureCB, this, _1, _2);
  dsrv_->setCallback(cb);
}
示例#4
0
void VirtualWallLayer::onInitialize()
{
    ros::NodeHandle pnh("~/" + name_), nh;
    current_ = true;
    default_value_ = NO_INFORMATION;
    matchSize();

    dsrv_ = new dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig>(pnh);
    dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig>::CallbackType cb = boost::bind(
                &VirtualWallLayer::reconfigureCB, this, _1, _2);
    dsrv_->setCallback(cb);

    subscriber = nh.subscribe ("walls", 100, &VirtualWallLayer::onWallMessageCallback, this);
}
示例#5
0
void VoxelLayer::reconfigureCB(costmap_2d::VoxelPluginConfig &config, uint32_t level)
{
  enabled_ = config.enabled;
  max_obstacle_height_ = config.max_obstacle_height;
  size_z_ = config.z_voxels;
  origin_z_ = config.origin_z;
  z_resolution_ = config.z_resolution;
  unknown_threshold_ = config.unknown_threshold + (VOXEL_BITS - size_z_);
  mark_threshold_ = config.mark_threshold;
  combination_method_ = config.combination_method;
  if(clear_old_){
    locations_utime.setCheckOtherTopicsBeforeClearing(config.check_other_topics_before_clearing);
  }
  inflation_radius_ = config.inflation_radius;
  ROS_WARN("Inflation radius : %f", inflation_radius_);

  matchSize();
}
示例#6
0
void InflationLayer::onInitialize()
{
  ros::NodeHandle nh("~/" + name_), g_nh;
  current_ = true;
  seen_ = NULL;
  need_reinflation_ = false;

  if(dsrv_ != NULL){
    delete dsrv_;
  }

  dsrv_ = new dynamic_reconfigure::Server<costmap_2d::InflationPluginConfig>(ros::NodeHandle("~/" + name_));
  dynamic_reconfigure::Server<costmap_2d::InflationPluginConfig>::CallbackType cb = boost::bind(
      &InflationLayer::reconfigureCB, this, _1, _2);
  dsrv_->setCallback(cb);

  matchSize();
}
  void BallPickerLayer::onInitialize()
  {
    ros::NodeHandle nh("~/" + name_), g_nh;

    nh.param("robot_base_frame", robot_base_frame_, std::string("base_link"));
    nh.param("robot_global_frame", global_frame_, std::string("/map"));

    ros::NodeHandle prefix_nh;
    std::string tf_prefix = tf::getPrefixParam(prefix_nh);

    global_frame_ = tf::resolve(tf_prefix, global_frame_);
    robot_base_frame_ = tf::resolve(tf_prefix, robot_base_frame_);

    confirm_update_client = nh.serviceClient<std_srvs::Empty>("/confirm_updated_costmap");    

    while (!tfl.waitForTransform(global_frame_, robot_base_frame_, ros::Time::now(), ros::Duration(1.0)))
    {
      ROS_WARN_THROTTLE(1.0, "Transofrm for looking up robot pose not available.");
      ros::spinOnce();
    }


    obstacle_buffer.clear();
    obstacles_sub = g_nh.subscribe("costmap_custom_obstacles", 1, &BallPickerLayer::obstaclesIncomeCallback, this);

    clear_srv = nh.advertiseService("ball_picker_clear_costmaps", &BallPickerLayer::clearObstacles, this);

    clear_flag = false;
    current_ = true;
    default_value_ = NO_INFORMATION;
    matchSize();

    dsrv_ = new dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig>(nh);
    dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig>::CallbackType cb = boost::bind(&BallPickerLayer::reconfigureCB, this, _1, _2);
    dsrv_->setCallback(cb);
  }