Comments (7)
In case you were not aware, this is related: https://github.com/ros-perception/pcl_conversions
from geometry.
actually when I was saying "use some template magic" I was referring to
those toPCL and fromPCL functions.
but pcl_conversions does not provide a solution.
In my case, I'm working with pcl::PointCloud. I have a filter that
derives from message_filters::SimpleFilter<
pcl::PointCloudpcl::PointXYZ >. I want to connect it to a tf filter,
and it does not work because of header incompatibilities.
After taking a closer look at pcl_conversions, I can see that by using
moveFromPCL and moveToPCL it might be possible to redesign my code so
that it works more with ros::PointCloud2 messages.
However, I think it would be a nice addition to tf::MessageFilter to
support PCL headers or more generic data with a custom header extractor
hook.
If you don't think so, please go ahead and just close the issue...
On 02/06/2014 02:32 PM, William Woodall wrote:
In case you were not aware, this is related:
https://github.com/ros-perception/pcl_conversions—
Reply to this email directly or view it on GitHub
#55 (comment).
from geometry.
No I think that would be fine to have direct support, though I'm not sure how it would look exactly, but I was just linking to pcl_conversions
as a reference not to imply it had a solution already.
from geometry.
I was thinking about something along the line of the toMsg and fromMsg functions in the geodesy package:
https://github.com/ros-geographic-info/geographic_info/blob/master/geodesy/include/geodesy/wgs84.h
I will try to come up with an implementation, at least for the PCL header case.
from geometry.
Adding the following lines in pcl_conversions.h
could be a solution
template<>
struct FrameId<pcl::PCLPointCloud2>
{
static std::string* pointer(pcl::PCLPointCloud2& m) { return &m.header.frame_id; }
static std::string const* pointer(const pcl::PCLPointCloud2& m) { return &m.header.frame_id; }
static std::string value(const pcl::PCLPointCloud2& m) { return m.header.frame_id; }
};
template<>
struct TimeStamp<pcl::PCLPointCloud2>
{
static ros::Time* pointer(typename boost::remove_const<pcl::PCLPointCloud2>::type &m) { return 0; }
static ros::Time const* pointer(const pcl::PCLPointCloud2& m) { return 0; }
static ros::Time value(const pcl::PCLPointCloud2& m) { return pcl_conversions::fromPCL(m.header).stamp; }
};
However, TimeStamp
pointer functions would return NULL
. Currently (i.e. without those lines), the default template returns NULL for the stamp and frame pointers. So it cannot make it worst I think. But it's a bit in-coherent: value() returns a sensible value, but not the pointer functions, even though one might expect that they would return the same thing.
Any thought?
from geometry.
turns out this does not help with pcl::PointCloud
in pcl_ros/point_cloud.h
someone (@wjwwood ?) specialized ros::message_traits::TimeStamp
for the pcl::PointCloud<pcl::PointXYZ>
type, with the following comment:
// This is bad because it will only work for pcl::PointXYZ, but I can't
// find another way around ambiguous partial template specialization...
This is because if we try to do a partial specialization like this:
template<typename T>
struct TimeStamp<pcl::PointCloud<T> >
Then it's ambiguous with the default template declaration in message_traits.h
:
template<typename M>
struct TimeStamp<M, typename boost::enable_if<HasHeader<M> >::type >
{
static ros::Time* pointer(typename boost::remove_const<M>::type &m) { return &m.header.stamp; }
static ros::Time const* pointer(const M& m) { return &m.header.stamp; }
static ros::Time value(const M& m) { return m.header.stamp; }
};
In which M=pcl::PointCloud<T>
and HasHeader<M>
evaluates to true. I tried to specialize like this:
template<typename T>
struct TimeStamp<pcl::PointCloud<T>, TrueType>
without success.
I think the underlying problem here is that HasHeader<pcl::PointCloud<T>>
should return false. FrameId
and TimeStamp
types should then be specialized for pcl::PointCloud<T>
. But I'm not quite sure of the implications of that, in particular for serialization.
from geometry.
I seem to have found a solution:
HasHeader
returns false forpcl::PointCloud<T>
FrameId
andTimeStamp
specialized forpcl::PointCloud<T>
message_filter
modified to useFrameId
andTimeStamp
everywhere instead of accessing the message header directly
These require to modify both the geometry
repo and the perception_pcl
repo. I will create respective PRs.
However, I wonder if there will be hidden consequences to modifying HasHeader<pcl::PointCloud<T>>
?
from geometry.
Related Issues (20)
- Unable to use tf_conversions inside anaconda enviroment HOT 1
- The Euler Angles sequence in tf_echo HOT 1
- tf view_frames is broken HOT 22
- New release please? HOT 1
- tf test_transform_datatypes duplicate name error HOT 3
- cannot import tf_conversions in Python
- Geo
- Two functions:tf.transformations.quaternion from euler in TF and tf_conversions. transformations.quaternion from euler in TF2 can realize the same function,but the transformation results are different. HOT 1
- "Boost_INCLUDE_DIR-NOTFOUND" with Boost 1.72.0
- ros-noetic-tf installs /opt/ros/noetic/lib/python3/dist-packages/libgtest.so
- tf echo use wrong terminology for source and target frame HOT 2
- tf_conversions does not compile under noetic + bionic due python3-pykdl dependency HOT 5
- Using `tf::twistKDLToEigen` leads to compilation errors
- tf Python `waitForTransform` API documentation
- Numpy is used but it is not declared as a dependency
- Improvement about Euler angles order? HOT 1
- eigen > eigen2 > eigen3 ????? HOT 1
- Please release 1.13.3 HOT 3
- Using tf.transformations quaternion_from_euler with numpy array arguments can silently change the input arguments! HOT 1
- .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometry.