00001 /* 00002 COPYRIGHT (c) 2014 SEGWAY Inc. 00003 00004 Software License Agreement: 00005 00006 The software supplied herewith by Segway Inc. (the "Company") for its 00007 RMP Robotic Platforms is intended and supplied to you, the Company's 00008 customer, for use solely and exclusively with Segway products. The 00009 software is owned by the Company and/or its supplier, and is protected 00010 under applicable copyright laws. All rights are reserved. Any use in 00011 violation of the foregoing restrictions may subject the user to criminal 00012 sanctions under applicable laws, as well as to civil liability for the 00013 breach of the terms and conditions of this license. The Company may 00014 immediately terminate this Agreement upon your use of the software with 00015 any products that are not Segway products. 00016 00017 You shall indemnify, defend and hold the Company harmless from any claims, 00018 demands, liabilities or expenses, including reasonable attorneys fees, incurred 00019 by the Company as a result of any claim or proceeding against the Company 00020 arising out of or based upon: 00021 00022 (i) The combination, operation or use of the software by you with any hardware, 00023 products, programs or data not supplied or approved in writing by the Company, 00024 if such claim or proceeding would have been avoided but for such combination, 00025 operation or use. 00026 00027 (ii) The modification of the software by or on behalf of you. 00028 00029 (iii) Your use of the software. 00030 00031 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, 00032 WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED 00033 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00034 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, 00035 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 00036 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 00037 */ 00038 00039 #ifndef RMP_440LE_H 00040 #define RMP_440LE_H 00041 00042 #include <ros/ros.h> 00043 #include <geometry_msgs/TwistStamped.h> 00044 #include <sensor_msgs/JointState.h> 00045 #include <sensor_msgs/Imu.h> 00046 #include <nav_msgs/Odometry.h> 00047 #include <rmp_msgs/BoolStamped.h> 00048 #include <rmp_msgs/AudioCommand.h> 00049 #include <rmp_msgs/FaultStatus.h> 00050 00051 #include <Rmp440LEInterface.h> 00052 00056 struct WheelsDisplacement 00057 { 00061 WheelsDisplacement() 00062 : m_Linear(0.0) 00063 , m_LeftFront(0.0) 00064 , m_LeftRear(0.0) 00065 , m_RightFront(0.0) 00066 , m_RightRear(0.0) 00067 {} 00068 00072 double m_Linear; 00073 00077 double m_LeftFront; 00078 00082 double m_LeftRear; 00083 00087 double m_RightFront; 00088 00092 double m_RightRear; 00093 }; 00094 00098 class Rmp440LE 00099 { 00100 public: 00104 Rmp440LE(); 00105 00109 ~Rmp440LE(); 00110 00114 void Initialize(); 00115 00116 private: 00120 void InitializeMessages(); 00121 00131 void ProcessVelocityCommand(const geometry_msgs::TwistStamped::ConstPtr& rpVelocityCommand); 00132 00137 void ProcessDeadman(const rmp_msgs::BoolStamped::ConstPtr& rpDeadmanMsg); 00138 00144 void ProcessAudioCommand(const rmp_msgs::AudioCommand::ConstPtr& rpAudioCommand); 00145 00149 void UpdateStatus(); 00150 00155 void UpdateImu(); 00156 00160 void UpdateOdometry(); 00161 00165 void UpdateBattery(); 00166 00170 void UpdateMotorStatus(); 00171 00176 void UpdateFaultStatus(); 00177 00183 bool IsDeadmanValid(); 00184 00188 segway::Rmp440LEInterface m_Rmp440LEInterface; 00189 00193 ros::NodeHandle m_NodeHandle; 00194 00198 ros::Publisher m_OdometryPublisher; 00199 00203 ros::Publisher m_JointStatesPublisher; 00204 00208 ros::Publisher m_InertialPublisher; 00209 00213 ros::Publisher m_PsePublisher; 00214 00218 ros::Publisher m_MotorStatusPublisher; 00219 00223 ros::Publisher m_BatteryPublisher; 00224 00228 ros::Publisher m_FaultStatusPublisher; 00229 00233 ros::Subscriber m_VelocityCommandSubscriber; 00234 00238 ros::Subscriber m_DeadmanSubscriber; 00239 00243 ros::Subscriber m_AudioCommandSubscriber; 00244 00248 nav_msgs::Odometry m_OdometryMsg; 00249 00253 sensor_msgs::JointState m_JointStateMsg; 00254 00258 sensor_msgs::Imu m_InertialMsg; 00259 00263 sensor_msgs::Imu m_PseMsg; 00264 00268 rmp_msgs::BoolStamped m_DeadmanMsg; 00269 00273 WheelsDisplacement m_WheelsDisplacement; 00274 00278 bool m_OdometryInitialized; 00279 }; 00280 00281 #endif // RMP_440LE_H