Go to the documentation of this file.
32 #include <Eigen/Geometry>
49 auto ret = rcutils_logging_set_logger_level(
50 this->get_logger().get_name(), RCUTILS_LOG_SEVERITY_DEBUG);
51 if (ret != RCUTILS_RET_OK)
53 RCLCPP_ERROR(this->get_logger(),
"Error setting severity: %s",
54 rcutils_get_error_string().str);
55 rcutils_reset_error();
93 static_cast<std::string
>(
"imu"));
95 static_cast<std::string
>(
"base_link"));
97 static_cast<std::string
>(
"vsm"));
99 static_cast<std::string
>(
"aux1"));
103 static_cast<std::string
>(
"odom"));
110 static_cast<std::string
>(
""));
115 static_cast<uint32_t
>(921600));
117 static_cast<std::string
>(
"off"));
119 static_cast<uint32_t
>(0));
121 static_cast<std::string
>(
""));
123 static_cast<uint32_t
>(0));
125 static_cast<std::string
>(
""));
127 static_cast<std::string
>(
""));
130 static_cast<std::string
>(
""));
134 static_cast<std::string
>(
"gnss"));
140 " use either gnss or ins.");
149 "Both UDP and TCP have been defined to receive data, only TCP will be used. If UDP is intended, leave tcp/ip_server empty.");
154 static_cast<uint32_t
>(1000));
160 "Please specify a valid polling period for PVT-related SBF blocks and NMEA messages. " +
165 static_cast<uint32_t
>(1000));
171 "Please specify a valid polling period for PVT-unrelated SBF blocks and NMEA messages.");
229 "Only one of the tfs may be published at once, just activating tf in ECEF ");
243 if (
getUint32Param(
"ant_serial_nr", sn_tmp,
static_cast<uint32_t
>(0)))
253 static_cast<uint32_t
>(0)))
265 bool getConfigFromTf;
266 param(
"get_spatial_config_from_tf", getConfigFromTf,
false);
270 using namespace std::chrono_literals;
271 std::this_thread::sleep_for(1000ms);
288 Eigen::Matrix3d C_imu_vehicle =
292 Eigen::Affine3d T_poi_imuWrtVeh =
294 Eigen::Affine3d T_vsm_imuWrtVeh =
296 Eigen::Affine3d T_ant_imuWrtVeh =
300 double roll, pitch, yaw;
301 getRPY(T_imu_vehicle.transform.rotation, roll, pitch, yaw);
325 Eigen::Affine3d T_aux1_imuWrtVeh =
329 double dy = T_aux1_imuWrtVeh.translation()[1] -
330 T_ant_imuWrtVeh.translation()[1];
331 double dx = T_aux1_imuWrtVeh.translation()[0] -
332 T_ant_imuWrtVeh.translation()[0];
335 double dz = T_aux1_imuWrtVeh.translation()[2] -
336 T_ant_imuWrtVeh.translation()[2];
354 double dy = T_aux1_vehicle.transform.translation.y -
355 T_ant_vehicle.transform.translation.y;
356 double dx = T_aux1_vehicle.transform.translation.x -
357 T_ant_vehicle.transform.translation.x;
360 double dz = T_aux1_vehicle.transform.translation.z -
361 T_ant_vehicle.transform.translation.z;
410 std::numeric_limits<double>::epsilon())
416 "Pitch angle output by topic /atteuler is a tilt angle rotated by " +
424 "Pitch angle output by topic /pose is a tilt angle rotated by " +
442 std::string(
"auto"));
455 "If tf shall be published, ins_use_poi has to be set to true! It is set automatically to true.");
461 for (uint8_t i = 1; i < 4; ++i)
464 std::string ntrip =
"ntrip_" + std::to_string(i);
466 param(
"rtk_settings." + ntrip +
".id", ntripSettings.
id, std::string());
467 if (ntripSettings.
id.empty())
470 param(
"rtk_settings." + ntrip +
".caster", ntripSettings.
caster,
473 ntripSettings.
caster_port,
static_cast<uint32_t
>(0));
474 param(
"rtk_settings." + ntrip +
".username", ntripSettings.
username,
476 if (!
param(
"rtk_settings." + ntrip +
".password", ntripSettings.
password,
481 static_cast<uint32_t
>(0));
482 ntripSettings.
password = std::to_string(pwd_tmp);
484 param(
"rtk_settings." + ntrip +
".mountpoint", ntripSettings.
mountpoint,
486 param(
"rtk_settings." + ntrip +
".version", ntripSettings.
version,
488 param(
"rtk_settings." + ntrip +
".tls", ntripSettings.
tls,
false);
489 if (ntripSettings.
tls)
490 param(
"rtk_settings." + ntrip +
".fingerprint",
492 param(
"rtk_settings." + ntrip +
".rtk_standard",
494 param(
"rtk_settings." + ntrip +
".send_gga", ntripSettings.
send_gga,
495 std::string(
"auto"));
498 param(
"rtk_settings." + ntrip +
".keep_open", ntripSettings.
keep_open,
504 for (uint8_t i = 1; i < 6; ++i)
507 std::string ips =
"ip_server_" + std::to_string(i);
509 param(
"rtk_settings." + ips +
".id", ipSettings.
id, std::string(
""));
510 if (ipSettings.
id.empty())
514 static_cast<uint32_t
>(0));
516 std::string(
"auto"));
517 param(
"rtk_settings." + ips +
".send_gga", ipSettings.
send_gga,
518 std::string(
"auto"));
521 param(
"rtk_settings." + ips +
".keep_open", ipSettings.
keep_open,
true);
526 for (uint8_t i = 1; i < 6; ++i)
529 std::string serial =
"serial_" + std::to_string(i);
531 param(
"rtk_settings." + serial +
".port", serialSettings.
port,
533 if (serialSettings.
port.empty())
537 serialSettings.
baud_rate,
static_cast<uint32_t
>(115200));
538 param(
"rtk_settings." + serial +
".rtk_standard",
540 param(
"rtk_settings." + serial +
".send_gga", serialSettings.
send_gga,
541 std::string(
"auto"));
542 if (serialSettings.
send_gga.empty())
544 param(
"rtk_settings." + serial +
".keep_open", serialSettings.
keep_open,
552 std::string tempString;
555 param(
"ntrip_settings.mode", tempString, std::string(
""));
556 if (tempString !=
"")
559 "Deprecation warning: parameter ntrip_settings.mode has been removed, see README under section rtk_settings.");
560 param(
"ntrip_settings.caster", tempString, std::string(
""));
561 if (tempString !=
"")
564 "Deprecation warning: parameter ntrip_settings.caster has been removed, see README under section rtk_settings.");
565 param(
"ntrip_settings.rx_has_internet", tempBool,
false);
569 "Deprecation warning: parameter ntrip_settings.rx_has_internet has been removed, see README under section rtk_settings.");
570 param(
"ntrip_settings.rx_input_corrections_tcp", tempInt, 0);
574 "Deprecation warning: parameter ntrip_settings.rx_input_corrections_tcp has been removed, see README under section rtk_settings.");
575 param(
"ntrip_settings.rx_input_corrections_serial", tempString,
577 if (tempString !=
"")
580 "Deprecation warning: parameter ntrip_settings.rx_input_corrections_serial has been removed, see README under section rtk_settings.");
589 "AttEuler needs multi-antenna receiver. Multi-antenna setting automatically activated. Deactivate publishing of AttEuler if multi-antenna operation is not available.");
599 std::string ipid =
"IPS5";
601 bool ins_use_vsm =
false;
607 " -> VSM input will not be used!");
616 static_cast<uint32_t
>(24786));
617 param(
"ins_vsm.ip_server.keep_open",
621 "velocity sensor measurements via ip_server will be used.");
625 }
else if (ins_use_vsm)
629 "no ins_vsm.ip_server.id set -> VSM input will not be used!");
639 static_cast<uint32_t
>(115200));
643 "velocity sensor measurements via serial will be used.");
647 std::vector<bool>());
652 [](
bool v) { return !v; }))
657 "all elements of ins_vsm.ros.config have been set to false -> VSM input will not be used!");
660 param(
"ins_vsm.ros.variances_by_parameter",
664 param(
"ins_vsm.ros.variances",
666 std::vector<double>());
671 "ins_vsm.ros.variances has to be of size 3 for var_x, var_y, and var_z -> VSM input will not be used!");
684 "ins_vsm.ros.config of element " +
686 " has been set to be used but its variance is not > 0.0 -> its VSM input will not be used!");
693 [](
bool v) { return !v; }))
699 "all elements of ins_vsm.ros.config have been set to false due to invalid covariances -> VSM input will not be used!");
703 }
else if (ins_use_vsm)
708 "ins_vsm.ros.config has to be of size 3 to signal wether to use v_x, v_y, and v_z -> VSM input will not be used!");
721 boost::regex(
"(tcp)://(.+):(\\d+)")))
726 }
else if (boost::regex_match(
728 boost::regex(
"(file_name):(/|(?:/[\\w-]+)+.sbf)")))
734 }
else if (boost::regex_match(
736 boost::regex(
"(file_name):(/|(?:/[\\w-]+)+.pcap)")))
743 boost::regex(
"(serial):(.+)")))
745 std::string proto(match[2]);
754 std::stringstream ss;
755 ss <<
"Device is unsupported. Perhaps you meant 'tcp://host:port' or 'file_name:xxx.sbf' or 'serial:/path/to/device'?";
779 return ((period == 0) || ((period == 5 &&
isIns)) || (period == 10) ||
780 (period == 20) || (period == 40) || (period == 50) ||
781 (period == 100) || (period == 200) || (period == 500) ||
782 (period == 1000) || (period == 2000) || (period == 5000) ||
783 (period == 10000) || (period == 15000) || (period == 30000) ||
784 (period == 60000) || (period == 120000) || (period == 300000) ||
785 (period == 600000) || (period == 900000) || (period == 1800000) ||
786 (period == 3600000));
790 const std::string& sourceFrame,
805 sourceFrame +
" to " + targetFrame +
806 ": " + ex.what() +
".");
808 using namespace std::chrono_literals;
809 std::this_thread::sleep_for(2000ms);
817 Eigen::Quaterniond q(qm.w, qm.x, qm.y, qm.z);
818 Eigen::Quaterniond::RotationMatrixType C = q.matrix();
820 roll = std::atan2(C(2, 1), C(2, 2));
821 pitch = std::asin(-C(2, 0));
822 yaw = std::atan2(C(1, 0), C(0, 0));
831 #include "rclcpp_components/register_node_macro.hpp"
Osnma osnma
OSNMA settings.
bool publish_pose
Whether or not to publish the PoseWithCovarianceStampedMsg message.
bool publish_attcoveuler
Whether or not to publish the AttCovEulerMsg message.
std::string serial_port
VSM serial port.
std::string ins_initial_heading
For heading computation when unit is powered-cycled.
bool latency_compensation
Wether processing latency shall be compensated for in ROS timestamp.
void registerSubscriber()
bool keep_open
Wether OSNMA shall be kept open on shutdown.
bool publish_imusetup
Whether or not to publish the IMUSetupMsg message.
bool publish_twist
Whether or not to publish the TwistWithCovarianceStampedMsg message.
std::string local_frame_id
Frame id of the local frame to be inserted.
std::string id
Id of the NTRIP port.
bool publish_localization
Whether or not to publish the LocalizationMsg message.
float pos_std_dev
Position deviation mask.
std::vector< RtkSerial > serial
io::CommunicationCore IO_
Handles communication with the Rx.
std::string login_password
Password for login.
bool ip_server_keep_open
Wether VSM shall be kept open om shutdown.
std::string ros_source
VSM source for INS.
std::vector< bool > ros_config
Whether or not to use individual elements of 3D velocity (v_x, v_y, v_z)
bool publish_pvtcartesian
std::string udp_ip_server
UDP IP server id.
void checkUniquenssOfIps(ROSaicNodeBase *node, const Settings &settings)
std::string ip_server
VSM IP server id.
This class represents the ROsaic node, to be extended..
bool insert_local_frame
Wether local frame should be inserted into tf.
bool publish_pvtgeodetic
Whether or not to publish the PVTGeodeticMsg message.
double heading_offset
Attitude offset determination in longitudinal direction.
void log(log_level::LogLevel logLevel, const std::string &s) const
Log function to provide abstraction of ROS loggers.
void getTransform(const std::string &targetFrame, const std::string &sourceFrame, TransformStampedMsg &T_s_t) const
Gets transforms from tf2.
bool publish_gpgga
Whether or not to publish the GGA message.
bool keep_open
Wether RTK connections shall be kept open on shutdown.
bool publish_imu
Whether or not to publish the ImuMsg message.
std::string ntp_server
Server for NTP synchronization.
uint32_t baud_rate
Baud rate of the serial port on which Rx receives the corrections.
double wrapAngle180to180(double angle)
Wraps an angle between -180 and 180 degrees.
geometry_msgs::msg::Quaternion QuaternionMsg
bool multi_antenna
INS multiantenna.
double vsm_x
INS velocity sensor lever arm x-offset.
uint32_t udp_port
UDP port.
bool validPeriod(uint32_t period, bool isIns) const
Checks if the period has a valid value.
void autoPublish(ROSaicNodeBase *node, Settings &settings)
void checkUniquenssOfIpsVsm(ROSaicNodeBase *node, const Settings &settings)
uint32_t serial_baud_rate
VSM serial baud rate.
bool ntp_server
Wether NTP server shall be activated.
float delta_n
Marker-to-ARP offset in the northward direction.
uint32_t polling_period_pvt
Polling period for PVT-related SBF blocks.
std::string mode
OSNMA mode.
bool tls
Wether to use TLS.
std::string datum
Datum to be used.
std::string frame_id
The frame ID used in the header of every published ROS message.
device_type::DeviceType device_type
Device type.
double theta_z
IMU orientation z-angle.
std::string send_gga
Whether (and at which rate) or not to send GGA to the serial port.
bool publish_gpst
Whether or not to publish the TimeReferenceMsg message with GPST.
double poi_y
INS POI offset in y-dimension.
bool activate_debug_log
Set logger level to DEBUG.
bool publish_galauthstatus
Whether or not to publish the GALAuthStatus message and diagnostics.
bool publish_velcovcartesian
bool publish_aimplusstatus
double poi_x
INS POI offset in x-dimension.
std::unique_ptr< tf2_ros::TransformListener > tfListener_
void sendVelocity(const std::string &velNmea)
Hands over NMEA velocity message over to the send() method of manager_.
This class is the base class for abstraction.
std::string tcp_ip_server
TCP IP server id.
double theta_x
IMU orientation x-angle.
bool publish_velsensorsetup
Whether or not to publish the VelSensorSetupMsg message.
double theta_y
IMU orientation y-angle.
std::string ant_aux1_serial_nr
Serial number of your particular Aux1 antenna.
std::string send_gga
Whether (and at which rate) or not to send GGA to the NTRIP caster.
std::string fingerprint
Self-signed certificate fingerprint.
bool publish_exteventinsnavcart
Whether or not to publish the ExtEventINSNavCartMsg message.
bool publish_gpsfix
Whether or not to publish the GpsFixMsg message.
bool publish_gpgsa
Whether or not to publish the GSA message.
std::string vsm_frame_id
The frame ID of the velocity sensor.
uint32_t baudrate
Baudrate.
bool publish_velcovgeodetic
bool getUint32Param(const std::string &name, uint32_t &val, uint32_t defaultVal)
Gets an integer or unsigned integer value from the parameter server.
std::string caster
Hostname or IP address of the NTRIP caster to connect to.
bool ptp_server_clock
Wether PTP grandmaster clock shall be activated.
uint32_t tcp_port
TCP port.
bool publish_poscovgeodetic
The heart of the ROSaic driver: The ROS node that represents it.
double vsm_y
INS velocity sensor lever arm y-offset.
bool publish_tf_ecef
Whether or not to publish the tf of the localization.
bool publish_basevectorcart
void sendVelocity(const std::string &velNmea)
Send velocity to communication layer (virtual)
std::vector< RtkNtrip > ntrip
bool serial_keep_open
Wether VSM shall be kept open om shutdown.
bool keep_open
Wether RTK connections shall be kept open on shutdown.
uint32_t caster_port
IP port number of NTRIP caster to connect to.
double vsm_z
INS velocity sensor lever arm z-offset.
bool use_ros_axis_orientation
ROS axis orientation, body: front-left-up, geographic: ENU.
double pitch_offset
Attitude offset determination in latitudinal direction.
std::string ant_aux1_type
bool publish_localization_ecef
Whether or not to publish the LocalizationMsg message.
bool isIns()
Check if Rx is INS.
float delta_u
Marker-to-ARP offset in the upward direction.
bool ins_use_poi
INS solution reference point.
std::string ant_serial_nr
Serial number of your particular Main antenna.
bool getROSParams()
Gets the node parameters from the ROS Parameter Server, parts of which are specified in a YAML file.
bool publish_atteuler
Whether or not to publish the AttEulerMsg message.
std::string login_user
Username for login.
bool use_stream_device
Wether to use stream device tcp.
bool lock_utm_zone
Wether the UTM zone of the localization is locked.
std::vector< double > ros_variances
Variances of the 3D velocity (var_x, var_y, var_z)
bool publish_basevectorgeod
Whether or not to publish the BaseVectorGeodMsg message.
bool publish_diagnostics
Whether or not to publish the DiagnosticArrayMsg message.
std::string imu_frame_id
The frame ID used in the header of published ROS Imu message.
geometry_msgs::msg::TransformStamped TransformStampedMsg
uint32_t polling_period_rest
Polling period for all other SBF blocks and NMEA messages.
std::string device_tcp_port
TCP port.
std::string version
NTRIP version for NTRIP service.
bool param(const std::string &name, T &val, const T &defaultVal)
Gets parameter of type T from the parameter server.
std::vector< RtkIpServer > ip_server
std::string rtk_standard
RTCM version for correction data.
double poi_z
INS POI offset in z-dimension.
Settings settings_
Settings.
Eigen::Isometry3d transformToEigen(const geometry_msgs::Transform &t)
std::string custom_commands_file
Custom commands file.
std::string username
Username for NTRIP service.
void getRPY(const QuaternionMsg &qm, double &roll, double &pitch, double &yaw) const
Gets Euler angles from quaternion message.
void checkUniquenssOfIpsPortsVsm(ROSaicNodeBase *node, const Settings &settings)
bool publish_poscovcartesian
std::string rtk_standard
RTCM version for correction data.
bool publish_insnavcart
Whether or not to publish the INSNavCartMsg message.
float delta_e
Marker-to-ARP offset in the eastward direction.
bool read_from_sbf_log
Whether or not we are reading from an SBF file.
std::string hw_flow_control
HW flow control.
InsVsm ins_vsm
INS VSM setting.
std::string rtk_standard
RTCM version for correction data.
std::string device_tcp_ip
TCP IP.
double ant_lever_z
INS antenna lever arm z-offset.
std::string vehicle_frame_id
The frame ID of the vehicle frame.
int32_t leap_seconds
The number of leap seconds that have been inserted into the UTC time.
bool publish_gprmc
Whether or not to publish the RMC message.
void connect()
Connects the data stream.
bool keep_open
Wether RTK connections shall be kept open on shutdown.
std::string aux1_frame_id
The frame ID of the aux1 antenna.
bool publish_navsatfix
Whether or not to publish the NavSatFixMsg message.
bool publish_tf
Whether or not to publish the tf of the localization.
std::string udp_unicast_ip
UDP unicast destination ip.
bool publish_only_valid
Wether to publish only valid messages.
float att_std_dev
Attitude deviation mask.
bool auto_publish
Wether to publish automatically for cinfigure_rx = false.
bool publish_measepoch
Whether or not to publish the MeasEpoch message.
bool publish_exteventinsnavgeod
Whether or not to publish the ExtEventINSNavGeodMsg message.
void checkUniquenssOfIpsPorts(ROSaicNodeBase *node, const Settings &settings)
std::string id
The IP server id.
double ant_lever_x
INS antenna lever arm x-offset.
bool publish_extsensormeas
Whether or not to publish the ExtSensorMeasMsg message.
tf2_ros::Buffer tfBuffer_
tf2 buffer and listener
std::string mountpoint
Mountpoint for NTRIP service.
std::string device
Device.
bool ros_variances_by_parameter
Whether or not to use variance defined by ROS parameter.
bool publish_insnavgeod
Whether or not to publish the INSNavGeodMsg message.
Rtk rtk
RTK corrections settings.
std::string password
Password for NTRIP service.
std::string septentrio_receiver_type
Septentrio receiver type, either "gnss" or "ins".
virtual geometry_msgs::TransformStamped lookupTransform(const std::string &target_frame, const ros::Time &target_time, const std::string &source_frame, const ros::Time &source_time, const std::string &fixed_frame, const ros::Duration timeout) const
bool read_from_pcap
Whether or not we are reading from a PCAP file.
bool publish_gpgsv
Whether or not to publish the GSV message.
uint32_t ip_server_port
VSM tcp port.
double ant_lever_y
INS antenna lever arm y-offset.
std::string send_gga
Whether (and at which rate) or not to send GGA to the NTRIP caster.