Skip to content
Snippets Groups Projects
Commit 6fb3194d authored by Hoop77's avatar Hoop77
Browse files

-

parent 28140796
No related merge requests found
......@@ -5,6 +5,7 @@
#include <ros/ros.h>
#include "boost/thread.hpp"
#include "USS_SRF02.h"
#include <thread>
namespace car
{
......@@ -20,7 +21,7 @@ namespace car
ros::NodeHandle nh_;
std::string name_;
ros::Publisher ussData;
boost::thread main;
std::thread main;
};
}
#endif
......@@ -23,14 +23,14 @@ void Ultrasonic::onInit()
{
NODELET_INFO("Ultrasonic::onInit -- START");
ussData = nh_.advertise<ussDataMsg>("ussData", 1);
main = boost::thread(
[this]()
main = std::thread(
[this]
{
for (;;)
{
ussDataMsg msg;
auto distance = getDistance();
std::cout << "distance: " << distance << "\n";
NODELET_INFO("distance: %d\n", distance);
msg.distance = distance;
ussData.publish(msg);
}
......
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