snark
laser_return.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SNARK_SENSORS_VELODYNE_LASERRETURN_H_
20 #define SNARK_SENSORS_VELODYNE_LASERRETURN_H_
21 
22 #include <boost/date_time/posix_time/posix_time.hpp>
23 #include <comma/base/types.h>
24 #include <comma/visiting/traits.h>
25 
26 namespace snark { namespace velodyne {
27 
30 {
32  boost::posix_time::ptime timestamp;
33 
35  comma::uint32 id;
36 
38  unsigned char intensity;
39 
41  double range;
42 
44  double azimuth;
45 };
46 
47 } } // namespace snark { namespace velodyne {
48 
49 namespace comma { namespace visiting {
50 
51 template <> struct traits< snark::velodyne::laser_return >
52 {
53  template < typename Key, class Visitor >
54  static void visit( Key k, snark::velodyne::laser_return& t, Visitor& v )
55  {
56  v.apply( "t", t.timestamp );
57  v.apply( "id", t.id );
58  v.apply( "intensity", t.intensity );
59  v.apply( "range", t.range );
60  v.apply( "azimuth", t.azimuth );
61  }
62 
63  template < typename Key, class Visitor >
64  static void visit( Key k, const snark::velodyne::laser_return& t, Visitor& v )
65  {
66  v.apply( "t", t.timestamp );
67  v.apply( "id", t.id );
68  v.apply( "intensity", t.intensity );
69  v.apply( "range", t.range );
70  v.apply( "azimuth", t.azimuth );
71  }
72 };
73 
74 } } // namespace comma { namespace visiting {
75 
76 #endif /*SNARK_SENSORS_VELODYNE_LASERRETURN_H_*/