当前位置: 首页>>代码示例>>C++>>正文


C++ NodeHandle::subscribe方法代码示例

本文整理汇总了C++中ros::NodeHandle::subscribe方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeHandle::subscribe方法的具体用法?C++ NodeHandle::subscribe怎么用?C++ NodeHandle::subscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ros::NodeHandle的用法示例。


在下文中一共展示了NodeHandle::subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MyClass

  MyClass()
    :pnh("~")
  {
    sub = nh.subscribe("/humans/kinect_v2", 1, &MyClass::callback, this);
    pub =  nh.advertise<std_msgs::String>("/pub_topic", 1); 

    pnh.param<std::string>("output", output_filename, "test.json");
    out_file << output_filename << ".json";

    joint_filename = "joint_index.txt";
    init_table(joint_filename);
  }
开发者ID:cvpapero,项目名称:body_motion_analysis,代码行数:12,代码来源:joint_angle2.cpp

示例2: BehaviorBase

        BehaviorBase() : nh("~") {
            // scanSub = nh.subscribe("scans",1,&CollisionAvoidance::pc_callback,this);
            scanSub = nh.subscribe("scans",1,&BehaviorBase::pc_callback,this);
            velPub = nh.advertise<geometry_msgs::Twist>("vel_output",1);

            nh.param("max_linear_speed",max_linear_speed, 0.0);
            nh.param("max_angular_speed",max_angular_speed, 1.0);
            nh.param("desired_range",desired_range, 1.0);
            nh.param("k_r",k_r, 1.0);
            nh.param("k_alpha",k_alpha, 1.0);

        }
开发者ID:achuwilson,项目名称:vrep_ros_stack,代码行数:12,代码来源:behavior_follow.cpp

示例3: SpeechRecog

  SpeechRecog() 
  {

    speech_sub 
      = nh.subscribe("mecab_res", 1, 
		    &SpeechRecog::speechCallback, this);

    okao_sub
      = nh.subscribe("/humans/RecogInfo", 1,
		    &SpeechRecog::okaoCallback, this);


    word_srv 
      = nh.advertiseService("word_search",
			    &SpeechRecog::wordSearchCallback, this);
    //recog_pub_ = 
    //  nh.advertise<humans_msgs::Humans>("/humans/RecogInfo", 1);

    //ファイルからメモリにこれまでの単語情報を書き込む機能

  }
开发者ID:chinjao,项目名称:ros_src,代码行数:21,代码来源:speech_recog2.cpp

示例4: n

ExportVtk::ExportVtk(ros::NodeHandle& n):
    n(n),
    cloudTopic(getParam<string>("cloudTopic", "/static_point_cloud")),
    mapFrame(getParam<string>("mapFrameId", "/map")),
    recordOnce(getParam<bool>("recordOnce", "false")),
    transformation(PM::get().TransformationRegistrar.create("RigidTransformation"))
{
    // ROS initialization
    cloudSub = n.subscribe(cloudTopic, 100, &ExportVtk::gotCloud, this);

    // Parameters for 3D map
}
开发者ID:ihmcrobotics,项目名称:ihmc-open-robotics-software,代码行数:12,代码来源:pointCloudToVtk.cpp

示例5: createSubscribers

void PinholeRGBDevice::createSubscribers(ros::NodeHandle & nh,
                                         image_transport::ImageTransport & image_transport_nh,
                                         const std::string & main_topic)
{
  std::stringstream ss;
  ss << main_topic << "/image";
  image_sub_ = image_transport_nh.subscribe(ss.str(), 1, &PinholeRGBDevice::imageCallback, this);

  ss.str("");
  ss << main_topic << "/camera_info";
  camera_info_sub_ = nh.subscribe(ss.str(), 1, &PinholeRGBDevice::cameraInfoCallback, this);
}
开发者ID:GangDesign,项目名称:open_ptrack,代码行数:12,代码来源:ros_device.cpp

示例6: OculusDb

 OculusDb(char choice) : 
   dbhost("192.168.4.170"),
   dbuser("root"),
   dbpass("tmsdb"),
   dbname("rostmsdb"),
   choice(choice)
 {
   //Init Vicon Stream
   ROS_ASSERT(init_oculusdb());
   // Subscriber for tms_db_data topic
   data_sub = nh.subscribe("tms_db_data", 100, &OculusDb::ocMoveCallback, this);
 }  
开发者ID:irvs,项目名称:tms_dev_oculus,代码行数:12,代码来源:oculus_move.cpp

示例7: ImageConverter

  ImageConverter()
    : it_(nh_)
  {

    x = 0;
    y = 0;

    image_sub_ = it_.subscribe("image", 1, &ImageConverter::imageCb, this);
    axis_sub = nh_.subscribe("input_joy", 1, &ImageConverter::axis, this);
    
    cv::namedWindow(WINDOW);
  }
开发者ID:Modasshir,项目名称:socrob-ros-pkg,代码行数:12,代码来源:hub_node.cpp

示例8:

	Explore(std::string name):
		as_(nh_, name, false),
		action_name_(name),
		ac_("move_base", true)
	{
		explore_state_ = STOP;
		explore_ = false;
		firstGoalSend = false;
		
		as_.registerGoalCallback(boost::bind(&Explore::goalCB, this));
		as_.registerPreemptCallback(boost::bind(&Explore::preemptCB, this));

		as_.start();

		alghoritm_state_sub_ =   nh_.subscribe("alghoritm_state", 1, &Explore::alghoritmStateCallBack, this);
		posSub = nh_.subscribe("/amcl_pose", 1, &Explore::poseCallback, this);
		deadlock_service_state_sub = nh_.subscribe("/deadlock_service_state", 1, &Explore::deadlockServiceStateCb, this);


		
	}
开发者ID:iarczi,项目名称:elektron_ballcollector,代码行数:21,代码来源:explore.cpp

示例9: initHandlers

void BaseStation::initHandlers(ros::NodeHandle & node) {
    getObstaclesPositionService = node.advertiseService("basestation/getObstaclesPosition", &BaseStation::getObstaclesPosition, this);
    findRobotPositionAndAngleService = node.advertiseService("basestation/findRobotPositionAndAngle", &BaseStation::findRobotPositionAndAngle, this);
    showSolvedSudocubeService = node.advertiseService("basestation/showSolvedSudocube", &BaseStation::showSolvedSudocube, this);
    traceRealTrajectoryService = node.advertiseService("basestation/traceRealTrajectory", &BaseStation::traceRealTrajectory, this);
    loopEndedService = node.advertiseService("basestation/loopEnded", &BaseStation::loopEnded, this);

    startLoopClient = node.serviceClient<kinocto::StartLoop>("kinocto/startLoop");
    setRobotPositionAndAngleClient = node.serviceClient<kinocto::SetRobotPositionAndAngle>("kinocto/setRobotPositionAndAngle");

    updateRobotSubscriber = node.subscribe("basestation/updateRobotPosition", 50, &BaseStation::updateRobotPosition, this);
}
开发者ID:francisvalois,项目名称:design3,代码行数:12,代码来源:BaseStation.cpp

示例10: VelocitySmootherNode

  VelocitySmootherNode(): nh_(), pnh_("~") {
    latest_time_ = ros::Time::now();

    dyn_srv_ = boost::make_shared<dyn::Server<Config> >(pnh_);
    dyn::Server<Config>::CallbackType f = boost::bind(&VelocitySmootherNode::dynConfigCallback, this, _1, _2);
    dyn_srv_->setCallback(f);
    
    pub_vel_ = boost::shared_ptr<geometry_msgs::Twist>(new geometry_msgs::Twist());
    pub_ = nh_.advertise<geometry_msgs::Twist>("output", 100);
    sub_ = nh_.subscribe("input", 1, &VelocitySmootherNode::velCallback, this);
    timer_ = nh_.createTimer(timerDuration(), &VelocitySmootherNode::timerCallback, this);
  };
开发者ID:furushchev,项目名称:cmd_vel_smoother,代码行数:12,代码来源:cmd_vel_smoother.cpp

示例11:

		Odometry() {
			
			q = Eigen::Quaterniond(1.0, 0.0, 0.0, 0.0);
			
			first_odo = true;
			
			sub_odo = n.subscribe("input_odo", 1, &Odometry::getOdo, this);		
			sub_imu = n.subscribe("input_imu", 1, &Odometry::getImu, this);	
			
			pub_data = n.advertise<nav_msgs::Odometry>("output_pose", 1);			
				
		};
开发者ID:Modasshir,项目名称:socrob-ros-pkg,代码行数:12,代码来源:raposang_odometry.hpp

示例12: main

int main()
{
  buzzer = 0;
  led = 1;
  nh.initNode();
  nh.subscribe(sub);
  while (1)
  {
    nh.spinOnce();
    wait_ms(1);
  }
}
开发者ID:CMUBOOST,项目名称:BOOST_Stalker,代码行数:12,代码来源:GroveBuzzer.cpp

示例13: infoCallback

 void infoCallback(const sensor_msgs::CameraInfoConstPtr& info_msg)
 {
   if (calibrated)
     return;
   cam_model_.fromCameraInfo(info_msg);
   pattern_detector_.setCameraMatrices(cam_model_.intrinsicMatrix(), cam_model_.distortionCoeffs());
   
   calibrated = true;
   image_sub_ = nh_.subscribe("/camera/rgb/image_mono", 1, &CalibrateKinectCheckerboard::imageCallback, this);
   
   ROS_INFO("[calibrate] Got image info!");
 }
开发者ID:chazmatazz,项目名称:clam,代码行数:12,代码来源:calibrate_kinect_checkerboard.cpp

示例14: BaseMotionController

 BaseMotionController( ros::NodeHandle &n ,float x,float y, float roll,float pitch,float yaw):node_handler(n)
 {
      xval = x;
      yval = y;
      rollval=roll;
      pitchval=pitch;
      yawval = yaw;
      // Velocity control for the YouBot base.
      base_velocities_publisher = node_handler.advertise<geometry_msgs::Twist>( "/cmd_vel", 1 );
      base_odom = node_handler.subscribe("/odom", 1, &BaseMotionController::OdomCallback, this);
      odom_received = false;
 }
开发者ID:RC4Group2,项目名称:ResearchCamp4,代码行数:12,代码来源:relative_movements.cpp

示例15:

// Constructeur
Communication_API_schneider::Communication_API_schneider(ros::NodeHandle noeud,const std::string num_API)
{
	// Publishers
	pub_sorties = noeud.advertise<automates::Sorties>("/automates/Sorties_ap"+num_API, 1);

	// Subscriber
	sub_entrees = noeud.subscribe("/automates/Entrees_ap"+num_API, 1, &Communication_API_schneider::Callback_Entrees_api,this);


	entrees_api=0;
	sorties_api=0;
}
开发者ID:dtbinh,项目名称:M1_ISTR,代码行数:13,代码来源:communication.cpp


注:本文中的ros::NodeHandle::subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。