Skip to content
Snippets Groups Projects
Commit 9c58f25c authored by Hoop77's avatar Hoop77
Browse files

Merge branch 'master' of gitlab.informatik.hu-berlin.de:badenhop/Hochautomatisiertes-Fahren

parents a77fae92 17278dc3
No related merge requests found
#ifndef CAMERA_H
#define CAMERA_H
#include <nodelet/nodelet.h>
#include <ros/ros.h>
#include "boost/thread.hpp"
namespace car
{
class Camera : public nodelet::Nodelet
{
public:
virtual void onInit();
Camera(ros::NodeHandle &nh, std::string &name);
Camera();
~Camera();
private:
ros::NodeHandle nh_;
std::string name_;
ros::Publisher camData;
boost::thread main;
};
}
#endif
#include <pluginlib/class_list_macros.h>
#include <ros/ros.h>
#include "camera/camera.h"
#include "car/camDataMsg.h"
PLUGINLIB_EXPORT_CLASS(car::Camera, nodelet::Nodelet);
namespace car
{
Camera::Camera(ros::NodeHandle &nh, std::string &name) : nh_(nh), name_(name) {}
Camera::Camera() {}
Camera::~Camera() {}
void Camera::onInit()
{
NODELET_INFO("Camera::onInit -- START");
camData = nh_.advertise<camDataMsg>("camData", 1);
main = boost::thread([this] () {
ros::Rate rate{1};
while(ros::ok()) {
camDataMsg msg;
camData.publish(msg);
rate.sleep();
}
});
NODELET_INFO("Camera::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