reconfigure.h
Go to the documentation of this file.
00001 
00034 #ifndef MULTISENSE_ROS_RECONFIGURE_H
00035 #define MULTISENSE_ROS_RECONFIGURE_H
00036 
00037 #include <boost/shared_ptr.hpp>
00038 #include <boost/thread.hpp>
00039 #include <ros/ros.h>
00040 
00041 #include <multisense_lib/MultiSenseChannel.hh>
00042 
00043 #include <dynamic_reconfigure/server.h>
00044 #include <multisense_ros/sl_bm_cmv2000Config.h>
00045 #include <multisense_ros/sl_bm_cmv2000_imuConfig.h>
00046 #include <multisense_ros/sl_bm_cmv4000Config.h>
00047 #include <multisense_ros/sl_bm_cmv4000_imuConfig.h>
00048 #include <multisense_ros/sl_sgm_cmv2000_imuConfig.h>
00049 #include <multisense_ros/sl_sgm_cmv4000_imuConfig.h>
00050 #include <multisense_ros/bcam_imx104Config.h>
00051 #include <multisense_ros/st21_sgm_vga_imuConfig.h>
00052 #include <multisense_ros/mono_cmv2000Config.h>
00053 #include <multisense_ros/mono_cmv4000Config.h>
00054 
00055 namespace multisense_ros {
00056 
00057 class Reconfigure {
00058 public:
00059 
00060     Reconfigure(crl::multisense::Channel* driver,
00061                 boost::function<void ()> resolutionChangeCallback=0,
00062                 boost::function<void (int, int)> borderClipChangeCallback=0);
00063 
00064     ~Reconfigure();
00065 
00066     void imuCallback(const crl::multisense::imu::Header& header);
00067 
00068 private:
00069 
00070     //
00071     // Dynamic reconfigure callback variations
00072 
00073     void callback_sl_bm_cmv2000     (multisense_ros::sl_bm_cmv2000Config&      config, uint32_t level);
00074     void callback_sl_bm_cmv2000_imu (multisense_ros::sl_bm_cmv2000_imuConfig&  config, uint32_t level);
00075     void callback_sl_bm_cmv4000     (multisense_ros::sl_bm_cmv4000Config&      config, uint32_t level);
00076     void callback_sl_bm_cmv4000_imu (multisense_ros::sl_bm_cmv4000_imuConfig&  config, uint32_t level);
00077     void callback_sl_sgm_cmv2000_imu(multisense_ros::sl_sgm_cmv2000_imuConfig& config, uint32_t level);
00078     void callback_sl_sgm_cmv4000_imu(multisense_ros::sl_sgm_cmv4000_imuConfig& config, uint32_t level);
00079     void callback_bcam_imx104       (multisense_ros::bcam_imx104Config&        config, uint32_t level);
00080     void callback_st21_vga          (multisense_ros::st21_sgm_vga_imuConfig&   config, uint32_t level);
00081     void callback_mono_cmv2000      (multisense_ros::mono_cmv2000Config&       config, uint32_t level);
00082     void callback_mono_cmv4000      (multisense_ros::mono_cmv4000Config&       config, uint32_t level);
00083 
00084     //
00085     // Internal helper functions
00086 
00087     bool changeResolution(crl::multisense::image::Config& cfg,
00088                           int32_t width, int32_t height, int32_t disparities);
00089     template<class T> void configureSgm(crl::multisense::image::Config& cfg, const T& dyn);
00090     template<class T> void configureCamera(crl::multisense::image::Config& cfg, const T& dyn);
00091     template<class T> void configureImu(const T& dyn);
00092     template<class T> void configureBorderClip(const T& dyn);
00093 
00094     //
00095     // CRL sensor API
00096 
00097     crl::multisense::Channel* driver_;
00098 
00099     //
00100     // Resolution change callback
00101 
00102     boost::function<void ()> resolution_change_callback_;
00103 
00104     //
00105     // Driver nodes
00106 
00107     ros::NodeHandle device_nh_;
00108 
00109     //
00110     // Cached modes from the sensor
00111 
00112     std::vector<crl::multisense::system::DeviceMode> device_modes_;
00113     uint32_t                                         imu_samples_per_message_;
00114     std::vector<crl::multisense::imu::Config>        imu_configs_;
00115 
00116     //
00117     // Dynamic reconfigure server variations
00118 
00119     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000Config> >      server_sl_bm_cmv2000_;
00120     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv2000_imuConfig> >  server_sl_bm_cmv2000_imu_;
00121     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000Config> >      server_sl_bm_cmv4000_;
00122     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_bm_cmv4000_imuConfig> >  server_sl_bm_cmv4000_imu_;
00123     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv2000_imuConfig> > server_sl_sgm_cmv2000_imu_;
00124     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::sl_sgm_cmv4000_imuConfig> > server_sl_sgm_cmv4000_imu_;
00125     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::bcam_imx104Config> >        server_bcam_imx104_;
00126     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::st21_sgm_vga_imuConfig> >   server_st21_vga_;
00127     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::mono_cmv2000Config> >       server_mono_cmv2000_;
00128     boost::shared_ptr< dynamic_reconfigure::Server<multisense_ros::mono_cmv4000Config> >       server_mono_cmv4000_;
00129 
00130     //
00131     // Cached values for supported sub-systems (these may be unavailable on
00132     // certain hardware variations: S7, S7S, M, etc.)
00133 
00134     bool lighting_supported_;
00135     bool motor_supported_;
00136 
00137     //
00138     // Cached value for the boarder clip. These are used to determine if we
00139     // should regenerate our border clipping mask
00140 
00141     enum clip_ {RECTANGULAR, CIRCULAR};
00142 
00143     int border_clip_type_;
00144     double border_clip_value_;
00145 
00146     //
00147     // Border clip change callback
00148 
00149     boost::function<void (int, int)> border_clip_change_callback_;
00150 };
00151 
00152 } // multisense_ros
00153 
00154 #endif


multisense_ros
Author(s):
autogenerated on Thu Aug 27 2015 14:01:22