fake_kobuki_ros.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 
00030 #ifndef _FAKE_KOBUKI_NODE_H_
00031 #define _FAKE_KOBUKI_NODE_H_
00032 
00033 #include <ros/ros.h>
00034 #include <geometry_msgs/Twist.h>
00035 #include <tf/transform_broadcaster.h>
00036 #include <sensor_msgs/Imu.h>
00037 #include <kobuki_msgs/ButtonEvent.h>
00038 #include <kobuki_msgs/BumperEvent.h>
00039 #include <kobuki_msgs/CliffEvent.h>
00040 #include <kobuki_msgs/DigitalOutput.h>
00041 #include <kobuki_msgs/DigitalInputEvent.h>
00042 #include <kobuki_msgs/ExternalPower.h>
00043 #include <kobuki_msgs/DockInfraRed.h>
00044 #include <kobuki_msgs/Led.h>
00045 #include <kobuki_msgs/MotorPower.h>
00046 #include <kobuki_msgs/PowerSystemEvent.h>
00047 #include <kobuki_msgs/RobotStateEvent.h>
00048 #include <kobuki_msgs/SensorState.h>
00049 #include <kobuki_msgs/Sound.h>
00050 #include <kobuki_msgs/VersionInfo.h>
00051 #include <kobuki_msgs/WheelDropEvent.h>
00052 
00053 #include "fake_kobuki.h"
00054 
00055 namespace kobuki
00056 {
00057   class FakeKobukiRos
00058   {
00059     public:
00060       FakeKobukiRos(std::string& node_name);
00061       ~FakeKobukiRos();
00062 
00063       bool init(ros::NodeHandle& nh);
00064       bool update();
00065 
00066     private:
00067       // private functions
00068       void advertiseTopics(ros::NodeHandle& nh);
00069       void subscribeTopics(ros::NodeHandle& nh);
00070       void publishVersionInfoOnce();
00071 
00072       // subscriber callbacks
00073       void subscribeVelocityCommand(const geometry_msgs::TwistConstPtr msg);
00074       void subscribeMotorPowerCommand(const kobuki_msgs::MotorPowerConstPtr msg);
00075 
00076       void updateJoint(unsigned int index,double& w,ros::Duration step_time);
00077       void updateOdometry(double w_left,double w_right, ros::Duration step_time);
00078       void updateTF(geometry_msgs::TransformStamped& odom_tf);
00079 
00081       // Variables 
00083       std::string name;
00084       ros::Time last_cmd_vel_time;
00085       ros::Time prev_update_time;
00086 
00087       // version_info, joint_states
00088       std::map<std::string,ros::Publisher> publisher;
00089       // button, bumper, cliff, wheel_drop, power_system, digital_input, robot_state
00090       std::map<std::string,ros::Publisher> event_publisher;
00091       // sensor_core, dock_ir, imu_data
00092       std::map<std::string,ros::Publisher> sensor_publisher;
00093       // no debug publisher
00094       tf::TransformBroadcaster        tf_broadcaster;
00095 
00096       // command subscribers
00097       std::map<std::string,ros::Subscriber> subscriber;
00098 
00099       FakeKobuki kobuki;
00100   };
00101 }
00102 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


kobuki_softnode
Author(s): Jihoon Lee
autogenerated on Tue Jul 9 2013 11:05:05