I've recently acquired a PNI Fieldforce TCM-XB and would like to interface it with ROS. It communicates over serial using a binary protocol described in their datasheet. The protocol appears to be proprietary, but I am not familiar enough with the protocols used by other manufacturers to know for sure.
Basic searches in the ROS package database haven't turned up any existing packages. Before I take the time to write one, has anyone else written a ROS node for communicating with this compass?
Update: It's not completely polished, but here is the fieldforce_tcm node that I wrote. It is written in Python and publishes a nav_msgs/Imu message with the orientation field populated.
I'm not aware of any PNI drivers. We would have had one for you, but I wrote that one for our custom FPGA solution. ;) No getting that one out.
It shouldn't be too difficult to write using pyserial or boost::asio. If you remember to make it generic for all their compasses, and reconfigurable (maybe even with dynamic reconfigure), you would make it very valuable to the community.
PS: my suggestion on an output message would be a geometry_msgs/QuaternionStamped. Our compass also output pitch and roll, although not filtered, so this message type could output all of those values at once.
With the new and latest version I have timeout problems with my PNI Prime. I also has a 0.5s timeout for almost all commands, but it seems to be actually more. This is the exception raised:
File "pni_prime_imu.py", line 331, in <module>
main()
File "pni_prime_imu.py", line 327, in main
raise e
pni_dev.TimeoutException: Did not recv frame_id (5,) within time limit.
Plesase, note that I've only changed the name of the driver to pni_dev, and create my own wrapper on top of it. Everything is the same. I increase the timeout to 1s in a >24h experiment, but at some point it wasn't enough.
Do you have any idea that could explain this behaviour?
Thanks in advance, Enrique
Hi, I'm not seeing a correspondence between the line numbers you've posted here and the ones in fieldforce_tcm/src/fieldforce_tcm.py (@ commit b3c270b ).Is pni_prime_imu.py a different file currently in the fieldforce_tcm package? Are there any edits to it? Is there any more to this exception?
Cody ( 2012-05-02 19:57:16 -0500 )editWell, this pni_prime_imu.py file is mine, just a wrapper over the driver fieldforce_tcm.py. Let's say it's an equivalent to compass.py. However, the problem is simply the fact that the timeout expires before something arrives. I set it to 1s, instead of 0.5s. This happens in recv.
Enrique ( 2012-05-03 03:19:37 -0500 )editI also have to say, that in this particular case of a >24h experiment, I run out of batteries, so that was the reason because the sensor didn't reply any longer. Anyway, please note the fact that I increased the timeout from 0.5s to 1s. That's what I don't understand. Do you have similar problems?
Enrique ( 2012-05-03 03:23:52 -0500 )editI can't do anything about the battery life :) . I have however written some code in the ros node that attempts to restart the compass if a timeout in data occurs (and increased the timeout). It'll be pushed to the main repo as soon as we test it (for now, it is in github.com/jmesmon/fieldforce_tcm).
Cody ( 2012-05-03 22:20:40 -0500 )editanswered 2011-09-26 15:18:20 -0500
This post is a wiki. Anyone with karma >75 is welcome to improve it.
Hello, I have the exact same compass and was wondering if you ever got those drivers done? Are you will to share them?
Thank you.
I also have this exact same compass. Has anyone made progress towards a solid driver for this device?
Thank you, Tim
Hi,
I can say it also works for the PNI Prime model.
For the source I downloaded (a few days ago), you might detect some problems with the (let's say) "k" and no "k" var names if you ask the device for more "components", e.g. accelerometer and magnetometer readings. It's straightforward to correct though, and maybe it's already fix in the repo (but didn't check, don't know). Let me know if you want to know the details.
UPDATE #1:
Datum = namedtuple('Datum', [
'Heading', 'Temperature', 'Distortion', 'CalStatus',
'PAligned', 'RAligned', 'IZAligned',
'PAngle', 'RAngle', 'XAligned', 'YAligned', 'ZAligned'
])
instead of
Datum = namedtuple('Datum', [
'Heading', 'Temperature', 'Distortion', 'CalStatus',
'PAligned', 'RAligned', 'IZAligned',
'PAngle', 'RAngle', 'KXAligned', 'KYAligned', 'KZAligned'
])
Only the 'K' has to be remove, for the last three items.
UPDATE #2:
I've detected some problem using your driver with my PNI Prime. When I stop the driver the sensor is left in a state such that when I re-start the driver again it fails. Then, I re-start again and it works. See below the call stack output (summarized):
compass.setConfig(Configuration.kMountingRef, Orientation.kOrientationSTD0)
File "pni_dev.py", line 311, in setConfig
self._recvSpecificMessage(FrameID.kSetConfigDone)
File "pni_dev.py", line 260, in _recvSpecificMessage
raise IOError('Response has unexpected frame id: {0}.'.format(frame_id))
IOError: Response has unexpected frame id: 5.
Have you found this problem too? I've also tried to put a powerDown at the end. It only happens that the error changes. And, at the very beginning, I've also put powerUp and stopStreaming, to ensure config mode ---I guess. But still the same.
Thanks for this great contribution, mkoval! EnriquepowerDown
@mkoval: To make it work with my PNI Prime I had to increase the timeout (pni_dev.py:421) to 1s, instead of 0.5s (the manual says 0.5s, but it seems to be not enough); I'm using an USB-serial adapter, btw. Also, when closing (Ctrl+C), the node it's not correctly "kill": it scales to SIGKILL!
Enrique ( 2012-04-30 05:00:25 -0500 )editAsked: 2011-07-09 15:43:11 -0500
Seen: 290 times
Last updated: May 02 '12
Documentation on writing hardware drivers
EPICS: Opensource publish-subscribe 4 PLC, data-acq, and motion control [closed]
Build a controller from scratch
Is there a PS3 controller driver for Diamondback?
Hardware communication fails after ros::init
SICK laser driver fails to start after initialization and handshake?
Is there a ROS wrapper for Pololu SMC-04B servomotor?
ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.