l3cam_ros_utils.hpp
Go to the documentation of this file.
1 /* Copyright (c) 2023, Beamagine
2 
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  - Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13  - Neither the name of copyright holders nor the names of its contributors may be
14  used to endorse or promote products derived from this software without specific
15  prior written permission.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY
18  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20  COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #include "l3cam_ros_errors.hpp"
29 #include <libL3Cam.h>
30 #include <string>
31 
32 #define ROS_BMG_UNUSED(x) (void)x;
33 
34 typedef enum LibL3CamStatus
35 {
36  undefined_status = 0, // default status
37  error_status, // error status
38  connected_status, // after FIND_DEVICE
40  started_status, // after START_DEVICE
41  streaming_status, // after START_STREAM
42  terminated_status // after TERMINATE
44 
45 typedef enum polAngle
46 {
47  angle_0 = 0,
52 } polAngle;
53 
54 static const char *bmg_ros_error_find_devices_timeout = "Timeout error while finding devices\0";
55 static const char *bmg_ros_error_failed_to_call_service = "Failed to call service\0";
56 static const char *bmg_ros_error_interrupted = "RCLCPP interrupted\0";
57 static const char *bmg_ros_error_service_availability_timeout = "Timeout error while looking for service availability\0";
58 static const char *bmg_ros_error_invalid_polarimetric_process_type = "Invalid polarimetric process type\0";
59 static const char *bmg_ros_error_undefined_error = "UNDEFINED L3CAM ERROR\0";
60 
61 static const char *getBeamRosErrorDescription(int error_code)
62 {
63  switch (error_code)
64  {
67  break;
70  break;
73  break;
76  break;
77  case L3CAM_ROS_INVALID_POLARIMETRIC_PROCESS_TYPE:
79  break;
80  default:
82  }
83 }
84 
85 static std::string getErrorDescription(int error_code)
86 {
87  if (error_code < 0)
88  {
89  return getBeamRosErrorDescription(error_code);
90  }
91  else
92  {
93  return getBeamErrorDescription(error_code);
94  }
95 }
L3CAM_ROS_SERVICE_AVAILABILITY_TIMEOUT_ERROR
#define L3CAM_ROS_SERVICE_AVAILABILITY_TIMEOUT_ERROR
Definition: l3cam_ros_errors.hpp:31
angle_0
@ angle_0
Definition: l3cam_ros_utils.hpp:47
bmg_ros_error_find_devices_timeout
static const char * bmg_ros_error_find_devices_timeout
Definition: l3cam_ros_utils.hpp:54
started_status
@ started_status
(TBD) after notification
Definition: l3cam_ros_utils.hpp:40
angle_90
@ angle_90
Definition: l3cam_ros_utils.hpp:49
error_status
@ error_status
Definition: l3cam_ros_utils.hpp:37
getBeamRosErrorDescription
static const char * getBeamRosErrorDescription(int error_code)
Definition: l3cam_ros_utils.hpp:61
L3CAM_ROS_FAILED_TO_CALL_SERVICE
#define L3CAM_ROS_FAILED_TO_CALL_SERVICE
Definition: l3cam_ros_errors.hpp:29
L3CAM_ROS_INTERRUPTED
#define L3CAM_ROS_INTERRUPTED
Definition: l3cam_ros_errors.hpp:30
terminated_status
@ terminated_status
Definition: l3cam_ros_utils.hpp:42
bmg_ros_error_interrupted
static const char * bmg_ros_error_interrupted
Definition: l3cam_ros_utils.hpp:56
undefined_status
@ undefined_status
Definition: l3cam_ros_utils.hpp:36
no_angle
@ no_angle
Definition: l3cam_ros_utils.hpp:51
bmg_ros_error_invalid_polarimetric_process_type
static const char * bmg_ros_error_invalid_polarimetric_process_type
Definition: l3cam_ros_utils.hpp:58
bmg_ros_error_service_availability_timeout
static const char * bmg_ros_error_service_availability_timeout
Definition: l3cam_ros_utils.hpp:57
disconnected_status
@ disconnected_status
Definition: l3cam_ros_utils.hpp:39
l3cam_ros_errors.hpp
bmg_ros_error_failed_to_call_service
static const char * bmg_ros_error_failed_to_call_service
Definition: l3cam_ros_utils.hpp:55
getErrorDescription
static std::string getErrorDescription(int error_code)
Definition: l3cam_ros_utils.hpp:85
L3CAM_ROS_FIND_DEVICES_TIMEOUT_ERROR
#define L3CAM_ROS_FIND_DEVICES_TIMEOUT_ERROR
Definition: l3cam_ros_errors.hpp:28
polAngle
polAngle
Definition: l3cam_ros_utils.hpp:45
angle_135
@ angle_135
Definition: l3cam_ros_utils.hpp:50
connected_status
@ connected_status
Definition: l3cam_ros_utils.hpp:38
angle_45
@ angle_45
Definition: l3cam_ros_utils.hpp:48
LibL3CamStatus
LibL3CamStatus
Definition: l3cam_ros_utils.hpp:34
streaming_status
@ streaming_status
Definition: l3cam_ros_utils.hpp:41
bmg_ros_error_undefined_error
static const char * bmg_ros_error_undefined_error
Definition: l3cam_ros_utils.hpp:59


l3cam_ros
Author(s): Beamagine
autogenerated on Wed May 28 2025 02:53:15