accel.h
Go to the documentation of this file.
00001 /* -*- mode: C++ -*-
00002  *
00003  *  Copyright (C) 2011 Austin Robot Technology
00004  *  License: Modified BSD Software License Agreement
00005  * 
00006  *  $Id: accel.h 1539 2011-05-09 04:09:20Z jack.oquin $
00007  */
00008 
00017 #ifndef _ACCEL_H_
00018 #define _ACCEL_H_
00019 
00020 #include <ros/ros.h>
00021 #include <art_msgs/PilotState.h>
00022 #include <art_pilot/PilotConfig.h>
00023 #include "device_interface.h"
00024 
00025 namespace pilot
00026 {
00027 
00029 class AccelBase
00030 {
00031  public:
00032 
00038   AccelBase(art_pilot::PilotConfig &config) {};
00039 
00041   virtual ~AccelBase();
00042 
00044   typedef boost::shared_ptr<device_interface::ServoDeviceBase> ServoPtr;
00045 
00052   virtual void adjust(art_msgs::PilotState &pstate,
00053                       ServoPtr brake, ServoPtr throttle) = 0;
00054 
00060   virtual void reconfigure(art_pilot::PilotConfig &newconfig) = 0;
00061 
00063   virtual void reset(void) = 0;
00064 };
00065 
00067 typedef boost::shared_ptr<AccelBase> AccelBasePtr;
00068 
00075 AccelBasePtr allocAccel(art_pilot::PilotConfig &config);
00076 
00085 static inline float clamp(float lower, float value, float upper)
00086 {
00087   return std::max(lower, std::min(value, upper));
00088 }
00089 
00095 static inline float signum(float value)
00096 {
00097   return (value > 0.0? 1.0:
00098           (value == 0.0? 0.0:
00099            -1.0));
00100 }
00101   
00102 }; // namespace pilot
00103 
00104 #endif // _ACCEL_H_


art_pilot
Author(s): Austin Robot Technology, Jack O'Quin
autogenerated on Fri Jan 3 2014 11:09:32