Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to inject additional extensions to monVer from param file. #210

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ublox_gps/config/m8p_timing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Configuration Settings for C94-M8P as a timing device

debug: 1 # Range 0-4 (0 means no debug statements will print)

device: /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_GNSS_receiver-if00
frame_id: gps
extensions: ["FWVER=TIM"]

inf:
all: true # Whether to display all INF messages in console

publish:
all: false
tim:
tm2: true
22 changes: 22 additions & 0 deletions ublox_gps/include/ublox_gps/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
// STL
#include <vector>
#include <set>
#include <ctime>
// Boost
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
Expand Down Expand Up @@ -878,6 +879,27 @@ class UbloxFirmware7Plus : public UbloxFirmware {
last_nav_pvt_ = m;
freq_diag->diagnostic->tick(fix.header.stamp);
updater->update();

static ros::Publisher time_ref_pub =
nh->advertise<sensor_msgs::TimeReference>("time_gps", kROSQueueSize);
sensor_msgs::TimeReference time_ref;
time_ref.header.stamp = fix.header.stamp;
time_ref.header.frame_id = frame_id;
time_ref.time_ref = fix.header.stamp;

struct tm sample_date = {
.tm_sec=m.sec,
.tm_min=m.min,
.tm_hour=m.hour,
.tm_mday=m.day,
.tm_mon=m.month - 1,
.tm_year=m.year - 1900,
};

time_t sample_time = mktime(&sample_date) - timezone;
uint sample_time_ms = m.iTOW%1000;
time_ref.time_ref = ros::Time(sample_time, sample_time_ms*1e6);
time_ref_pub.publish(time_ref);
}

protected:
Expand Down
5 changes: 5 additions & 0 deletions ublox_gps/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ void UbloxNode::processMonVer() {
monVer.hwVersion.c_array());
// Convert extension to vector of strings
std::vector<std::string> extension;
// Inject any extensions from the parameter server
nh->getParam("extensions", extension);
for(std::size_t i = 0; i < extension.size(); ++i) {
ROS_DEBUG("Injected extension %s", extension[i].c_str());
}
extension.reserve(monVer.extension.size());
for(std::size_t i = 0; i < monVer.extension.size(); ++i) {
ROS_DEBUG("%s", monVer.extension[i].field.c_array());
Expand Down