pal_hardware_gazebo.h
Go to the documentation of this file.
00001 #ifndef PAL_HARDWARE_GAZEBO_H
00002 #define PAL_HARDWARE_GAZEBO_H
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include <Eigen/Core>
00008 #include <Eigen/Geometry>
00009 
00010 #include <control_toolbox/pid.h>
00011 
00012 #include <hardware_interface/robot_hw.h>
00013 #include <hardware_interface/joint_state_interface.h>
00014 #include <hardware_interface/joint_command_interface.h>
00015 #include <hardware_interface/force_torque_sensor_interface.h>
00016 #include <hardware_interface/imu_sensor_interface.h>
00017 #include <joint_limits_interface/joint_limits_interface.h>
00018 #include <gazebo_ros_control/robot_hw_sim.h>
00019 
00020 #include <gazebo/physics/physics.hh>
00021 #include <gazebo/sensors/ImuSensor.hh>
00022 
00023 #include <gazebo_ros_control/default_robot_hw_sim.h>
00024 
00025 typedef Eigen::Isometry3d eMatrixHom;
00026 
00027 namespace gazebo_ros_control
00028 {
00029 
00030   class ForceTorqueSensorDefinition{
00031   public:
00032       gazebo::physics::JointPtr gazebo_joint;
00033       std::string sensorName;
00034       std::string sensorJointName;
00035       std::string sensorFrame;
00036       double force[3];
00037       double torque[3];
00038       eMatrixHom sensorTransform;
00039 
00040       ForceTorqueSensorDefinition(const std::string &name,
00041                                   const std::string &sensor_joint_name,
00042                                   const std::string &frame){
00043           sensorName = name;
00044           sensorJointName = sensor_joint_name;
00045           sensorFrame = frame;
00046           for(size_t i=0; i<3; ++i){
00047             force[i] = 0.;
00048             torque[i] = 0.;
00049           }
00050       }
00051   };
00052   typedef boost::shared_ptr<ForceTorqueSensorDefinition> ForceTorqueSensorDefinitionPtr;
00053 
00054   class ImuSensorDefinition{
00055   public:
00056       boost::shared_ptr<gazebo::sensors::ImuSensor> gazebo_imu_sensor;
00057       std::string sensorName;
00058       std::string sensorFrame;
00059 
00060       double orientation[4];
00061       double linear_acceleration[3];
00062       double base_ang_vel[3];
00063 
00064       ImuSensorDefinition(const std::string &name, const std::string &frame){
00065           sensorName = name;
00066           sensorFrame = frame;
00067           for(size_t i=0; i<4; ++i){
00068             orientation[i] = 0.;
00069           }
00070 
00071           for(size_t i=0; i<3; ++i){
00072             linear_acceleration[i] = 0.;
00073             base_ang_vel[i] = 0.;
00074           }
00075       }
00076   };
00077 
00078   typedef boost::shared_ptr<ImuSensorDefinition> ImuSensorDefinitionPtr;
00079 
00080 class PalHardwareGazebo : public DefaultRobotHWSim
00081 {
00082 public:
00083 
00084   PalHardwareGazebo();
00085 
00086   // Simulation-specific
00087   bool initSim(const std::string& robot_ns,
00088                ros::NodeHandle nh,
00089                gazebo::physics::ModelPtr model,
00090                const urdf::Model* const urdf_model,
00091                std::vector<transmission_interface::TransmissionInfo> transmissions);
00092   void readSim(ros::Time time, ros::Duration period);
00093   void writeSim(ros::Time time, ros::Duration period);
00094 
00095 private:
00096 
00097   bool parseForceTorqueSensors(ros::NodeHandle &nh,
00098                                gazebo::physics::ModelPtr model,
00099                                const urdf::Model* const urdf_model);
00100 
00101   bool parseIMUSensors(ros::NodeHandle &nh,
00102                        gazebo::physics::ModelPtr model,
00103                        const urdf::Model* const urdf_model);
00104 
00105   // Simulation-specific
00106   //std::vector<gazebo::physics::JointPtr> sim_joints_;
00107   //gazebo::physics::JointPtr right_ankle_;
00108   //boost::shared_ptr<gazebo::sensors::ImuSensor> imu_sensor_;
00109 
00110   // Hardware interface: sensors
00111   hardware_interface::ForceTorqueSensorInterface ft_sensor_interface_;
00112   hardware_interface::ImuSensorInterface         imu_sensor_interface_;
00113 
00114   std::vector<ForceTorqueSensorDefinitionPtr> forceTorqueSensorDefinitions_;
00115   std::vector<ImuSensorDefinitionPtr> imuSensorDefinitions_;
00116 
00117 };
00118 
00119 }
00120 
00121 #endif // PAL_HARDWARE_GAZEBO_H


pal_hardware_gazebo
Author(s):
autogenerated on Thu Sep 22 2016 03:29:23