示例#1
0
int main (int argc, char *argv[])
{
	ros::init(argc, argv, "orb_matching", ros::init_options::AnonymousName);
	ros::start();
	ros::NodeHandle nodeHandler ("~");

	Matcher orb_matcher (nodeHandler, false);

	string odomTopic;
	nodeHandler.getParam("odometry_topic", odomTopic);
	FusionOdometry odom_pf (nodeHandler, odomTopic);

	odom_pf.setPoseFunction (
		[&]() -> ObservationList {
			ObservationList obs;
			tf::Transform visPose = orb_matcher.getCurrentRealPose();
			geometry_msgs::PoseWithCovarianceStamped pwv = tfToPoseCovarianceStamped (visPose);
			pwv.header.stamp = ros::Time (orb_matcher.getLastLocalizationTimestamp());
			obs.push_back(pwv);
			return obs;
		}
	);

	ros::spin();

	ros::shutdown();
}
int main(int argc, char** argv)
{
    ros::init(argc, argv, "simple_task_planner");
    ros::NodeHandle nodeHandler("simple_task_planner");

    TaskAdvertiser ta(nodeHandler);

    ros::spin();
}
int main (int argc, char** argv)
{
	//	Ros init
	ros::init(argc, argv, "computer_load_monitor");

	//	Node handler
	int update_rate;
	ros::NodeHandle nodeHandler("~");
	nodeHandler.param<int>("update_rate", update_rate, 5);
	ros::Rate loopRate(update_rate);

	//	loads (CPU/Memory)
	ros::Publisher memloadPub = nodeHandler.advertise<msgs::FloatStamped>("/fmInformation/memory_load", 5);
	msgs::FloatStamped memMsg;

	ros::Publisher cpuloadPub = nodeHandler.advertise<msgs::FloatStamped>("/fmInformation/cpu_load", 5);
	msgs::FloatStamped cpuMsg;

	//	Monitor message
	// ROS_INFO(" Monitoring CPU and memory load ...");

	while (ros::ok() && nodeHandler.ok())
	{
		//	Publish memory load
		memMsg.header.stamp = ros::Time::now();
		memMsg.data = getMemoryload(readFile(MEMORY_load));
		memloadPub.publish(memMsg);	//	Output is in range 0.0 to 1.0 as memory load

		//	Publish cpu load
		cpuMsg.header.stamp = ros::Time::now();
		cpuMsg.data = getCpuload(readFile(CPU_load));
		cpuloadPub.publish(cpuMsg);	//	Output is in range 0.0 to 1.0 as cpu load since last publish (averaged) across all siblings

		loopRate.sleep();
	}

	return 0;
}