alb_publisher.cpp
Go to the documentation of this file.
1 // ROS headers
2 #include "geometry_msgs/PointStamped.h"
3 #include "geometry_msgs/TransformStamped.h"
4 #include "sensor_msgs/TimeReference.h"
5 
6 #include "tf2/convert.h"
11 
12 // Osef headers
13 #include "osefTypes.h"
14 #include "typeCaster.h"
15 
16 // Local headers
17 #include "alb_common.h"
18 #include "alb_curl_helper.h"
19 #include "alb_helper.h"
20 #include "alb_publisher.h"
21 #include "outsight_alb_driver/AugmentedCloud.h"
22 #include "outsight_alb_driver/ObjectData.h"
23 #include "outsight_alb_driver/TrackedObjects.h"
24 
25 // Constant definition.
26 constexpr const char *k_default_fixed_frame_id = "alb_fixed_frame";
27 constexpr const char *k_default_sensor_frame_id = "alb_sensor_frame";
28 constexpr const uint32_t k_queue_size = 1000;
29 
31 {
32  initPublishers(nodeHandle);
34  buildZones();
35 
36  Helper::init_pose(odom_msg.pose.pose);
38 }
39 
41 {
42  ros::NodeHandle private_node("~");
43  bool output;
44 
45  // Define TimeReference publisher.
46  private_node.param<bool>(ALBCommon::k_alb_time_ref_config, output, false);
47  if (output) {
49  nodeHandle.advertise<sensor_msgs::TimeReference>(ALBCommon::k_alb_time_ref, k_queue_size);
50  }
51 
52  // Define used timestamp (ALB or ROS).
53  private_node.param<bool>(ALBCommon::k_alb_use_alb_time, use_alb_time, false);
54 
55  // Define point cloud order
57 
58  // Define Pose publisher.
59  private_node.param<bool>(ALBCommon::k_alb_pose_config, output, false);
60  if (output) {
61  pose_publisher = nodeHandle.advertise<geometry_msgs::PoseStamped>(ALBCommon::k_alb_pose, k_queue_size);
62  }
63 
64  // Define PointCloud publisher.
65  private_node.param<bool>(ALBCommon::k_alb_point_cloud_config, output, false);
66  if (output) {
68  nodeHandle.advertise<sensor_msgs::PointCloud2>(ALBCommon::k_alb_point_cloud, k_queue_size);
69  }
70 
71  // Define TrackedObjects publisher.
72  private_node.param<bool>(ALBCommon::k_alb_objects_config, output, false);
73  if (output) {
74  tracked_objects_publisher = nodeHandle.advertise<outsight_alb_driver::TrackedObjects>(
76  }
77 
78  // Define Odometry publisher.
79  private_node.param<bool>(ALBCommon::k_alb_odometry_config, output, false);
80  if (output) {
81  odometry_publisher = nodeHandle.advertise<nav_msgs::Odometry>(ALBCommon::k_alb_odometry, k_queue_size);
82  }
83 
84  // Define Egomotion publisher.
85  private_node.param<bool>(ALBCommon::k_alb_egomotion_config, output, false);
86  if (output) {
88  nodeHandle.advertise<geometry_msgs::PoseStamped>(ALBCommon::k_alb_egomotion, k_queue_size);
89  }
90 
91  // Define AugmentedCloud publisher.
92  private_node.param<bool>(ALBCommon::k_alb_augmented_cloud_config, output, false);
93  if (output) {
94  augmented_cloud_publisher = nodeHandle.advertise<outsight_alb_driver::AugmentedCloud>(
96  }
97 
98  // Define Zones publisher.
99  private_node.param<bool>(ALBCommon::k_alb_zones_config, output, false);
100  if (output) {
102  nodeHandle.advertise<outsight_alb_driver::Zones>(ALBCommon::k_alb_zones, k_queue_size);
103  }
104 }
105 
107 {
108  ros::NodeHandle private_node("~");
109 
110  // Define the frame ID.
113  private_node.param<std::string>(ALBCommon::k_alb_base_frame_id, base_frame_id, "");
114  private_node.param<std::string>(ALBCommon::k_alb_map_frame_id, map_frame_id, "");
115 
116  // Broadcast the transforms
118 
119  tf2_ros::Buffer tfBuffer;
120  tf2_ros::TransformListener tfListener(tfBuffer);
121  try {
122  if (base_frame_id.empty()) {
123  ROS_WARN("[AlbPublisher] No base_frame_id specified in the config file.");
124  return;
125  }
126  geometry_msgs::TransformStamped base_to_lidar =
127  tfBuffer.lookupTransform(base_frame_id, sensor_frame_id, ros::Time(0), ros::Duration(0.5));
128  tf2::fromMsg(base_to_lidar.transform, base_to_lidar_tf);
129  use_base_frame = true;
130  ROS_INFO("[AlbPublisher] Base to lidar transform received.");
131  } catch (tf2::TransformException &ex) {
132  ROS_WARN(
133  "[AlbPublisher] No base to lidar transform provided, package will not be able to relocate Lidar frame in the robot frame.");
134  ROS_WARN("[AlbPublisher] %s", ex.what());
135  use_base_frame = false;
136  return;
137  }
138 }
139 
141 {
142  ros::NodeHandle private_node("~");
143  std::string ip_address;
144  if (!private_node.hasParam(ALBCommon::k_alb_ip)) {
145  ROS_ERROR("[AlbPublisher] IP address not defined");
146  return;
147  }
148  private_node.getParam(ALBCommon::k_alb_ip, ip_address);
149  AlbCurlHelper curl_helper(ip_address);
150 
151  std::string raw_zones;
152  if (!curl_helper.executeProcessingZones(raw_zones)) {
153  ROS_INFO("%s", curl_helper.getErrorMessage().c_str());
154  return;
155  }
156 
157  zones_msg.header.frame_id = map_frame_id;
158 
160  ROS_INFO("[AlbPublisher] %ld zones detected.", zones_msg.zones.size());
161 }
162 
163 void AlbPublisher::publish(const Tlv::tlv_s *frame)
164 {
166  updateTimeStamp(frame);
167  if (use_alb_time) {
169  } else {
171  }
172 
173  updatePose(frame);
174 
176  publishTimeReference(frame);
177  }
178 
179  if (pose_publisher) {
180  publishPose(frame);
181  }
182 
183  if (point_cloud_publisher) {
184  publishPointCloud(frame);
185  }
186 
188  publishTrackedObjects(frame);
189  }
190 
191  if (egomotion_publisher) {
192  publishEgomotion(frame);
193  }
194 
195  if (odometry_publisher) {
196  publishOdometry(frame);
197  }
198 
200  publishAugmentedCloud(frame);
201  }
202 
203  if (zones_publisher) {
204  publishZones();
205  }
206 
207  if (transform_broadcaster) {
209  }
210 
211  if (pose_found) {
213  }
215 }
216 
217 void AlbPublisher::publishTimeReference(const Tlv::tlv_s *frame)
218 {
219  Tlv::Parser parser(frame->getValue(), frame->getLength());
220  const Tlv::tlv_s *timeTlv = parser.findTlv(OSEF_TYPE_TIMESTAMP_MICROSECOND);
221  if (!timeTlv) {
222  ROS_ERROR("[AlbPublisher] Timestamp not found, unable to publish TimeReference.");
223  return;
224  }
225 
227 
228  sensor_msgs::TimeReference time_message;
229  time_message.header.stamp = current_timestamp;
230  time_message.header.frame_id = fixed_frame_id;
231  if (use_alb_time) {
232  time_message.time_ref = ros_time;
233  time_message.source = "alb_time";
234  } else {
235  time_message.time_ref = alb_time;
236  time_message.source = "ros_time";
237  }
238 
239  time_reference_publisher.publish(time_message);
240 }
241 
242 void AlbPublisher::publishPointCloud(const Tlv::tlv_s *frame)
243 {
244  Tlv::Parser parser(frame->getValue(), frame->getLength());
245  const Tlv::tlv_s *frameTlv = parser.findTlv(OSEF_TYPE_SCAN_FRAME);
246  if (!frameTlv) {
247  ROS_ERROR("[AlbPublisher] Scan frame not found, unable to publish PointCloud.");
248  return;
249  }
250 
251  Tlv::Parser frameParser(frameTlv->getValue(), frameTlv->getLength());
252  const Tlv::tlv_s *augmented_point_cloud = frameParser.findTlv(OSEF_TYPE_AUGMENTED_CLOUD);
253  if (!augmented_point_cloud) {
254  ROS_ERROR("[AlbPublisher] Augmented point cloud not found, unable to publish PointCloud.");
255  return;
256  }
257 
258  // To compute the point Cloud, get the cartesian coordinates and apply the pose transformation.
259  const Tlv::Parser cloudParser(augmented_point_cloud->getValue(), augmented_point_cloud->getLength());
260  const Tlv::tlv_s *cartesian_tlv = cloudParser.findTlv(OSEF_TYPE_CARTESIAN_COORDINATES);
261  const Tlv::tlv_s *number_points_tlv = cloudParser.findTlv(OSEF_TYPE_NUMBER_OF_POINTS);
262  const Tlv::tlv_s *number_layers_tlv = cloudParser.findTlv(OSEF_TYPE_NUMBER_OF_LAYERS);
263 
264  if (!cartesian_tlv || !number_points_tlv || !number_layers_tlv) {
265  std::string error_msg(!cartesian_tlv ? "Cartesian not found. " : "");
266  error_msg.append(!number_points_tlv ? "Number of points not found." : "");
267  error_msg.append(!number_layers_tlv ? "Number of layers not found." : "");
268 
269  ROS_ERROR("[AlbPublisher] Unable to publish PointCloud: %s", error_msg.c_str());
270  return;
271  }
272 
273  const uint32_t number_points = NumberOfObjects::castValue(number_points_tlv);
274  const uint32_t number_layers = NumberOfObjects::castValue(number_layers_tlv);
275  sensor_msgs::PointCloud2 point_cloud_msg;
276  point_cloud_msg.header.stamp = current_timestamp;
277  point_cloud_msg.header.frame_id = sensor_frame_id;
278 
279  Helper::define_point_fields(point_cloud_msg);
280  Helper::define_points_data(point_cloud_msg, number_layers, number_points, (float *)(cartesian_tlv->getValue()),
282 
283  point_cloud_publisher.publish(point_cloud_msg);
284 }
285 
286 void AlbPublisher::publishPose(const Tlv::tlv_s *frame)
287 {
288  if (!pose_found) {
289  return;
290  }
291 
292  geometry_msgs::PoseStamped pose_msg;
293  pose_msg.header.stamp = current_timestamp;
294  pose_msg.header.frame_id = map_frame_id;
295  pose_msg.pose = current_pose;
296  pose_publisher.publish(pose_msg);
297 }
298 
299 void AlbPublisher::publishTrackedObjects(const Tlv::tlv_s *frame)
300 {
301  Tlv::Parser parser(frame->getValue(), frame->getLength());
302  const Tlv::tlv_s *frameTlv = parser.findTlv(OSEF_TYPE_SCAN_FRAME);
303  if (!frameTlv) {
304  ROS_ERROR("[AlbPublisher] Scan frame not found, unable to publish BoundingBoxes message.");
305  return;
306  }
307 
308  Tlv::Parser frameParser(frameTlv->getValue(), frameTlv->getLength());
309  const Tlv::tlv_s *objectsTlv = frameParser.findTlv(OSEF_TYPE_TRACKED_OBJECTS);
310  if (!objectsTlv) {
311  ROS_ERROR("[AlbPublisher] Tracked objects not found, unable to publish BoundingBoxes message.");
312  return;
313  }
314 
315  Tlv::Parser objectsParser(objectsTlv->getValue(), objectsTlv->getLength());
316  const Tlv::tlv_s *num_objects = objectsParser.findTlv(OSEF_TYPE_NUMBER_OF_OBJECTS);
317  const Tlv::tlv_s *object_ids = objectsParser.findTlv(OSEF_TYPE_OBJECT_ID_32_BITS);
318  const Tlv::tlv_s *bbox_sizes = objectsParser.findTlv(OSEF_TYPE_BBOX_SIZES);
319  const Tlv::tlv_s *pose_array = objectsParser.findTlv(OSEF_TYPE_POSE_ARRAY);
320  const Tlv::tlv_s *speed_vectors = objectsParser.findTlv(OSEF_TYPE_SPEED_VECTORS);
321  const Tlv::tlv_s *class_ids = objectsParser.findTlv(OSEF_TYPE_CLASS_ID_ARRAY);
322  if (!num_objects || !object_ids || !bbox_sizes || !pose_array || !speed_vectors || !class_ids) {
323  std::string error_msg(!num_objects ? "Number of objects not found. " : "");
324  error_msg.append(!object_ids ? "Object ids not found. " : "");
325  error_msg.append(!bbox_sizes ? "Box sizes not found. " : "");
326  error_msg.append(!pose_array ? "Pose array not found. " : "");
327  error_msg.append(!speed_vectors ? "Speed vectors not found. " : "");
328  error_msg.append(!class_ids ? "Class IDs not found. " : "");
329 
330  ROS_ERROR("[AlbPublisher] Unable to publish BoundingBoxes message: %s.", error_msg.c_str());
331  return;
332  }
333 
334  outsight_alb_driver::TrackedObjects tracked_message;
335  tracked_message.header.stamp = current_timestamp;
336  tracked_message.header.frame_id = fixed_frame_id;
337  tracked_message.number_of_objects = NumberOfObjects::castValue(num_objects);
338  uint32_t *ids = (uint32_t *)(object_ids->getValue());
339 
340  for (size_t box_index = 0; box_index < tracked_message.number_of_objects; box_index++) {
341  outsight_alb_driver::ObjectData object;
342 
343  object.id = ids[box_index];
344  Helper::define_box_size(object, bbox_sizes, box_index);
345  Helper::define_box_pose(object, pose_array, box_index);
346  Helper::define_object_speed(object, speed_vectors, box_index);
347 
348  uint32_t *class_id = (uint32_t *)(class_ids->getValue() + sizeof(uint32_t) * box_index);
349  object.object_class = Helper::get_object_class(class_id[0]);
350 
351  tracked_message.objects.push_back(object);
352  }
353 
354  tracked_objects_publisher.publish(tracked_message);
355 }
356 
357 void AlbPublisher::publishEgomotion(const Tlv::tlv_s *frame)
358 {
359  if (!pose_found) {
360  return;
361  }
362 
363  geometry_msgs::PoseStamped ego_msg;
364  ego_msg.header.stamp = current_timestamp;
365  ego_msg.header.frame_id = sensor_frame_id;
366  if (!Helper::get_egomotion_from_tlv(frame, ego_msg)) {
367  return;
368  }
369 
370  egomotion_publisher.publish(ego_msg);
371 }
372 
373 void AlbPublisher::publishOdometry(const Tlv::tlv_s *frame)
374 {
375  if (!pose_found) {
376  return;
377  }
378 
379  odom_msg.header.stamp = current_timestamp;
380  odom_msg.header.frame_id = fixed_frame_id;
381  odom_msg.child_frame_id = sensor_frame_id;
382 
383  float dt = (current_timestamp - last_timestamp).toSec();
384 
386 
388 }
389 
390 void AlbPublisher::publishAugmentedCloud(const Tlv::tlv_s *frame)
391 {
392  Tlv::Parser parser(frame->getValue(), frame->getLength());
393  const Tlv::tlv_s *frameTlv = parser.findTlv(OSEF_TYPE_SCAN_FRAME);
394  if (!frameTlv) {
395  ROS_ERROR("[AlbPublisher] Scan frame not found, unable to publish PointCloud.");
396  return;
397  }
398 
399  Tlv::Parser frameParser(frameTlv->getValue(), frameTlv->getLength());
400  const Tlv::tlv_s *augmented_point_cloud = frameParser.findTlv(OSEF_TYPE_AUGMENTED_CLOUD);
401  if (!augmented_point_cloud) {
402  ROS_ERROR("[AlbPublisher] Augmented point cloud not found, unable to publish PointCloud.");
403  return;
404  }
405 
406  outsight_alb_driver::AugmentedCloud message;
407  message.header.stamp = current_timestamp;
408  message.header.frame_id = sensor_frame_id;
409  Helper::define_augmented_cloud(message, augmented_point_cloud);
411 }
412 
414 {
415  zones_msg.header.stamp = current_timestamp;
416 
418 }
419 
420 void AlbPublisher::updatePose(const Tlv::tlv_s *frame)
421 {
422  geometry_msgs::PoseStamped pose_msg;
423  pose_found = Helper::get_pose_from_tlv(frame, pose_msg);
424  if (!pose_found) {
425  return;
426  }
427 
428  if (!get_first_pose) {
429  broadcastMapTransform(pose_msg.pose);
430 
431  first_pose = pose_msg.pose;
432  last_pose = pose_msg.pose;
433  get_first_pose = true;
434  }
435  current_pose = pose_msg.pose;
436 }
437 
438 void AlbPublisher::updateTimeStamp(const Tlv::tlv_s *frame)
439 {
440  Tlv::Parser parser(frame->getValue(), frame->getLength());
441  const Tlv::tlv_s *timeTlv = parser.findTlv(OSEF_TYPE_TIMESTAMP_MICROSECOND);
443  alb_time = ros::Time(timestamp_osef.seconds, timestamp_osef.micro_seconds * 1000);
444 }
445 
446 void AlbPublisher::broadcastAlbTransform(const geometry_msgs::Pose &pose)
447 {
448  if (!odometry_publisher) {
449  ROS_WARN(
450  "[AlbPublisher] Transform between fixed frame and sensor frame requires odometry to be published. Set the odometry parameter to 'true' in order to broadcast this transform.");
451  return;
452  }
453 
454  static tf2_ros::TransformBroadcaster broadcaster;
455 
456  geometry_msgs::Transform odom_to_lidar;
457  odom_to_lidar.translation.x = odom_msg.pose.pose.position.x;
458  odom_to_lidar.translation.y = odom_msg.pose.pose.position.y;
459  odom_to_lidar.translation.z = odom_msg.pose.pose.position.z;
460  odom_to_lidar.rotation = odom_msg.pose.pose.orientation;
461 
462  tf2::Transform odom_to_lidar_tf;
463  tf2::fromMsg(odom_to_lidar, odom_to_lidar_tf);
464 
465  geometry_msgs::TransformStamped transformStamped;
466  transformStamped.header.stamp = current_timestamp;
467  if (use_base_frame) {
468  tf2::Transform odom_to_base_tf = odom_to_lidar_tf * base_to_lidar_tf.inverse();
469  transformStamped.header.frame_id = fixed_frame_id;
470  transformStamped.child_frame_id = base_frame_id;
471  transformStamped.transform = tf2::toMsg(odom_to_base_tf);
472  } else {
473  transformStamped.header.frame_id = fixed_frame_id;
474  transformStamped.child_frame_id = sensor_frame_id;
475  transformStamped.transform = tf2::toMsg(odom_to_lidar_tf);
476  }
477 
478  broadcaster.sendTransform(transformStamped);
479 }
480 
481 void AlbPublisher::broadcastMapTransform(const geometry_msgs::Pose &pose)
482 {
483  if (map_frame_id.empty()) {
484  ROS_WARN("[AlbPublisher] No map_frame_id specified in the config file");
485  }
486  static tf2_ros::StaticTransformBroadcaster static_broadcaster;
487  geometry_msgs::TransformStamped static_transformStamped;
488 
489  static_transformStamped.header.stamp = current_timestamp;
490  static_transformStamped.header.frame_id = map_frame_id;
491  static_transformStamped.child_frame_id = fixed_frame_id;
492  static_transformStamped.transform.translation.x = pose.position.x;
493  static_transformStamped.transform.translation.y = pose.position.y;
494  static_transformStamped.transform.translation.z = pose.position.z;
495  static_transformStamped.transform.rotation = pose.orientation;
496 
497  static_broadcaster.sendTransform(static_transformStamped);
498 }
AlbPublisher::publish
void publish(const Tlv::tlv_s *frame)
Publish messages from the ALB frame.
Definition: alb_publisher.cpp:163
AlbPublisher::publishOdometry
void publishOdometry(const Tlv::tlv_s *frame)
Publish odometry message.
Definition: alb_publisher.cpp:373
AlbPublisher::first_pose
geometry_msgs::Pose first_pose
Definition: alb_publisher.h:81
AlbPublisher::pose_publisher
ros::Publisher pose_publisher
Definition: alb_publisher.h:97
AlbPublisher::publishZones
void publishZones()
Publish the zones message.
Definition: alb_publisher.cpp:413
tf2_ros::StaticTransformBroadcaster::sendTransform
void sendTransform(const geometry_msgs::TransformStamped &transform)
ALBCommon::k_alb_point_cloud_config
constexpr const char * k_alb_point_cloud_config
Definition: alb_common.h:28
AlbPublisher::publishTimeReference
void publishTimeReference(const Tlv::tlv_s *frame)
Publish TimeReference message.
Definition: alb_publisher.cpp:217
AlbPublisher::initPublishers
void initPublishers(ros::NodeHandle &nodeHandle)
Initialize the ROS publishers.
Definition: alb_publisher.cpp:40
AlbPublisher::current_timestamp
ros::Time current_timestamp
Definition: alb_publisher.h:90
OSEF_TYPE_TRACKED_OBJECTS
#define OSEF_TYPE_TRACKED_OBJECTS
Definition: osefTypes.h:159
Helper::get_egomotion_from_tlv
bool get_egomotion_from_tlv(const Tlv::tlv_s *frame, geometry_msgs::PoseStamped &pose)
Get a ROS egomotion pose from the TLV data.
Definition: alb_helper.cpp:195
tf2::Transform::inverse
Transform inverse() const
AlbPublisher::updatePose
void updatePose(const Tlv::tlv_s *frame)
Update current position as the last position.
Definition: alb_publisher.cpp:420
AlbPublisher::publishAugmentedCloud
void publishAugmentedCloud(const Tlv::tlv_s *frame)
Publish the augmented cloud message.
Definition: alb_publisher.cpp:390
ALBCommon::k_alb_augmented_cloud_config
constexpr const char * k_alb_augmented_cloud_config
Definition: alb_common.h:35
ALBCommon::k_alb_use_colwise_order
constexpr const char * k_alb_use_colwise_order
Definition: alb_common.h:38
OSEF_TYPE_NUMBER_OF_POINTS
#define OSEF_TYPE_NUMBER_OF_POINTS
Definition: osefTypes.h:29
AlbPublisher::updateTimeStamp
void updateTimeStamp(const Tlv::tlv_s *frame)
Update used time stamp with the ALB time stamp.
Definition: alb_publisher.cpp:438
tf2::fromMsg
void fromMsg(const A &, B &b)
AlbPublisher::base_to_lidar_tf
tf2::Transform base_to_lidar_tf
Definition: alb_publisher.h:104
Helper::define_augmented_cloud
void define_augmented_cloud(outsight_alb_driver::AugmentedCloud &message, const Tlv::tlv_s *frame)
Define the AugmentedCloud message.
Definition: alb_helper.cpp:325
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
ALBCommon::k_alb_zones
constexpr const char * k_alb_zones
Definition: alb_common.h:15
ALBCommon::k_alb_ip
constexpr const char * k_alb_ip
Definition: alb_common.h:18
Helper::define_point_fields
void define_point_fields(sensor_msgs::PointCloud2 &pointCloud)
Define the point fields for the ALB PointCloud2 message.
Definition: alb_helper.cpp:27
ALBCommon::k_alb_odometry_config
constexpr const char * k_alb_odometry_config
Definition: alb_common.h:34
Helper::define_box_pose
void define_box_pose(outsight_alb_driver::ObjectData &tracked, const Tlv::tlv_s *bBoxPoses, size_t objectIndex)
Define the bounding box pose for the tracked object.
Definition: alb_helper.cpp:309
Helper::define_object_speed
void define_object_speed(outsight_alb_driver::ObjectData &tracked, const Tlv::tlv_s *objectSpeeds, size_t objectIndex)
Define the tracked object speed.
Definition: alb_helper.cpp:316
alb_publisher.h
ALBCommon::k_alb_objects
constexpr const char * k_alb_objects
Definition: alb_common.h:11
AlbPublisher::publishPointCloud
void publishPointCloud(const Tlv::tlv_s *frame)
Publish pointCloud message.
Definition: alb_publisher.cpp:242
ALBCommon::k_alb_objects_config
constexpr const char * k_alb_objects_config
Definition: alb_common.h:32
ALBCommon::k_alb_egomotion
constexpr const char * k_alb_egomotion
Definition: alb_common.h:12
AlbPublisher::current_pose
geometry_msgs::Pose current_pose
Definition: alb_publisher.h:80
OSEF_TYPE_TIMESTAMP_MICROSECOND
#define OSEF_TYPE_TIMESTAMP_MICROSECOND
Definition: osefTypes.h:81
Helper::get_pose_from_tlv
bool get_pose_from_tlv(const Tlv::tlv_s *frame, geometry_msgs::PoseStamped &pose)
Get a ROS pose from the TLV data.
Definition: alb_helper.cpp:171
AlbPublisher::egomotion_publisher
ros::Publisher egomotion_publisher
Definition: alb_publisher.h:99
AlbPublisher::get_first_pose
bool get_first_pose
Definition: alb_publisher.h:84
k_default_sensor_frame_id
constexpr const char * k_default_sensor_frame_id
Definition: alb_publisher.cpp:27
Helper::define_points_data
void define_points_data(sensor_msgs::PointCloud2 &pointCloud, const uint32_t layers, const uint32_t points, float *pointData, bool use_colwise_order)
Define the PointCloud2 point data from raw points coming from the ALB.
Definition: alb_helper.cpp:52
AlbPublisher::transform_broadcaster
bool transform_broadcaster
Definition: alb_publisher.h:105
AlbPublisher::broadcastMapTransform
void broadcastMapTransform(const geometry_msgs::Pose &pose)
Broadcast the ALB map to fixed frame transform.
Definition: alb_publisher.cpp:481
AlbPublisher::use_alb_time
bool use_alb_time
Definition: alb_publisher.h:91
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
AlbCurlHelper
Class to handle the curl ALB requests.
Definition: alb_curl_helper.h:15
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
ALBCommon::k_alb_time_ref_config
constexpr const char * k_alb_time_ref_config
Definition: alb_common.h:30
AlbPublisher::pose_found
bool pose_found
Definition: alb_publisher.h:83
OSEF_TYPE_NUMBER_OF_LAYERS
#define OSEF_TYPE_NUMBER_OF_LAYERS
Definition: osefTypes.h:88
transform_broadcaster.h
tf2_ros::TransformListener
NumberOfObjects::castValue
uint32_t castValue(const Tlv::tlv_s *leafTlv)
Definition: typeCaster.cpp:43
AlbCurlHelper::getErrorMessage
const std::string getErrorMessage(void) const
Get the error message.
Definition: alb_curl_helper.cpp:70
tf2_ros::StaticTransformBroadcaster
TimestampMicroseconds::timestamp_s::seconds
uint32_t seconds
Definition: typeCaster.h:15
TimestampMicroseconds::timestamp_s::micro_seconds
uint32_t micro_seconds
Definition: typeCaster.h:16
AlbPublisher::point_cloud_publisher
ros::Publisher point_cloud_publisher
Definition: alb_publisher.h:96
Helper::define_box_size
void define_box_size(outsight_alb_driver::ObjectData &tracked, const Tlv::tlv_s *bBoxSizes, size_t objectIndex)
Define the bounding box size for the tracked object.
Definition: alb_helper.cpp:300
ALBCommon::k_alb_augmented_cloud
constexpr const char * k_alb_augmented_cloud
Definition: alb_common.h:14
tf2_ros::TransformBroadcaster::sendTransform
void sendTransform(const geometry_msgs::TransformStamped &transform)
AlbPublisher::broadcastAlbTransform
void broadcastAlbTransform(const geometry_msgs::Pose &pose)
Broadcast the ALB fixed frame to sensor frame transform.
Definition: alb_publisher.cpp:446
k_default_fixed_frame_id
constexpr const char * k_default_fixed_frame_id
Definition: alb_publisher.cpp:26
AlbPublisher::fixed_frame_id
std::string fixed_frame_id
Definition: alb_publisher.h:74
AlbPublisher::odometry_publisher
ros::Publisher odometry_publisher
Definition: alb_publisher.h:100
AlbPublisher::zones_msg
outsight_alb_driver::Zones zones_msg
Definition: alb_publisher.h:85
AlbPublisher::augmented_cloud_publisher
ros::Publisher augmented_cloud_publisher
Definition: alb_publisher.h:101
OSEF_TYPE_POSE_ARRAY
#define OSEF_TYPE_POSE_ARRAY
Definition: osefTypes.h:195
AlbPublisher::publishTrackedObjects
void publishTrackedObjects(const Tlv::tlv_s *frame)
Publish tracked objects message.
Definition: alb_publisher.cpp:299
tf2::Transform
typeCaster.h
AlbPublisher::initTransforms
void initTransforms()
Initialize the transform frames.
Definition: alb_publisher.cpp:106
alb_common.h
ros::NodeHandle::hasParam
bool hasParam(const std::string &key) const
ROS_WARN
#define ROS_WARN(...)
OSEF_TYPE_CARTESIAN_COORDINATES
#define OSEF_TYPE_CARTESIAN_COORDINATES
Definition: osefTypes.h:67
tf2_ros::Buffer
OSEF_TYPE_NUMBER_OF_OBJECTS
#define OSEF_TYPE_NUMBER_OF_OBJECTS
Definition: osefTypes.h:73
TimestampMicroseconds::castValue
timestamp_s castValue(const Tlv::tlv_s *leafTlv)
Definition: typeCaster.cpp:3
AlbPublisher::time_reference_publisher
ros::Publisher time_reference_publisher
Definition: alb_publisher.h:95
alb_helper.h
ALBCommon::k_alb_zones_config
constexpr const char * k_alb_zones_config
Definition: alb_common.h:36
Helper::init_pose
void init_pose(geometry_msgs::Pose &pose)
Initialize a ROS Pose message.
Definition: alb_helper.cpp:135
AlbPublisher::ros_time
ros::Time ros_time
Definition: alb_publisher.h:87
ALBCommon::k_alb_broadcast_tf_config
constexpr const char * k_alb_broadcast_tf_config
Definition: alb_common.h:37
ALBCommon::k_alb_fixed_frame_id
constexpr const char * k_alb_fixed_frame_id
Definition: alb_common.h:22
AlbPublisher::publishEgomotion
void publishEgomotion(const Tlv::tlv_s *frame)
Publish egomotion message.
Definition: alb_publisher.cpp:357
Tlv::Parser
Definition: tlvParser.h:15
AlbCurlHelper::executeProcessingZones
bool executeProcessingZones(std::string &zones)
Execute the processing command for the zones.
Definition: alb_curl_helper.cpp:145
ALBCommon::k_alb_egomotion_config
constexpr const char * k_alb_egomotion_config
Definition: alb_common.h:33
AlbPublisher::use_colwise_order
bool use_colwise_order
Definition: alb_publisher.h:93
transform_listener.h
TimestampMicroseconds::timestamp_s
Definition: typeCaster.h:14
OSEF_TYPE_SCAN_FRAME
#define OSEF_TYPE_SCAN_FRAME
Definition: osefTypes.h:143
AlbPublisher::last_timestamp
ros::Time last_timestamp
Definition: alb_publisher.h:89
k_queue_size
constexpr const uint32_t k_queue_size
Definition: alb_publisher.cpp:28
AlbPublisher::AlbPublisher
AlbPublisher(ros::NodeHandle &nodeHandle)
Definition: alb_publisher.cpp:30
OSEF_TYPE_BBOX_SIZES
#define OSEF_TYPE_BBOX_SIZES
Definition: osefTypes.h:170
AlbPublisher::publishPose
void publishPose(const Tlv::tlv_s *frame)
Publish pose message.
Definition: alb_publisher.cpp:286
ros::Time
AlbPublisher::use_base_frame
bool use_base_frame
Definition: alb_publisher.h:106
AlbPublisher::base_frame_id
std::string base_frame_id
Definition: alb_publisher.h:75
AlbPublisher::sensor_frame_id
std::string sensor_frame_id
Definition: alb_publisher.h:76
ROS_ERROR
#define ROS_ERROR(...)
tf2_ros::TransformBroadcaster
ALBCommon::k_alb_use_alb_time
constexpr const char * k_alb_use_alb_time
Definition: alb_common.h:31
Tlv::Parser::findTlv
tlv_s * findTlv(type_t type) const
Definition: tlvParser.cpp:76
static_transform_broadcaster.h
ALBCommon::k_alb_map_frame_id
constexpr const char * k_alb_map_frame_id
Definition: alb_common.h:25
ros::NodeHandle::param
T param(const std::string &param_name, const T &default_val) const
AlbPublisher::buildZones
void buildZones()
Build ALB zones when the processing starts.
Definition: alb_publisher.cpp:140
tf2_geometry_msgs.h
tf2::toMsg
B toMsg(const A &a)
OSEF_TYPE_OBJECT_ID_32_BITS
#define OSEF_TYPE_OBJECT_ID_32_BITS
Definition: osefTypes.h:337
ALBCommon::k_alb_odometry
constexpr const char * k_alb_odometry
Definition: alb_common.h:13
convert.h
Helper::get_object_class
std::string get_object_class(uint32_t classId)
Get the string class of the tracked object from the ALB.
Definition: alb_helper.cpp:289
ALBCommon::k_alb_time_ref
constexpr const char * k_alb_time_ref
Definition: alb_common.h:10
Helper::parse_zone_data
void parse_zone_data(const std::string &raw_zones, outsight_alb_driver::Zones &zones_msg)
Parse the zone data in the raw string and set them in the Zones msg.
Definition: alb_helper.cpp:146
ALBCommon::k_alb_pose_config
constexpr const char * k_alb_pose_config
Definition: alb_common.h:29
tf2::TransformException
ROS_INFO
#define ROS_INFO(...)
AlbPublisher::odom_msg
nav_msgs::Odometry odom_msg
Definition: alb_publisher.h:82
AlbPublisher::zones_publisher
ros::Publisher zones_publisher
Definition: alb_publisher.h:102
ALBCommon::k_alb_pose
constexpr const char * k_alb_pose
Definition: alb_common.h:9
ros::Duration
AlbPublisher::tracked_objects_publisher
ros::Publisher tracked_objects_publisher
Definition: alb_publisher.h:98
Helper::computeOdometry
void computeOdometry(nav_msgs::Odometry &odom, const geometry_msgs::Pose &current_pose, const geometry_msgs::Pose &last_pose, const geometry_msgs::Pose &first_pose, float dt)
Compute the odometry between the last two poses.
Definition: alb_helper.cpp:226
osefTypes.h
OSEF_TYPE_SPEED_VECTORS
#define OSEF_TYPE_SPEED_VECTORS
Definition: osefTypes.h:180
AlbPublisher::last_pose
geometry_msgs::Pose last_pose
Definition: alb_publisher.h:79
AlbPublisher::alb_time
ros::Time alb_time
Definition: alb_publisher.h:88
ALBCommon::k_alb_base_frame_id
constexpr const char * k_alb_base_frame_id
Definition: alb_common.h:24
alb_curl_helper.h
ros::NodeHandle
ALBCommon::k_alb_point_cloud
constexpr const char * k_alb_point_cloud
Definition: alb_common.h:8
AlbPublisher::map_frame_id
std::string map_frame_id
Definition: alb_publisher.h:77
ros::Time::now
static Time now()
ALBCommon::k_alb_sensor_frame_id
constexpr const char * k_alb_sensor_frame_id
Definition: alb_common.h:23
OSEF_TYPE_AUGMENTED_CLOUD
#define OSEF_TYPE_AUGMENTED_CLOUD
Definition: osefTypes.h:23
OSEF_TYPE_CLASS_ID_ARRAY
#define OSEF_TYPE_CLASS_ID_ARRAY
Definition: osefTypes.h:95


outsight_alb_driver
Author(s): Outsight
autogenerated on Thu Oct 13 2022 02:21:45