Go to the documentation of this file.
35 #include <unordered_map>
44 #include <diagnostic_msgs/DiagnosticArray.h>
45 #include <diagnostic_msgs/DiagnosticStatus.h>
46 #include <geometry_msgs/PoseWithCovarianceStamped.h>
47 #include <geometry_msgs/Quaternion.h>
48 #include <geometry_msgs/TwistWithCovarianceStamped.h>
49 #include <gps_common/GPSFix.h>
50 #include <nav_msgs/Odometry.h>
51 #include <sensor_msgs/Imu.h>
52 #include <sensor_msgs/NavSatFix.h>
53 #include <sensor_msgs/TimeReference.h>
55 #include <septentrio_gnss_driver/AttCovEuler.h>
56 #include <septentrio_gnss_driver/AttEuler.h>
57 #include <septentrio_gnss_driver/BaseVectorCart.h>
58 #include <septentrio_gnss_driver/BaseVectorGeod.h>
59 #include <septentrio_gnss_driver/BlockHeader.h>
60 #include <septentrio_gnss_driver/MeasEpoch.h>
61 #include <septentrio_gnss_driver/MeasEpochChannelType1.h>
62 #include <septentrio_gnss_driver/MeasEpochChannelType2.h>
63 #include <septentrio_gnss_driver/PVTCartesian.h>
64 #include <septentrio_gnss_driver/PVTGeodetic.h>
65 #include <septentrio_gnss_driver/PosCovCartesian.h>
66 #include <septentrio_gnss_driver/PosCovGeodetic.h>
67 #include <septentrio_gnss_driver/ReceiverTime.h>
68 #include <septentrio_gnss_driver/VectorInfoCart.h>
69 #include <septentrio_gnss_driver/VectorInfoGeod.h>
70 #include <septentrio_gnss_driver/VelCovCartesian.h>
71 #include <septentrio_gnss_driver/VelCovGeodetic.h>
73 #include <nmea_msgs/Gpgga.h>
74 #include <nmea_msgs/Gpgsa.h>
75 #include <nmea_msgs/Gpgsv.h>
76 #include <nmea_msgs/Gprmc.h>
78 #include <septentrio_gnss_driver/ExtSensorMeas.h>
79 #include <septentrio_gnss_driver/IMUSetup.h>
80 #include <septentrio_gnss_driver/INSNavCart.h>
81 #include <septentrio_gnss_driver/INSNavGeod.h>
82 #include <septentrio_gnss_driver/VelSensorSetup.h>
203 if ((!
pNh_->getParam(name, tempVal)) || (tempVal < 0))
220 template <
typename T>
221 bool param(
const std::string& name, T& val,
const T& defaultVal)
223 return pNh_->param(name, val, defaultVal);
266 template <
typename M>
272 it->second.publish(msg);
276 topicMap_.insert(std::make_pair(topic, pub));
287 if (std::isnan(loc.pose.pose.orientation.w))
294 geometry_msgs::TransformStamped transformStamped;
295 transformStamped.header.stamp = loc.header.stamp;
296 transformStamped.header.frame_id = loc.header.frame_id;
297 transformStamped.child_frame_id = loc.child_frame_id;
298 transformStamped.transform.translation.x = loc.pose.pose.position.x;
299 transformStamped.transform.translation.y = loc.pose.pose.position.y;
300 transformStamped.transform.translation.z = loc.pose.pose.position.z;
301 transformStamped.transform.rotation.x = loc.pose.pose.orientation.x;
302 transformStamped.transform.rotation.y = loc.pose.pose.orientation.y;
303 transformStamped.transform.rotation.z = loc.pose.pose.orientation.z;
304 transformStamped.transform.rotation.w = loc.pose.pose.orientation.w;
308 geometry_msgs::TransformStamped T_l_b;
321 <<
": No transform for insertion of local frame at t="
323 <<
". Exception: " << std::string(ex.what()));
332 <<
": No most recent transform for insertion of local frame. Exception: "
333 << std::string(ex.what()));
342 transformStamped.header.stamp = loc.header.stamp;
343 transformStamped.header.frame_id = loc.header.frame_id;
366 const geometry_msgs::TwistWithCovariance& twist)
368 time_t epochSeconds = stamp / 1000000000;
369 struct tm* tm_temp = std::gmtime(&epochSeconds);
370 std::stringstream timeUtc;
371 timeUtc << std::setfill(
'0') << std::setw(2)
372 << std::to_string(tm_temp->tm_hour) << std::setw(2)
373 << std::to_string(tm_temp->tm_min) << std::setw(2)
374 << std::to_string(tm_temp->tm_sec) <<
"." << std::setw(3)
375 << std::to_string((stamp - (stamp / 1000000000) * 1000000000) /
390 else if (twist.covariance[0] > 0.0)
392 std::sqrt(twist.covariance[0]));
396 << std::to_string(twist.covariance[0])
397 <<
". Ignoring measurement.");
400 std_x = std::to_string(1000000.0);
409 else if (twist.covariance[7] > 0.0)
411 std::sqrt(twist.covariance[7]));
415 << std::to_string(twist.covariance[1])
416 <<
". Ignoring measurement.");
430 else if (twist.covariance[14] > 0.0)
432 std::sqrt(twist.covariance[14]));
436 << std::to_string(twist.covariance[2])
437 <<
". Ignoring measurement.");
444 std::string velNmea =
"$PSSN,VSM," + timeUtc.str() +
"," + v_x +
"," + v_y +
445 "," + std_x +
"," + std_y +
"," + v_z +
"," + std_z;
447 char crc = std::accumulate(velNmea.begin() + 1, velNmea.end(), 0,
448 [](
char sum,
char ch) { return sum ^ ch; });
450 std::stringstream crcss;
451 crcss << std::hex << static_cast<int32_t>(crc);
453 velNmea +=
"*" + crcss.str() +
"\r\n";
459 std::shared_ptr<ros::NodeHandle>
pNh_;
463 virtual void sendVelocity(
const std::string& velNmea) = 0;
467 std::unordered_map<std::string, ros::Publisher>
topicMap_;
septentrio_gnss_driver::VectorInfoGeod VectorInfoGeodMsg
tf2_ros::TransformListener tfListener_
void registerSubscriber()
Timestamp timestampFromRos(const TimestampRos &tsr)
Convert ROS timestamp to nsec timestamp.
std::string local_frame_id
Frame id of the local frame to be inserted.
#define ROS_ERROR_STREAM(args)
nmea_msgs::Gpgsv GpgsvMsg
Timestamp getTime()
Gets current timestamp.
bool insert_local_frame
Wether local frame should be inserted into tf.
sensor_msgs::NavSatFix NavSatFixMsg
#define ROS_FATAL_STREAM(args)
geometry_msgs::TwistWithCovarianceStamped TwistWithCovarianceStampedMsg
void processTwist(Timestamp stamp, const geometry_msgs::TwistWithCovariance &twist)
septentrio_gnss_driver::BlockHeader BlockHeaderMsg
TimestampRos timestampToRos(Timestamp ts)
Convert nsec timestamp to ROS timestamp.
sensor_msgs::NavSatStatus NavSatStatusMsg
ros::Subscriber odometrySubscriber_
Odometry subscriber.
void publishMessage(const std::string &topic, const M &msg)
Publishing function.
septentrio_gnss_driver::VelCovGeodetic VelCovGeodeticMsg
septentrio_gnss_driver::ReceiverTime ReceiverTimeMsg
#define ROS_DEBUG_STREAM(args)
septentrio_gnss_driver::INSNavCart INSNavCartMsg
void publish(const boost::shared_ptr< M > &message) const
void publishTf(const LocalizationUtmMsg &loc)
Publishing function for tf.
This class is the base class for abstraction.
sensor_msgs::TimeReference TimeReferenceMsg
bool ins_vsm_ros_variances_by_parameter
Whether or not to use variance defined by ROS parameter.
geometry_msgs::TransformStamped eigenToTransform(const Eigen::Affine3d &T)
std::unordered_map< std::string, ros::Publisher > topicMap_
Map of topics and publishers.
septentrio_gnss_driver::PVTGeodetic PVTGeodeticMsg
septentrio_gnss_driver::PosCovGeodetic PosCovGeodeticMsg
#define ROS_WARN_STREAM(args)
bool getUint32Param(const std::string &name, uint32_t &val, uint32_t defaultVal)
Gets an integer or unsigned integer value from the parameter server.
#define ROS_WARN_STREAM_THROTTLE(period, args)
septentrio_gnss_driver::MeasEpochChannelType1 MeasEpochChannelType1Msg
virtual void sendVelocity(const std::string &velNmea)=0
Send velocity to communication layer (virtual)
nav_msgs::Odometry LocalizationUtmMsg
std::vector< bool > ins_vsm_ros_config
Whether or not to use individual elements of 3D velocity (v_x, v_y, v_z)
septentrio_gnss_driver::PVTCartesian PVTCartesianMsg
#define ROS_INFO_STREAM_THROTTLE(period, args)
Declares lower-level string utility functions used when parsing messages.
septentrio_gnss_driver::VelCovCartesian VelCovCartesianMsg
bool use_ros_axis_orientation
ROS axis orientation, body: front-left-up, geographic: ENU.
septentrio_gnss_driver::PosCovCartesian PosCovCartesianMsg
gps_common::GPSFix GPSFixMsg
std::string trimDecimalPlaces(double num)
Trims decimal places to two.
gps_common::GPSStatus GPSStatusMsg
septentrio_gnss_driver::AttCovEuler AttCovEulerMsg
nmea_msgs::Gpgga GpggaMsg
void callbackOdometry(const nav_msgs::Odometry::ConstPtr &odo)
septentrio_gnss_driver::INSNavGeod INSNavGeodMsg
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
#define ROS_INFO_STREAM(args)
bool param(const std::string &name, T &val, const T &defaultVal)
Gets parameter of type T from the parameter server.
geometry_msgs::TransformStamped TransformStampedMsg
diagnostic_msgs::DiagnosticStatus DiagnosticStatusMsg
Settings settings_
Settings.
Eigen::Isometry3d transformToEigen(const geometry_msgs::Transform &t)
tf2_ros::TransformBroadcaster tf2Publisher_
Transform publisher.
const ROSCPP_DECL std::string & getName()
septentrio_gnss_driver::ExtSensorMeas ExtSensorMeasMsg
ros::Subscriber twistSubscriber_
Twist subscriber.
void callbackTwist(const TwistWithCovarianceStampedMsg::ConstPtr &twist)
Time & fromNSec(uint64_t t)
septentrio_gnss_driver::BaseVectorGeod BaseVectorGeodMsg
std::string ins_vsm_ros_source
VSM source for INS.
std::shared_ptr< ros::NodeHandle > pNh_
Node handle pointer.
void log(LogLevel logLevel, const std::string &s)
Log function to provide abstraction of ROS loggers.
nmea_msgs::Gpgsa GpgsaMsg
septentrio_gnss_driver::VectorInfoCart VectorInfoCartMsg
septentrio_gnss_driver::VelSensorSetup VelSensorSetupMsg
septentrio_gnss_driver::BaseVectorCart BaseVectorCartMsg
nmea_msgs::Gprmc GprmcMsg
septentrio_gnss_driver::MeasEpoch MeasEpochMsg
tf2_ros::Buffer tfBuffer_
tf buffer
virtual ~ROSaicNodeBase()
std::vector< double > ins_vsm_ros_variances
Variances of the 3D velocity (var_x, var_y, var_z)
geometry_msgs::Quaternion QuaternionMsg
septentrio_gnss_driver::MeasEpochChannelType2 MeasEpochChannelType2Msg
LogLevel
Log level for ROS logging.
uint32_t queueSize_
Publisher queue size.
TimestampRos lastTfStamp_
Last tf stamp.
septentrio_gnss_driver::IMUSetup IMUSetupMsg
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
geometry_msgs::PoseWithCovarianceStamped PoseWithCovarianceStampedMsg
diagnostic_msgs::DiagnosticArray DiagnosticArrayMsg
septentrio_gnss_driver::AttEuler AttEulerMsg