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

Hdl32e time sync #53

Closed
wants to merge 7 commits into from
Closed

Conversation

richmattes
Copy link

This pull request builds on the work in pull request #36. I've changed some of the message types and attempted to more robustly reconstruct the timestamp of each scan from the NMEA string and the counter in each message.

I haven't gotten in to the lab to test it yet, but I wanted to push it in case someone else gets a chance to test it before I do.

ddillenberger and others added 4 commits June 29, 2015 21:06
This commit attempts to update the hdl32e GPS/IMU node started by
ddillenberger.  It updates the time offset calculations between the
velodyne's time-since-hour counter and the GPS NMEA string to provide
the correct reconstructed timestamp.

It also changes most of the message types.  The sensor scan time is now
published as a TimeReference message, so that it can be correlated with
the imu and temperature messages via the publish time.  It now publishes
the NMEA string as a nmea_msgs/Sentence message for easier processing by
the navsat drivers.  It also changes the imu publishing from the
geometry_msgs/TwistStamped message to sensor_msgs/Imu.
@jack-oquin
Copy link
Member

Is this proposed as a replacement for #36?

It looks better in several ways. Thanks for continuing this effort.

@richmattes
Copy link
Author

Yes it is. I started with the commits from #36, addressed some of the comments in the pull request, and tried to fix the timestamp issue.

This commit fixes the coordinate frames in the IMU data to be consistent
with the ROS forward-left-up coordinate frame convention.  The X
direction is straight opposite the HDL32e's cord, Y is to the left, and
Z is up.
@richmattes
Copy link
Author

It looks like the time sync part is working, the second rollover in the TimeReference packet looks like:

header: 
  seq: 2147
  stamp: 
    secs: 1437161000
    nsecs: 996016214
  frame_id: ''
time_ref: 
  secs: 1437161000
  nsecs: 995503902
source: Sensor On-Board Clock
---
header: 
  seq: 2148
  stamp: 
    secs: 1437161001
    nsecs: 4847381
  frame_id: ''
time_ref: 
  secs: 1437161001
  nsecs: 4365921
source: Sensor On-Board Clock

I need to double-check that an hour rollover works as well.

I also fixed the coordinate frame of the IMU to match http://wiki.ros.org/geometry/CoordinateFrameConventions. Now X is forward opposite the HDL32's cord, Y is to the left, and Z is up. The gyros should also be correct in terms of positive and negative rotation about each axis.

@jack-oquin
Copy link
Member

Looks good, but I thought the new "auto" specifier was only defined since C++11.

The ROS target platforms REP still specifies C++03 even for Jade, except when "checked for at configure time and equivalent functionality can be provided with the extra compiler features".

Remove in-line function definitions and the use of the "auto" keyword to
allow the driver to be built by compilers without c++11 support
@richmattes
Copy link
Author

I removed the auto specifiers, as well as the in-line function definitions within the handlePacket function. Things should be C++03 compatible now.

I still need to double-check the hour rollover. I have a bagfile recorded, but I need to find some time to analyze it.

<!-- <url type="website">http://wiki.ros.org/velodyne_gps_imu</url> -->
<author email="dillenberger@uni-koblenz.de">Denis Dillenberger</author> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>geometry_msgs</build_depend>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dependencies on nmea_msgs.

@jack-oquin
Copy link
Member

Your implementation looks clean to me, although I lack detailed knowledge of these sensors and their behavior.

We need to add a PCAP-based unit test, similar to the velodyne_driver ones. I can help with that, but we need a small PCAP file that can drive it. Maybe the existing http://download.ros.org/data/velodyne/32e.pcap will suffice.

I think it's essential to have an option to run from PCAP data, so we can reproduce any problems users report.

@jack-oquin
Copy link
Member

Please add a copyright notice to the C++ files. It can be something similar to what we already do.

Please use the modified BSD license, if allowable.

Added BSD copyright headers to the source files, and updated the build
and run dependencies in CMakeLists.txt and package.xml
@richmattes
Copy link
Author

I've added a copyright header consistent with the BSD license @ddillenberger specified in package.xml. I've also updated the build and run depends in CMakeLists and package.xml to reflect the new messages being used.

I'm not really sure how to address the desire for a pcap file. The 32e is publishing packets containing NMEA strings and accelerometer info in parallel to the pointcloud data, over a different port. The driver is currently set up to read directly from the UDP port and parse the driver information.

The 32e.pcap file you pointed to doesn't contain any of the accelerometer packets that this driver parses, it looks like it only contains scan packets.

@jack-oquin
Copy link
Member

Back from ROScon now. Sorry for the delay.

If you'll send me a small PCAP that contains the required packets, I'll see about getting it copied to the build farm site.

You'll also need to add an option for your driver to read data from a PCAP file, similar to the way velodyne_driver does it. I don't have time to do that for you right now, but I can point you to the relevant parts of the code if needed.

@jack-oquin
Copy link
Member

@jpgr87: The new VLP-16 model also provides position packets on port 8308.

  • Do you know if this package works with it, too?
  • What happens if the device provides empty position packets? (A VLP-16 with no GPS seems to do that.)

@jack-oquin jack-oquin added this to the indigo milestone Nov 11, 2015
@richmattes
Copy link
Author

Based on the user manuals, the structure of the position packets the VLP-16 emits is similar to the HDL-32e. The VLP-16 does not supply accelerometer, temperature, or gyro data, so this node will currently read whatever values are present at those positions in the packet (zeros according to the wireshark screenshot in the manual,) scale them and publish them to the Imu and Temperature topics.

The TimeReference and NMEA sentence topics should work normally when a GPS is connected, as the GPRMC sentence is in the same place in the packet.

When a GPS is not connected, the HDL-32e will generate its own GPRMC sentences starting at January 1, 2000, which the driver will parse and use to generate a bogus TimeReference. I don't know what the VLP-16 does when there is no GPS connected: if it publishes invalid or blank GPRMC messages then the driver will try to act on them anyway.

The node should do some error checking in the case where there's no GPRMC message at all (e.g. not publish the TimeReference and NMEA sentence at all.) I can add that pretty easily, but I don't have access to a device to test with anymore.

@jack-oquin
Copy link
Member

That sounds reasonable.

We still need to add PCAP support both for testing and for further development, without needing constant access to real devices.

I recently collected a small PCAP from a VLP-16 without a GPS. It does contain port 8308 position packets of some kind; I haven't looked at them very closely yet. They're probably just showing time since device power-on.

I think I'll merge this PR into a separate branch, where we can conveniently work together on finishing it.

The easiest way to add PCAP support is probably to export the InputSocket and InputPCAP classes from velodyne_driver and re-use them here. They will need some slight modifications to serve for both drivers. I plan to do that as part of the fix for #66. When that's merged, this new driver will be able to use it.

@jack-oquin
Copy link
Member

I just merged this PR into a new gps_imu branch.

@JWhitleyWork
Copy link
Contributor

@richmattes - Are you still interested in working on this? I know it's been some time but I've updated the branch to the latest master and it still seems like a reasonable addition.

@richmattes
Copy link
Author

Unfortunately I no longer have the time to support this, and even if I did I don't have access to any of the hardware anymore.

@JWhitleyWork
Copy link
Contributor

Thank you. I'll see if I can get someone internally to take a look at it.

@JWhitleyWork
Copy link
Contributor

Solved by #222.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants