gazebo_ros_kobuki.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2013, Yujin Robot.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of Yujin Robot nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00036 #ifndef GAZEBO_ROS_KOBUKI_H
00037 #define GAZEBO_ROS_KOBUKI_H
00038 
00039 #include <string>
00040 #include <boost/thread.hpp>
00041 #include <boost/shared_ptr.hpp>
00042 #include <gazebo.hh>
00043 #include <physics/physics.hh>
00044 #include <common/common.hh>
00045 #include <common/Time.hh>
00046 #include <sensors/sensors.hh>
00047 #include <ros/ros.h>
00048 #include <std_msgs/Float64.h>
00049 #include <nav_msgs/Odometry.h>
00050 #include <geometry_msgs/Twist.h>
00051 #include <geometry_msgs/TransformStamped.h>
00052 #include <tf/transform_broadcaster.h>
00053 #include <kobuki_msgs/MotorPower.h>
00054 #include <kobuki_msgs/CliffEvent.h>
00055 #include <kobuki_msgs/BumperEvent.h>
00056 
00057 namespace gazebo
00058 {
00059 
00060 class GazeboRosKobuki : public ModelPlugin
00061 {
00062 public:
00064   GazeboRosKobuki();
00066   ~GazeboRosKobuki();
00068   void Load(physics::ModelPtr parent, sdf::ElementPtr sdf);
00070   void OnUpdate();
00071 
00072 private:
00073   /*
00074    * Methods
00075    */
00077   void cmdVelCB(const geometry_msgs::TwistConstPtr &msg);
00079   void motorPowerCB(const kobuki_msgs::MotorPowerPtr &msg);
00081   void spin();
00082   //  void OnContact(const std::string &name, const physics::Contact &contact); necessary?
00083 
00084   /*
00085    *  Parameters
00086    */
00088   ros::NodeHandle nh_, nh_priv_;
00090   std::string node_name_;
00092 //  boost::shared_ptr<boost::thread> ros_spinner_thread_; necessary?
00094   bool shutdown_requested_;
00096   physics::ModelPtr model_;
00098   physics::WorldPtr world_;
00100   event::ConnectionPtr update_connection_;
00102   common::Time prev_update_time_;
00104   ros::Subscriber motor_power_sub_;
00106   bool motors_enabled_;
00108   physics::JointPtr joints_[2];
00110   std::string left_wheel_joint_name_;
00112   std::string right_wheel_joint_name_;
00114   ros::Publisher joint_state_pub_;
00116   sensor_msgs::JointState joint_state_;
00118   ros::Subscriber cmd_vel_sub_;
00120   common::Time last_cmd_vel_time_;
00122   float cmd_vel_timeout_;
00124   float wheel_speed_cmd_[2];
00126   float torque_;
00128   float wheel_sep_;
00130   float wheel_diam_;
00132   float odom_pose_[3];
00134   float odom_vel_[3];
00136   double *pose_cov_[36];
00138   ros::Publisher odom_pub_;
00140   nav_msgs::Odometry odom_;
00142   tf::TransformBroadcaster tf_broadcaster_;
00144   geometry_msgs::TransformStamped odom_tf_;
00146   sensors::RaySensorPtr cliff_sensor_left_;
00148   sensors::RaySensorPtr cliff_sensor_front_;
00150   sensors::RaySensorPtr cliff_sensor_right_;
00152   ros::Publisher cliff_event_pub_;
00154   kobuki_msgs::CliffEvent cliff_event_;
00156   kobuki_msgs::CliffEvent cliff_event_old_;
00158   float cliff_detection_threshold_;
00160   int max_floot_dist_;
00162   sensors::ContactSensorPtr bumper_;
00164   ros::Publisher bumper_event_pub_;
00166   kobuki_msgs::BumperEvent bumper_event_;
00168   kobuki_msgs::BumperEvent bumper_event_old_;
00169 };
00170 
00171 } // namespace gazebo
00172 
00173 #endif /* GAZEBO_ROS_KOBUKI_H */


kobuki_gazebo_plugins
Author(s): Marcus Liebhardt
autogenerated on Mon Oct 6 2014 01:31:55