FmkRobotROSBridge.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00007 #ifndef FMKROBOTROSBRIDGE_H
00008 #define FMKROBOTROSBRIDGE_H
00009 
00010 // ROS
00011 #include "ros/ros.h"
00012 #include "ros/callback_queue.h"
00013 #include "std_srvs/Empty.h"
00014 #include "geometry_msgs/Twist.h"
00015 #include "nav_msgs/Odometry.h"
00016 #include "tf/transform_broadcaster.h"
00017 
00018 // rtm
00019 #include <rtm/idl/BasicDataTypeSkel.h>
00020 #include <rtm/Manager.h>
00021 #include <rtm/DataFlowComponentBase.h>
00022 #include <rtm/CorbaPort.h>
00023 #include <rtm/DataInPort.h>
00024 #include <rtm/DataOutPort.h>
00025 
00026 // Service implementation headers
00027 // <rtc-template block="service_impl_h">
00028 
00029 // </rtc-template>
00030 
00031 // Service Consumer stub headers
00032 // <rtc-template block="consumer_stub_h">
00033 #include "VehicleServiceStub.h"
00034 // </rtc-template>
00035 
00036 using namespace RTC;
00037 
00038 class FmkRobotROSBridge  : public RTC::DataFlowComponentBase
00039 {
00040  public:
00041   FmkRobotROSBridge(RTC::Manager* manager);
00042   ~FmkRobotROSBridge();
00043 
00044   // The initialize action (on CREATED->ALIVE transition)
00045   // formaer rtc_init_entry() 
00046  virtual RTC::ReturnCode_t onInitialize();
00047 
00048   // The finalize action (on ALIVE->END transition)
00049   // formaer rtc_exiting_entry()
00050   // virtual RTC::ReturnCode_t onFinalize();
00051 
00052   // The startup action when ExecutionContext startup
00053   // former rtc_starting_entry()
00054   // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
00055 
00056   // The shutdown action when ExecutionContext stop
00057   // former rtc_stopping_entry()
00058   // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
00059 
00060   // The activated action (Active state entry action)
00061   // former rtc_active_entry()
00062   // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
00063 
00064   // The deactivated action (Active state exit action)
00065   // former rtc_active_exit()
00066   // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
00067 
00068   // The execution action that is invoked periodically
00069   // former rtc_active_do()
00070   virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
00071 
00072   // The aborting action when main logic error occurred.
00073   // former rtc_aborting_entry()
00074   // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
00075 
00076   // The error action in ERROR state
00077   // former rtc_error_do()
00078   // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
00079 
00080   // The reset action that is invoked resetting
00081   // This is same but different the former rtc_init_entry()
00082   // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
00083   
00084   // The state update action that is invoked after onExecute() action
00085   // no corresponding operation exists in OpenRTm-aist-0.2.0
00086   // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
00087 
00088   // The action that is invoked when execution context's rate is changed
00089   // no corresponding operation exists in OpenRTm-aist-0.2.0
00090   // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
00091 
00092   void onVelocityCommand(const geometry_msgs::TwistConstPtr& msg);
00093   bool onHaltMotorService(std_srvs::Empty::Request  &req,
00094                           std_srvs::Empty::Response &res);
00095   bool onResetMotorService(std_srvs::Empty::Request  &req,
00096                            std_srvs::Empty::Response &res);
00097 
00098  protected:
00099   // Configuration variable declaration
00100   // <rtc-template block="config_declare">
00101   
00102   // </rtc-template>
00103 
00104   // DataInPort declaration
00105   // <rtc-template block="inport_declare">
00106 
00107   // </rtc-template>
00108 
00109   // DataOutPort declaration
00110   // <rtc-template block="outport_declare">
00111 
00112   // </rtc-template>
00113 
00114   // CORBA Port declaration
00115   // <rtc-template block="corbaport_declare">
00116   RTC::CorbaPort m_VehicleServicePort;
00117   // </rtc-template>
00118 
00119   // Service declaration
00120   // <rtc-template block="service_declare">
00121 
00122   // </rtc-template>
00123 
00124   // Consumer declaration
00125   // <rtc-template block="consumer_declare">
00126   RTC::CorbaConsumer<VehicleService> m_service0;
00127 
00128   // </rtc-template>
00129 
00130  private:
00131   ros::NodeHandle nh;
00132   ros::Subscriber velocity_sub;
00133   ros::Publisher  odometry_pub;
00134   ros::ServiceServer halt_srv, reset_srv;
00135   tf::TransformBroadcaster tf_pub;
00136   geometry_msgs::Twist velocity;
00137   double max_vx, max_vw, max_ax, max_aw;
00138   Position pos_prev;
00139   ros::Time tm_prev;
00140 
00141 };
00142 
00143 
00144 extern "C"
00145 {
00146   DLL_EXPORT void FmkRobotROSBridgeInit(RTC::Manager* manager);
00147 };
00148 
00149 #endif // FMKROBOTROSBRIDGE_H
00150 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


fmk_ros_bridge
Author(s): Manabu Saito, Haseru Azuma
autogenerated on Tue Jul 23 2013 11:50:16