Go to the documentation of this file.
41 for (
auto i = 0; i < number_of_sensors; ++i)
43 if (known_sensors[i].InterfaceSensorId_u16 == TargetSensor_u16)
50 ROS_ERROR(
"Requested target sensor ID (%d) is not known on bus!", TargetSensor_u16);
57 ss <<
"Current sensor settings:\n";
60 ss <<
"FixedFrameRate_b: " << FixedFrameRate_b;
63 ss <<
"\nGetParameterTransducerNumOfPulses_u8: "
65 ss <<
"\nGetParameterSignalProcessingTemperature_f: "
67 ss <<
"\nGetParameterSignalProcessingHumidity_u8: "
70 ss <<
"\nGetParameterSystemMCUTemperature_f: "
77 constexpr
auto max_id_index = 2;
78 for (
auto i = 0; i <= max_id_index; ++i)
81 ss <<
"\nUniqueID_cp[" << i <<
"]: ";
106 std::stringstream ss;
108 ss <<
"[" << std::to_string(known_sensors[0].InterfaceSensorId_u16);
109 for (
auto i = 1; i < number_of_sensors_on_bus; ++i)
113 ss << std::to_string(known_sensors[i].InterfaceSensorId_u16);
117 ROS_INFO(
"%u known sensors on bus. IDs: %s", number_of_sensors_on_bus, ss.str().c_str());
126 std::stringstream ss;
130 return std::to_string(version.
major) +
"." + std::to_string(version.
minor) +
"." +
131 std::to_string(version.
hotfix);
135 ss <<
"Bootloader: " << to_string(version) <<
",\n";
137 ss <<
"App: " << to_string(version) <<
",\n";
139 ss <<
"Hardware: " << to_string(version) <<
",\n";
141 ss <<
"Sig Pro Lib: " << to_string(version) <<
",\n";
143 ss <<
"Comms Lib: " << to_string(version);
150 if (session ==
nullptr)
152 ROS_WARN(
"LogSessionData: Received request to log session == nullptr!");
155 auto to_string = [](
bool b) {
return b ?
"true" :
"false"; };
158 "LogSessionData:\nSessionActive_b:\t%s,\nsenderId_u16:\t\t%d,\nNumberOfPoints_u8:"
160 "d\nNoiseLevel_u16:\t\t%d\nNearFieldPoint_b:\t%"
167 std::stringstream ss;
169 ss <<
"1D Points [VectorLength, Intensity], " << std::to_string(session->
NumberOf1DPoints)
182 ss.str(std::string());
183 ss <<
"3D Points [x, y, z, intensity], " << std::to_string(session->
NumberOf3DPoints)
188 ss <<
"\n\t" << i <<
": [" << std::to_string(session->
Point3D_tp[i].
X_i16)
208 ROS_DEBUG(
"Successfully configured sensor log level (%d)!", log_level);
212 ROS_WARN(
"Failed to configure sensor log level (%d)!", log_level);
221 std::stringstream ss;
222 ss <<
"Log-Msg Callback from Sender " << SenderId_u16 <<
": " << message_buffer;
224 const auto log_msg = ss.str();
#define MAX_PARSED_LOG_MESSAGE_LEN
SensorMode_t GetParameterSystemSensorMode_t()
Blocking Request to read the Sensor Mode from current sensor.
void LogSessionData(const Sensor_Session_t *session)
Log given session data to ROS concole.
SensorState_t GetParameterSystemSensorState_t()
Blocking Request to read the Sensor State from current sensor.
@ VERSION_BYTE_SIG_PRO_LIB
ResetReason_t GetParameterSystemResetReason_t()
Blocking Request to read the last Reset Reason from current sensor.
auto toHexString(const uint16_t i) -> std::string
Convert given i to hex string.
#define ROS_ERROR_STREAM(args)
Version_t RequestVersion_t(VersionByte_t TargetComponent_t)
Blocking - Request transmition of the current version of selected component from selected sensor.
UID_t GetParameterSystemUniqueID_t(uint8_t Index_u8)
Blocking Request to read the Unique ID from current sensor.
uint8_t GetParameterTransducerNumOfPulses_u8()
Blocking Request to read the current Transducer Number of Pulses from current sensor.
Sensor_t * GetKnownSensors()
Returns pointer to array containing all known sensors. With GetNumberOfKnownSensors() users can get l...
auto SetTargetSensor(uint16_t TargetSensor_u16) -> bool
Checks if TargetSensor_u16 is known and sets current target accordingly.
void DeinitInterface(CommsInterfaceType_t Interface_t)
Instruction to deinit the specified interface type.
float GetParameterSignalProcessingTemperature_f()
Blocking Request to read the current Transducer Temperature setting from current sensor.
void InitCanInterface(const std::string &can_device, int data_rate=1000000)
Inits the driver on given can_device with hard-coded data rate.
uint8_t GetParameterTransducerVolume_u8()
Blocking Request to read the current Transducer Volume from current sensor.
SessionState_t SessionState
LogLevel_t GetParameterSystemLogLevel_t()
Blocking Request to read the current System Log Level from current sensor.
uint16_t VectorLength_u16
#define ROS_DEBUG_STREAM(args)
uint16_t WaitForSessionEnd()
Blocking Function call to wait for SessionEnd Payload.
void ConfigureSensorLogMessages(void(*Callback)(uint16_t Sender_u16, uint8_t *ReceivedPayload_pu8), LogLevel_t log_level)
Sets log level with the sensor and registers callback.
uint8_t GetParameterADCFixedFrameRate_u8()
Blocking Request to read the current set ADC-Framerate from current sensor.
void DeinitUARTInterface()
#define ROS_WARN_STREAM(args)
Point1D_t Point1D_tp[MAX_NUMBER_OF_POINTS_PER_SESSION]
void LogVersions()
Read all version information (such as bootloader version, app versionetc.) from sensor and log to ROS...
void LogKnownSensors(double log_interval=3.0)
Get currently known sensors from driver and log to ROS console every log_interval seconds.
uint8_t GetNumberOfKnownSensors()
Returns number of known sensors. With GetKnownSensors() users an pointer to an array containing the I...
bool RequestMeasurement()
Send's a request to start a new measurement.
bool SetParameterSystemLogLevel(LogLevel_t LogLevel_t)
Blocking Request to set the Loglevel for current target sensor.
uint8_t NumberOfPoints_u8
void ParseLogMessageToText(char *Output_p8, uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Parses log messages into human readable text.
uint16_t GetParameterSystemNodeID_u16()
Blocking Request to read the current NodeID setting from current sensor.
void DeinitCanInterface()
#define ROS_INFO_STREAM(args)
Sensor_Session_t * GetSessionData(uint16_t Sender_u16)
Interface function to query current session-data (ongoing and closed session)
uint8_t GetParameterSignalProcessingHumidity_u8()
Blocking Request to read the current Transducer Humidity setting from current sensor.
void InitInterface(char *InterfaceName, uint32_t DataRate_u32, CommsInterfaceType_t Interface_t)
Instruction to initialize the specified interface with the specified bit rate. Will also initialize t...
bool GetParameterADCUseFixedFrameRate_b()
Blocking Request to read the "Use fixed framerate" value from current sensor.
void LogMsgCallback(uint16_t SenderId_u16, uint8_t *ReceivedPayload_pu8)
Callback handling log messages from sensor.
@ VERSION_BYTE_BOOTLOADER
#define LOGGING_SEVERITY_BYTE
void LogSettings()
Read current configuration from sensor and log to ROS console.
void RegisterLogMsgCallback(void(*Callback)(uint16_t Sender_u16, uint8_t *ReceivedPayload_pu8))
Interface function to register a callback function that is called whenever a Logmessage Payload is re...
float GetParameterSystemMCUTemperature_f()
Blocking Request to read the current MCU Temperature from current sensor.
void InitUARTInterface(const std::string &uart_device, int data_rate=0010002)
Inits the driver on given uart_device with hard-coded data rate.
Point3D_t Point3D_tp[MAX_NUMBER_OF_POINTS_PER_SESSION]
auto RequestSessionData() -> Sensor_Session_t *
Requesting single shot measurement from first sensor in known sensors array.
toposens_echo_driver
Author(s): Tobias Roth
, Dennis Maier , Baris Yazici
autogenerated on Wed Mar 2 2022 01:12:32