status.cpp
Go to the documentation of this file.
1 
34 #include <multisense_ros/status.h>
35 
36 #include <multisense_ros/DeviceStatus.h>
37 
38 namespace multisense_ros {
39 
41  driver_(driver),
42  device_nh_(""),
43  status_pub_(),
44  status_timer_(),
45  subscribers_(0)
46 {
47  status_pub_ = device_nh_.advertise<multisense_ros::DeviceStatus>("status", 5,
48  boost::bind(&Status::connect, this),
49  boost::bind(&Status::disconnect, this));
50 
52 }
53 
55 {
56 }
57 
59 {
60  if (subscribers_ <= 0)
61  return;
62 
63  if (NULL != driver_)
64  {
66 
67  if (crl::multisense::Status_Ok == driver_->getDeviceStatus(statusMessage))
68  {
69  multisense_ros::DeviceStatus deviceStatus;
70 
71  deviceStatus.time = ros::Time::now();
72  deviceStatus.uptime = ros::Time(statusMessage.uptime);
73  deviceStatus.systemOk = statusMessage.systemOk;
74  deviceStatus.laserOk = statusMessage.laserOk;
75  deviceStatus.laserMotorOk = statusMessage.laserMotorOk;
76  deviceStatus.camerasOk = statusMessage.camerasOk;
77  deviceStatus.imuOk = statusMessage.imuOk;
78  deviceStatus.externalLedsOk = statusMessage.externalLedsOk;
79  deviceStatus.processingPipelineOk = statusMessage.processingPipelineOk;
80  deviceStatus.powerSupplyTemp = statusMessage.powerSupplyTemperature;
81  deviceStatus.fpgaTemp = statusMessage.fpgaTemperature;
82  deviceStatus.leftImagerTemp = statusMessage.leftImagerTemperature;
83  deviceStatus.rightImagerTemp = statusMessage.rightImagerTemperature;
84  deviceStatus.inputVoltage = statusMessage.inputVoltage;
85  deviceStatus.inputCurrent = statusMessage.inputCurrent;
86  deviceStatus.fpgaPower = statusMessage.fpgaPower;
87  deviceStatus.logicPower = statusMessage.logicPower;
88  deviceStatus.imagerPower = statusMessage.imagerPower;
89 
90  status_pub_.publish(deviceStatus);
91  }
92 
93  }
94 }
95 
97 {
98  __sync_fetch_and_add(&subscribers_, 1);
99 }
100 
102 {
103  __sync_fetch_and_sub(&subscribers_, 1);
104 }
105 
106 
107 }
void publish(const boost::shared_ptr< M > &message) const
Status(crl::multisense::Channel *driver)
Definition: status.cpp:40
ros::Timer status_timer_
Definition: status.h:71
ros::Publisher status_pub_
Definition: status.h:66
int32_t subscribers_
Definition: status.h:82
ros::NodeHandle device_nh_
Definition: status.h:61
crl::multisense::Channel * driver_
Definition: status.h:56
void queryStatus(const ros::TimerEvent &event)
Definition: status.cpp:58
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
static CRL_CONSTEXPR Status Status_Ok
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
virtual Status getDeviceStatus(system::StatusMessage &status)=0
static Time now()


multisense_ros
Author(s):
autogenerated on Sat Apr 6 2019 02:16:53