Go to the documentation of this file.
32 #include <linux/serial.h>
35 #include <boost/regex.hpp>
62 node_(node), settings_(node->settings()), telegramHandler_(node),
78 std::shared_ptr<Telegram> telegram(
new Telegram);
91 send(
"sso, all, none, none, off \x0D");
92 send(
"sno, all, none, none, off \x0D");
99 if (!ntrip.id.empty() && !ntrip.keep_open)
101 send(
"snts, " + ntrip.id +
", off \x0D");
106 if (!ip_server.id.empty() && !ip_server.keep_open)
108 send(
"sdio, " + ip_server.id +
", auto, none\x0D");
109 send(
"siss, " + ip_server.id +
", 0\x0D");
114 if (!serial.port.empty() && !serial.keep_open)
116 send(
"sdio, " + serial.port +
", auto, none\x0D");
117 if (serial.port.rfind(
"COM", 0) == 0)
118 send(
"scs, " + serial.port +
119 ", baud115200, bits8, No, bit1, none\x0D");
137 ", baud115200, bits8, No, bit1, none\x0D");
145 std::stringstream ss;
146 ss <<
"sou, off \x0D";
151 std::stringstream ss;
152 ss <<
"snc, off \x0D";
167 "Started timer for calling connect() method until connection succeeds");
169 boost::asio::io_service
io;
170 boost::posix_time::millisec wait_ms(
176 boost::asio::deadline_timer
t(
io, wait_ms);
201 "Successully connected. Leaving connect() method");
274 "Called configureRx() method but IO is not initialized.");
282 boost::regex(
"(tcp)://(.+):(\\d+)"));
283 std::string proto(match[1]);
297 std::string destination;
301 destination =
"255.255.255.255";
327 send(
"sso, all, none, none, off \x0D");
328 send(
"sno, all, none, none, off \x0D");
336 send(
"sntp, on \x0D");
342 std::stringstream ss;
350 std::stringstream ss;
359 std::stringstream ss;
370 std::stringstream ss;
383 std::stringstream ss;
396 if (!ntrip.id.empty())
399 send(
"snts, " + ntrip.id +
", off \x0D");
401 std::stringstream ss;
402 ss <<
"snts, " << ntrip.id <<
", Client, " << ntrip.caster
403 <<
", " << std::to_string(ntrip.caster_port) <<
", "
404 << ntrip.username <<
", " << ntrip.password <<
", "
405 << ntrip.mountpoint <<
", " << ntrip.version <<
", "
406 << ntrip.send_gga <<
" \x0D";
411 std::stringstream ss;
412 ss <<
"sntt, " << ntrip.id <<
", on, \"" << ntrip.fingerprint
417 std::stringstream ss;
418 ss <<
"sntt, " << ntrip.id <<
", off \x0D";
426 if (!ip_server.id.empty())
432 std::stringstream ss;
435 ss <<
"siss, " << ip_server.id <<
", "
436 << std::to_string(ip_server.port) <<
", TCP2Way \x0D";
440 std::stringstream ss;
441 ss <<
"sdio, " << ip_server.id <<
", " << ip_server.rtk_standard
442 <<
", +SBF+NMEA \x0D";
445 if (ip_server.send_gga !=
"off")
447 std::string rate = ip_server.send_gga;
448 if (ip_server.send_gga ==
"auto")
450 std::stringstream ss;
451 ss <<
"sno, Stream" << std::to_string(stream) <<
", "
452 << ip_server.id <<
", GGA, " << rate <<
" \x0D";
461 if (!serial.port.empty())
463 if (serial.port.rfind(
"COM", 0) == 0)
464 send(
"scs, " + serial.port +
", baud" +
465 std::to_string(serial.baud_rate) +
466 ", bits8, No, bit1, none\x0D");
468 std::stringstream ss;
469 ss <<
"sdio, " << serial.port <<
", " << serial.rtk_standard
470 <<
", +SBF+NMEA \x0D";
472 if (serial.send_gga !=
"off")
474 std::string rate = serial.send_gga;
475 if (serial.send_gga ==
"auto")
477 std::stringstream ss;
478 ss <<
"sno, Stream" << std::to_string(stream) <<
", "
479 << serial.port <<
", GGA, " << rate <<
" \x0D";
490 send(
"sga, MultiAntenna \x0D");
493 "Multi antenna requested but Rx does not support it.");
496 send(
"sga, none \x0D");
506 std::stringstream ss;
516 "Please specify a valid parameter for heading and pitch");
525 std::stringstream ss;
547 "Please specify a correct value for IMU orientation angles");
560 std::stringstream ss;
573 "Please specify a correct value for x, y and z in the config file under ant_lever_arm");
586 std::stringstream ss;
599 "Please specify a correct value for poi_x, poi_y and poi_z in the config file under poi_lever_arm");
612 std::stringstream ss;
625 "Please specify a correct value for vsm_x, vsm_y and vsm_z in the config file under vsm_lever_arm");
632 std::stringstream ss;
633 ss <<
"sinc, off, all, MainAnt \x0D";
639 std::stringstream ss;
642 ss <<
"sinc, on, all, "
648 ss <<
"sinc, on, all, "
657 std::stringstream ss;
669 "Invalid mode specified for ins_initial_heading.");
680 std::stringstream ss;
690 "Please specify a valid AttStsDev and PosStdDev");
698 std::stringstream ss;
704 std::stringstream ss;
712 "OSNMA mode set to strict but no NTP server provided. In Strict mode an NTP server is mandatory!");
718 std::stringstream blocks;
723 blocks <<
" +IMUSetup";
727 blocks <<
" +VelSensorSetup";
732 blocks <<
" +ReceiverStatus +QualityInd";
736 blocks <<
" +RFStatus";
742 blocks <<
" +GALAuthStatus";
745 blocks <<
" +ReceiverSetup";
747 std::stringstream ss;
748 ss <<
"sso, Stream" << std::to_string(stream) <<
", " <<
streamPort_
749 <<
"," << blocks.str() <<
", " << rest_interval <<
"\x0D";
755 send(
"sop, \"\", \"\" \x0D");
760 send(
"snti, auto\x0D");
762 send(
"snti, GP\x0D");
764 std::stringstream blocks;
782 std::stringstream ss;
783 ss <<
"sno, Stream" << std::to_string(stream) <<
", " <<
streamPort_
784 <<
"," << blocks.str() <<
", " << pvt_interval <<
"\x0D";
791 std::stringstream blocks;
794 blocks <<
" +ReceiverTime";
798 blocks <<
" +PVTCartesian";
811 blocks <<
" +PVTGeodetic";
815 blocks <<
" +BaseVectorCart";
819 blocks <<
" +BaseVectorGeod";
823 blocks <<
" +PosCovCartesian";
833 blocks <<
" +PosCovGeodetic";
837 blocks <<
" +VelCovCartesian";
843 blocks <<
" +VelCovGeodetic";
851 blocks <<
" +AttEuler";
859 blocks <<
" +AttCovEuler";
863 blocks <<
" +MeasEpoch";
867 blocks <<
" +ChannelStatus +DOP";
877 blocks <<
" +INSNavCart";
886 blocks <<
" +INSNavGeod";
890 blocks <<
" +ExtEventINSNavGeod";
894 blocks <<
" +ExtEventINSNavCart";
898 blocks <<
" +ExtSensorMeas";
901 std::stringstream ss;
902 ss <<
"sso, Stream" << std::to_string(stream) <<
", " <<
streamPort_
903 <<
"," << blocks.str() <<
", " << pvt_interval <<
"\x0D";
915 send(
"sdio, IPS2, NMEA, none\x0D");
922 ", bits8, No, bit1, none\x0D");
948 std::string cmd(
"\x0DSSSSSSSSSS\x0D\x0D");
964 std::shared_ptr<Telegram> telegram;
Osnma osnma
OSNMA settings.
bool publish_pose
Whether or not to publish the PoseWithCovarianceStampedMsg message.
static const int8_t PITCH_MIN
bool publish_attcoveuler
Whether or not to publish the AttCovEulerMsg message.
void resetSettings()
Resets Rx settings.
std::string ins_initial_heading
For heading computation when unit is powered-cycled.
static const int8_t THETA_Y_MIN
bool latency_compensation
Wether processing latency shall be compensated for in ROS timestamp.
bool ins_vsm_ip_server_keep_open
Wether VSM shall be kept open om shutdown.
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.
bool publish_localization
Whether or not to publish the LocalizationMsg message.
float pos_std_dev
Position deviation mask.
std::vector< RtkSerial > serial
void resetWaitforMainCd()
Returns the connection descriptor.
std::string login_password
Password for login.
Highest-Level view on communication services.
bool publish_pvtcartesian
std::string udp_ip_server
UDP IP server id.
std::string getMainCd()
Returns the connection descriptor.
This is the central interface between ROSaic and the Rx(s), managing I/O operations such as reading m...
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.
bool publish_gpgga
Whether or not to publish the GGA message.
bool publish_imu
Whether or not to publish the ImuMsg message.
std::string ntp_server
Server for NTP synchronization.
bool multi_antenna
INS multiantenna.
double vsm_x
INS velocity sensor lever arm x-offset.
uint32_t udp_port
UDP port.
std::string convertUserPeriodToRxCommand(uint32_t period_user)
Transforms the input polling period [milliseconds] into a std::string number that can be appended to ...
static const int16_t ANGLE_MIN
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.
std::unique_ptr< AsyncManager< TcpIo > > tcpClient_
std::string datum
Datum to be used.
device_type::DeviceType device_type
Device type.
double theta_z
IMU orientation z-angle.
bool publish_gpst
Whether or not to publish the TimeReferenceMsg message with GPST.
double poi_y
INS POI offset in y-dimension.
bool publish_galauthstatus
Whether or not to publish the GALAuthStatus message and diagnostics.
static const int8_t POSSTD_DEV_MAX
bool publish_velcovcartesian
bool publish_aimplusstatus
double poi_x
INS POI offset in x-dimension.
void configureRx()
Configures Rx: Which SBF/NMEA messages it should output and later correction settings.
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.
void pop(T &output) noexcept
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.
static const int8_t ATTSTD_DEV_MIN
bool publish_exteventinsnavcart
Whether or not to publish the ExtEventINSNavCartMsg message.
bool publish_gpsfix
Whether or not to publish the GpsFixMsg message.
std::thread processingThread_
Processing thread.
bool publish_gpgsa
Whether or not to publish the GSA message.
const Settings * settings_
Settings.
bool publish_velcovgeodetic
uint32_t tcp_port
TCP port.
bool publish_poscovgeodetic
bool publish_tf_ecef
Whether or not to publish the tf of the localization.
double vsm_y
INS velocity sensor lever arm y-offset.
std::string mainConnectionPort_
Main communication port.
bool publish_basevectorcart
static const int16_t HEADING_MAX
std::vector< RtkNtrip > ntrip
CommunicationCore(ROSaicNodeBase *node)
Constructor of the class CommunicationCore.
static const int8_t LEVER_ARM_MIN
double vsm_z
INS velocity sensor lever arm z-offset.
double pitch_offset
Attitude offset determination in latitudinal direction.
std::string trimDecimalPlaces(double num)
Trims decimal places to three.
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.
ROSaicNodeBase * node_
Pointer to Node.
bool ins_use_poi
INS solution reference point.
std::string ant_serial_nr
Serial number of your particular Main antenna.
static const int8_t PITCH_MAX
uint32_t ins_vsm_ip_server_port
VSM tcp port.
bool publish_atteuler
Whether or not to publish the AttEulerMsg message.
std::string login_user
Username for login.
static const int8_t THETA_Y_MAX
bool publish_basevectorgeod
Whether or not to publish the BaseVectorGeodMsg message.
bool publish_diagnostics
Whether or not to publish the DiagnosticArrayMsg message.
std::unique_ptr< UdpClient > udpClient_
void push(const T &input) noexcept
uint32_t polling_period_rest
Polling period for all other SBF blocks and NMEA messages.
std::vector< RtkIpServer > ip_server
bool hasHeading()
Check if Rx has heading.
double poi_z
INS POI offset in z-dimension.
std::string ins_vsm_serial_port
VSM serial port.
static const int16_t ANGLE_MAX
void send(const std::string &)
Hands over to the send() method of manager_.
bool publish_poscovcartesian
bool publish_insnavcart
Whether or not to publish the INSNavCartMsg message.
float delta_e
Marker-to-ARP offset in the eastward direction.
bool initializeIo()
Initializes the I/O handling.
bool read_from_sbf_log
Whether or not we are reading from an SBF file.
bool containsSpace(const std::string str)
Checks if a string contains spaces.
double ant_lever_z
INS antenna lever arm z-offset.
bool publish_gprmc
Whether or not to publish the RMC message.
std::string ins_vsm_ros_source
VSM source for INS.
void connect()
Connects the data stream.
void waitForCapabilities()
Waits for capabilities.
uint32_t ins_vsm_serial_baud_rate
VSM serial baud rate.
TelegramQueue telegramQueue_
TelegramQueue.
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.
static const int8_t POSSTD_DEV_MIN
float att_std_dev
Attitude deviation mask.
std::atomic< bool > running_
Indicator for threads to run.
bool publish_measepoch
Whether or not to publish the MeasEpoch message.
bool publish_exteventinsnavgeod
Whether or not to publish the ExtEventINSNavGeodMsg message.
static const int8_t ATTSTD_DEV_MAX
std::string ins_vsm_ip_server_id
VSM IP server id.
double ant_lever_x
INS antenna lever arm x-offset.
bool publish_extsensormeas
Whether or not to publish the ExtSensorMeasMsg message.
void waitForResponse()
Waits for response.
std::string resetMainConnection()
Reset main connection so it can receive commands.
std::string device
Device.
~CommunicationCore()
Default destructor of the class CommunicationCore.
static const int16_t HEADING_MIN
bool publish_insnavgeod
Whether or not to publish the INSNavGeodMsg message.
Rtk rtk
RTK corrections settings.
void handleTelegram(const std::shared_ptr< Telegram > &telegram)
Called every time a telegram is received.
std::string septentrio_receiver_type
Septentrio receiver type, either "gnss" or "ins".
std::unique_ptr< AsyncManagerBase > manager_
geometry_msgs::TransformStamped t
static const int8_t LEVER_ARM_MAX
TelegramHandler telegramHandler_
TelegramHandler.
bool read_from_pcap
Whether or not we are reading from a PCAP file.
bool ins_vsm_serial_keep_open
Wether VSM shall be kept open om shutdown.
bool publish_gpgsv
Whether or not to publish the GSV message.
double ant_lever_y
INS antenna lever arm y-offset.
bool initializedIo_
Whether connecting was successful.