INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

libs/orcapublish/odometry2dpublisher.h

00001 #ifndef ORCAPUBLISH_ODOMETRY2DPUBLISHER_H
00002 #define ORCAPUBLISH_ODOMRTRY2DPUBLISHER_H
00003 
00004 #include <hydropublish/odometry2dpublisher.h>
00005 #include <orcanavutil/orcanavutil.h>
00006 #include <orcaifaceimpl/odometry2d.h>
00007 
00008 namespace orcapublish {
00009 
00015 class Odometry2dPublisher : public hydropublish::Odometry2dPublisher
00016 {
00017 public:
00018 
00019     Odometry2dPublisher( const orca::VehicleDescription &vehicleDescr,
00020                          const orcaice::Context         &context,
00021                          const std::string              &interfaceString )
00022         : odometry2dImpl_(new orcaifaceimpl::Odometry2dImpl(vehicleDescr,context,interfaceString))
00023         {}
00024 
00025     void init()
00026         { odometry2dImpl_->initInterface(); }
00027 
00028     // From hydropublish::Odometry2dPublisher
00029     void localSetAndSend( const hydronavutil::Pose     &pose,
00030                           const hydronavutil::Velocity &velocity,
00031                           const hydrotime::Time        &time,
00032                           bool odometryWasReset=false )
00033         {
00034             orca::Odometry2dData orcaData;
00035 
00036             orcaData.timeStamp.seconds  = time.seconds();
00037             orcaData.timeStamp.useconds = time.useconds();
00038 
00039             orcaData.pose       = orcanavutil::convert( pose );
00040             orcaData.motion.v.x = velocity.lin();
00041             orcaData.motion.v.y = 0.0;
00042             orcaData.motion.w   = velocity.rot();
00043 
00044             orcaData.odometryWasReset = odometryWasReset;
00045 
00046             odometry2dImpl_->localSetAndSend( orcaData );
00047         }
00048 
00049 private:
00050 
00051     orcaifaceimpl::Odometry2dImplPtr odometry2dImpl_;
00052 
00053 };
00054 
00060 class Odometry2dPublisherFactory : public hydropublish::Odometry2dPublisherFactory
00061 {
00062 public:
00063 
00064     Odometry2dPublisherFactory( const orcaice::Context &context )
00065         : context_(context)
00066         {}
00067 
00068     hydropublish::Odometry2dPublisherPtr createPublisher( 
00069         const hydronavutil::DiffDriveControlDescription    &controlDescription,
00070         const hydronavutil::CylindricalGeometryDescription &cylindricalDescription,
00071         const std::string                                  &name )
00072         {
00073             return hydropublish::Odometry2dPublisherPtr(
00074                 new orcapublish::Odometry2dPublisher( orcanavutil::convert( controlDescription,
00075                                                                cylindricalDescription ),
00076                                          context_,
00077                                          name ) ); 
00078         }
00079 
00080 private:
00081 
00082     orcaice::Context context_;
00083 };
00084 
00085 }
00086 
00087 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5