-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add Phidgets high-speed encoder ROS node #15
Conversation
* Publish one topic per encoder channel. * On-the-fly determination of number of encoder channels. * Two topic message types: * (a) Tick count + instantaneous speed. * (b) decimated, smooth velocity. * Publication at a programmable rate, independent of arrival of encoder ticks.
#include <stdio.h> | ||
#include <cstdlib> | ||
#include <sstream> | ||
#include <libphidgets/phidget21.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be updated to #include <libphidget21/phidget21.h>
in order to fix compilation on the ROS buildfarm CI. The Travis CI build failure is unrelated, I'm investigating that.
Hi @jlblancoc , thanks for taking up the work on this. I'll do a thorough review of this PR in the coming days. |
Sure, no rush! I was also thinking of investigating the travis error, let
me know if you find it first.
Also, we had dependency problems of the node wrt the phidget lib, will
investigate it....
|
@mintar dependencies are now fixed at the catkin/cmake levels after the last commit. Travis still fails, but I'm not really sure what's going on there... (!!) PS: ROS Wiki http://wiki.ros.org/phidgets_drivers is also updated (added new section no. 3) |
Travis also fails on all other branches, so it's not related to this pull request. It has to be a change in some upstream dependency (because it started failing for the same commits that it was succeeding at before), but I haven't been able to track it down or reproduce locally yet. Just ignore it for now. |
Just a minor update: above I said a new section was added to the wiki page. I later removed it for consistency with the other packages/nodes and moved the docs to an independent page. It's still not listed on the top of the main phidgets_drivers page, because changes obviously need to be merged first for the docs bot to catch them! I also just realized that the new package needs to be added to the metapackage. Will add a commit for it. Cheers. |
Thanks for the suggestion, but I prefer keeping it the way it is. One reason is that on Indigo, we still use the libphidgets from cob_extern. From Jade onwards, we moved that library to this repo. I don't want to release two different libphidgets libraries into Indigo. Once this PR is merged, I'll also sync it to the Jade and Lunar branches (because as you say, Jade/Kinetic/Lunar all work the same). It's a bit more work for me (manually keeping the branches in sync), but I have more flexibility if at a later point we have to introduce breaking changes into say lunar. |
So now on to the main point. Sorry it took me so long to review this PR. In my opinion there are two major changes that would make this PR much better:
1. Using JointStateThis point is more important than the other, since it defines the public API; the second point could still be changed behind the scenes later. In my opinion, it's best to use standard ROS messages in a case like this instead of defining one's own messages for the following reasons:
The following things would have to be changed:
2. Re-using phidgets_apiI've recently merged support for the high speed encoder in #3 , but it's still missing a ROS wrapper (i.e., exactly what this PR does). It would be nice if that code was reused, so that we avoid code duplication. The Thanks again for your contribution. I'm sorry that I'm proposing such major changes to the PR, but in my opinion the code would become much better. What do you think? |
Sure, your proposals make sense. Will give them a go...
|
Ok, as you prefer! One never knows... a bit more of manual work but as you say, you gain room for reacting to unexpected conflicts 👍 |
I've rewritten the node based on the Only remains to port to the new msg type... |
Thanks for all the work so far! Let me know when you've ported it to the JointState message, or when you need anything else from me. |
Still alive! ;-) |
All good, I'll wait until you come back. :) |
Done with the commit above. (was about time!) In the end, I followed your idea of publishing all channels together in one message of type JointState; however, decimated speeds are still published in separate topics, one per channel, since they are computed in an asynchronous way for each channel (i.e. as "edge events" arrive). Note that this code is tested to compile, but has not been tested in a real device. It should work since the changes are only in the part of publish data format; but we'll try to test it next Monday and will come back here with the feedback. Cheers. |
Thanks! I'll look into it in the coming days (I'm on vacation ATM). Just one quick thing I've noticed: The effort array is always all zeros, right? In that case it should be empty ( # This message consists of a multiple arrays, one for each part of the joint state.
# The goal is to make each of the fields optional. When e.g. your joints have no
# effort associated with them, you can leave the effort array empty.
#
# All arrays in this message should have the same size, or be empty.
# This is the only way to uniquely associate the joint name with the correct
# states. From your code it seems that the velocity array isn't always zeros, but just coincidentally in your screenshot, right? |
Wow, that was quick! :) |
Great! I missed that part on
On velocity: yes, they work, only that they are zero in the picture. |
Add Phidgets high-speed encoder ROS node.
I've rebased this onto kinetic, updated the README, applied some code formatting filters and merged via 7394959. I'm releasing it right now into kinetic and lunar. Many thanks @jlblancoc and @geoffviola for your contribution! 🎉 🎉 🎉 |
👍 |
This PR is based on previous code by Geoff Viola (@geoffviola), which has been extended to:
I would also suggest removing all branch names and working from now on on
master
(which will imply changing rosdistro as well, of course), since packages for all recent ROS distros can be built from exactly the same sources. This PR is against kinetic just because it's the default branch, but it should be shared with lunar, etc.