55 #ifndef __SIM_LOC_UTILS_H_INCLUDED
56 #define __SIM_LOC_UTILS_H_INCLUDED
62 #include <boost/thread.hpp>
71 template<
typename ElementType,
typename MutexType = boost::mutex>
class SetGet
79 void set(
const ElementType & value)
110 boost::lock_guard<boost::mutex> value_lockguard(
m_value_mutex);
127 static std::string
toHexString(
const std::vector<uint8_t> & binary_data);
148 std::string out(
s.str());
157 s <<
"header.stamp: " <<
header->stamp.sec <<
"." <<
header->stamp.NSEC;
164 static std::string
flattenToString(
const sick_scan::SickLocColaTelegramMsg & cola_telegram)
168 <<
", command_type: " << cola_telegram.command_type
169 <<
", command_name: " << cola_telegram.command_name <<
", parameter: [";
170 for(
size_t n = 0; n < cola_telegram.parameter.size(); n++)
171 s << (n>0?
",":
"") << cola_telegram.parameter[n];
173 std::string out(
s.str());
181 static std::string
flattenToString(
const sick_scan::SickLocResultPortTelegramMsg & telegram)
186 <<
", telegram_payload: [posex:" << telegram.telegram_payload.posex <<
",posey:" << telegram.telegram_payload.posey <<
",poseyaw:" << telegram.telegram_payload.poseyaw
187 <<
",scancounter:" << telegram.telegram_payload.scancounter <<
",timestamp:" << telegram.telegram_payload.timestamp <<
",quality:" << (int)(telegram.telegram_payload.quality&0xFF)
188 <<
",covariancex:" << telegram.telegram_payload.covariancex <<
",covariancey:" << telegram.telegram_payload.covariancey <<
",covarianceyaw:" << telegram.telegram_payload.covarianceyaw
189 <<
",outliersratio:" << telegram.telegram_payload.outliersratio <<
",errorcode:" << telegram.telegram_payload.errorcode
190 <<
"], telegram_checksum: " << telegram.telegram_trailer.checksum;
191 std::string out(
s.str());
203 std::stringstream sx, sy;
206 return sx.str() == sy.str();
214 template <
typename T>
static bool identicalByStream(
const std::vector<T> & x,
const std::vector<T> & y)
216 if(x.size() == y.size())
218 for(
size_t n = 0; n < x.size(); n++)
231 static bool identicalByStream(
const SickLocResultPortTelegramMsg & x,
const SickLocResultPortTelegramMsg & y)
233 #if defined __ROS_VERSION && __ROS_VERSION == 1
237 #elif defined __ROS_VERSION && __ROS_VERSION == 2
238 return x.telegram_header == y.telegram_header && x.telegram_payload == y.telegram_payload && x.telegram_trailer == y.telegram_trailer;
250 static bool identicalByStream(
const SickLocColaTelegramMsg & x,
const SickLocColaTelegramMsg & y)
252 return x.command_name == y.command_name && x.command_type == y.command_type &&
identicalByStream(x.parameter, y.parameter);
263 angle -= (2.0 * M_PI);
265 angle += (2.0 * M_PI);
272 #endif // __SIM_LOC_UTILS_H_INCLUDED