KumarRobotics / ublox

A driver for ublox gps
BSD 3-Clause "New" or "Revised" License
453 stars 390 forks source link
gps ros ros-driver ublox ublox-gps

ublox

The ublox package provides support for u-blox GPS receivers. Only the serial configuration of the driver is documented here, but TCP/UDP communication is also supported by the driver (untested).

The driver was originally written by Johannes Meyer. Changes made later are detailed in the version history below.

Options

Example .yaml configuration files are included in ublox_gps/config. Consult the u-blox documentation for your device for the recommended settings.

The ublox_gps node supports the following parameters for all products and firmware versions:

For firmware version 6:

For devices with firmware >= 7:

For devices with firmware >= 8:

For UDR/ADR devices:

For HPG Reference devices:

For HPG Rover devices:

For TIM devices:

For FTS devices:

Fix Topics

~fix(sensor_msgs/NavSatFix)

Navigation Satellite fix.

~fix_velocity(geometry_msgs/TwistWithCovarianceStamped)

Velocity in local ENU frame.

INF messages

To enable printing INF messages to the ROS console, set the parameters below.

Additional Topics

To publish a given u-blox message to a ROS topic, set the parameter shown below to true. The node sets the rate of the u-blox messages to 1 measurement cycle.

All messages

AID messages

RXM messages

MON messages

NAV messages

ESF messages

HNR messages

TIM messages

Launch

A sample launch file ublox_device.launch loads the parameters from a .yaml file in the ublox_gps/config folder, sample configuration files are included. The required arguments are node_name and param_file_name. The two topics to which you should subscribe are ~fix and ~fix_velocity. The angular component of fix_velocity is unused.

Version history

Adding new features

Adding new messages

  1. Create the .msg file and add it to ublox_msgs/msg. Make sure the file includes the constants CLASS_ID and MESSAGE_ID.

  2. Modify ublox_msgs/include/ublox_msgs/ublox_msgs.h. a. Include the message header. b. Make sure the message's class constant is declared in the ublox_msgs::Class namespace. c. Declare the message's ID constant in the ublox_messages::Message::<CLASS_NAME> namespace.

  3. Declare the message in ublox_msgs/src/ublox_msgs.cpp.

  4. If the message has a repeated or optional block of varying size, create an additional message for the repeating block and include it in the message. a. Include the block message in the ublox_msgs/include/ublox_msgs/ublox_msgs.h file. b. Modify ublox_msgs/include/ublox/serialization/ublox_msgs.h and add a custom Serializer. If the message doesn't include the number of repeating/optional blocks as a parameter, you can infer it from the count/size of the message, which is the length of the payload.

  5. Modify ublox_gps/src/node.cpp (and the header file if necessary) to either subscribe to the message or send the configuration message. Be sure to modify the appropriate subscribe function. For messages which apply to all firmware/hardware, modify UbloxNode::subscribe(). Otherwise modify the appropriate firmware or hardware's subscribe function, e.g. UbloxFirmware8::subscribe(), HpgRovProduct::subscribe(). If the message is a configuration message, consider modifying ublox_gps/src/gps.cpp (and the header file) to add a configuration function.

One message protocol for multiple IDs (e.g. INF message)

If a given message protocol applies to multiple message IDs (e.g. the Inf message), do not include the message ID in the message itself. When declaring the message, for the first declaration, use DECLARE_UBLOX_MESSAGE macro. For the following declarations use the DECLARE_UBLOX_MESSAGE_ID macro.

Adding device / firmware specific functionality

The node.cpp file in ublox_gps contains a main Node class called UbloxNode which acts as the ROS Node and handles the node initialization, publishers, and diagnostics. UbloxNode contains a vector components_ of instances of ComponentInterface. The UbloxNode::initialize() calls each component's public interface methods. The node contains components for both the firmware version and the product category, which are added after parsing the MonVER message. Any class which implements ComponentInterface can be added to the UbloxNode components_ vector and its methods will be called by UbloxNode. Simply add an implementation of ComponentInterface to the ublox_gps node.h and node.cpp files. Behavior specific to a given firmware or product should not be implemented in the UbloxNode class and instead should be implemented in an implementation of ComponentInterface.

Currently there are implementations of ComponentInterface for firmware versions 6-8 and product categories HpgRefProduct, HpgRovProduct, AdrUdrProduct, TimProduct, FtsProduct. SPG products do not have their own implementation of ComponentInterface, since the Firmware classes implement all of the behavior of SPG devices.

HpgRefProduct and HpgRovProduct have been tested on the C94-M8P device.

Adding new parameters

  1. Modify the getRosParams() method in the appropriate implementation of ComponentInterface (e.g. UbloxNode, UbloxFirmware8, HpgRefProduct, etc.) and get the parameter. Group multiple related parameters into a namespace. Use all lower case names for parameters and namespaces separated with underscores.
    • If the type is an unsigned integer (of any size) or vector of unsigned integers, use the ublox_node::getRosUint method which will verify the bounds of the parameter.
    • If the type is an int8 or int16 or vector of int8's or int16's, use the ublox_nod::getRosInt method which will verify the bounds of the parameter. (This method can also be used for int32's but ROS has methods to get int32 parameters as well).
  2. If the parameter is used during configuration also modify the ComponentInterface's configureUblox() method to send the appropriate configuration message. Do not send configuration messages in getRosParams().
  3. Modify this README file and add the parameter name and description in the appropriate section. State whether there is a default value or if the parameter is required.
  4. Modify one of the sample .yaml configuration files in ublox_gps/config to include the parameter or add a new sample .yaml for your device.

Known Issues

Unimplemented / Untested Devices

TimProduct and FtsProduct are currently unimplemented skeleton classes. AdrUdrProduct is implemented, with the exception of initializeRosDiagnostics() and has not been tested on hardware.

UbloxFirmware7 has not been properly tested on a device with firmware version 7. UbloxFirmware6 has been tested on a device with firmware version 8, but not with firmware version 6.

Debugging

For debugging messages set the debug parameter to > 0. The range for debug is 0-4. At level 1 it prints configuration messages and checksum errors, at level 2 it also prints ACK/NACK messages and sent messages. At level 3 it prints the received bytes being decoded by a specific message reader. At level 4 it prints the incoming buffer before it is split by message header.

Troubleshooting

  1. Why can't the ublox_gps node open my device, even though I have correctly specified the path in /dev?
    • Make sure you are the owner of the device, or a member of dialout group.

Links

Consult the official protocol spec for details on packets supported by u-blox devices.