16 #ifndef PSEN_SCAN_V2_IO_STATE_ROS_CONVERSIONS_H 17 #define PSEN_SCAN_V2_IO_STATE_ROS_CONVERSIONS_H 22 #include "psen_scan_v2/IOState.h" 23 #include "psen_scan_v2/InputPinState.h" 24 #include "psen_scan_v2/OutputPinState.h" 29 template <
typename PinStateType>
33 pin_msg.pin_id.id = pin.
id();
34 pin_msg.name = pin.
name();
35 pin_msg.state = pin.
state();
44 throw std::invalid_argument(
"IOState of Laserscan message has an invalid timestamp: " +
48 ros_message.header.frame_id = frame_id;
50 auto input = io_state.
input();
51 std::transform(input.begin(), input.end(), std::back_inserter(ros_message.
input), [](
const auto& pin) {
52 return toPinStateMsg<InputPinState>(pin);
55 auto output = io_state.
output();
56 std::transform(output.begin(), output.end(), std::back_inserter(ros_message.
output), [](
const auto& pin) {
57 return toPinStateMsg<OutputPinState>(pin);
65 #endif // PSEN_SCAN_V2_IO_STATE_ROS_CONVERSIONS_H Time & fromNSec(uint64_t t)
int64_t timestamp() const
Represents the set of all I/Os of the scanner and their states.
Represents a single I/O pin.
psen_scan_v2::IOState toIOStateMsg(const psen_scan_v2_standalone::IOState &io_state, const std::string &frame_id)
std::vector< PinState > input() const
PinStateType toPinStateMsg(const psen_scan_v2_standalone::PinState &pin)
std::vector< PinState > output() const
Root namespace for the ROS part.