Skip to content
Snippets Groups Projects
Commit 4e5c092a authored by Hoop77's avatar Hoop77
Browse files

logging node added

parent 08fd0370
No related merge requests found
#include <pluginlib/class_list_macros.h>
#include <ros/ros.h>
#include "ultrasonic/ultrasonic.h"
#include "car/ussDataMsg.h"
PLUGINLIB_EXPORT_CLASS(car::Ultrasonic, nodelet::Nodelet);
namespace car
{
Ultrasonic::Ultrasonic(ros::NodeHandle &nh, std::string &name) : nh_(nh), name_(name) {}
Ultrasonic::Ultrasonic() {}
Ultrasonic::~Ultrasonic() {}
void Ultrasonic::onInit()
{
NODELET_INFO("Ultrasonic::onInit -- START");
ussData = nh_.advertise<ussDataMsg>("ussData", 1);
main = boost::thread([this] () {
int counter = 0;
ros::Rate rate{1};
while(ros::ok()) {
ussDataMsg msg;
msg.distance = counter++;
ussData.publish(msg);
rate.sleep();
}
});
NODELET_INFO("Ultrasonic::onInit -- END");
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment