22 #include <arpa/inet.h> 59 getRequiredParamFromParamServer<std::string>(
"password",
password_);
78 getRequiredParamFromParamServer<std::string>(
"host_ip", host_ip);
79 in_addr_t ip_addr = inet_network(host_ip.c_str());
80 if (static_cast<in_addr_t>(-1) == ip_addr)
95 getRequiredParamFromParamServer<int>(
"host_udp_port", host_udp_port);
96 if (host_udp_port < 0)
100 if (host_udp_port > 65535)
114 std::string sensor_ip;
115 getRequiredParamFromParamServer<std::string>(
"sensor_ip", sensor_ip);
116 in_addr_t ip_addr = inet_network(sensor_ip.c_str());
117 if (static_cast<in_addr_t>(-1) == ip_addr)
133 getOptionalParamFromParamServer<std::string>(
"frame_id",
frame_id_);
144 if (getOptionalParamFromParamServer<int>(
"skip", skip))
150 skip_ =
static_cast<uint16_t
>(skip);
162 if (getOptionalParamFromParamServer<float>(
"angle_start", angle_start))
184 if (getOptionalParamFromParamServer<float>(
"angle_end", angle_end))
205 double x_axis_rotation;
206 if (getOptionalParamFromParamServer<double>(
"x_axis_rotation", x_axis_rotation))
259 ROS_WARN_STREAM(
"Parameter " + key +
" doesn't exist on parameter server. Proceeding with default configuration.");
369 const int encrypted_char_len = 2;
370 const int encrypted_char_base = 16;
371 const int addition_coeff = 100;
372 const int number_of_ascii_chars = 256;
373 const int encryption_xor_key = 0xCD;
375 std::string decrypted_password =
"";
377 std::string encrypted_pw_temp = encrypted_password;
379 encrypted_pw_temp.erase(std::remove(encrypted_pw_temp.begin(), encrypted_pw_temp.end(),
' '),
380 encrypted_pw_temp.end());
382 if (encrypted_pw_temp.length() % 2 != 0)
387 for (
unsigned int i = 0; i < encrypted_pw_temp.length(); i += encrypted_char_len)
392 c = (std::stoi(encrypted_pw_temp.substr(i, encrypted_char_len),
nullptr, encrypted_char_base) -
393 i * addition_coeff / encrypted_char_len) %
394 number_of_ascii_chars ^
397 catch (
const std::invalid_argument& e)
407 decrypted_password += c;
410 return decrypted_password;
PSENscanInternalAngle getAngleEnd() const
Getter Method for angle_end_.
bool getOptionalParamFromParamServer(const std::string &key, T ¶m)
Gets one optional ROS-parameter from parameter server.
static const uint16_t DEFAULT_SKIP
Class to model angles in degrees from user's perspective.
PSENscanInternalAngle angle_start_
PSENscanInternalAngle const MAX_SCAN_ANGLE(2750)
static const Degree DEFAULT_X_AXIS_ROTATION(137.5)
Degree getXAxisRotation() const
Getter Method for x_axis_rotation_.
PSENscanInternalAngle angle_end_
PSENscanInternalAngle getAngleStart() const
Getter Method for angle_start_.
static const Degree MAX_X_AXIS_ROTATION(360.0)
static std::string decryptPassword(const std::string &encrypted_password)
Decrypt password.
std::string getSensorIP() const
Getter Method for sensor_ip_.
uint16_t getSkip() const
Getter method for skip_.
bool getParam(const std::string &key, std::string &s) const
PSENscanInternalAngle const MIN_SCAN_ANGLE(0)
static const Degree MIN_X_AXIS_ROTATION(-360.0)
#define ROS_WARN_STREAM(args)
bool hasParam(const std::string &key) const
void getRequiredParamFromParamServer(const std::string &key, T ¶m)
Gets one required ROS-parameter from parameter server.
uint32_t getHostUDPPort() const
Getter method for host_udp_port_.
uint32_t getHostIP() const
Getter method for host_ip_.
std::string getPassword() const
Getter method for password_.
static const std::string DEFAULT_FRAME_ID
std::string getFrameID() const
Getter method for frame_id_.
Class to model angles in PSENscan internal format (tenth of degrees)
RosParameterHandler(const ros::NodeHandle &nh)
Construct a new Ros Parameter Handler:: Ros Parameter Handler object.
static const PSENscanInternalAngle DEFAULT_ANGLE_END(2750)
void updateAllParamsFromParamServer()
Update all Parameters from ROS Parameter Server.
ros::NodeHandle const nh_
static const PSENscanInternalAngle DEFAULT_ANGLE_START(0)