Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef YOUBOTOODLWRAPPER_H_
00041 #define YOUBOTOODLWRAPPER_H_
00042
00043
00044 #define mkstr2(X) #X
00045 #define mkstr(X) mkstr2(X)
00046
00047
00048 #include <geometry_msgs/Twist.h>
00049 #include <tf/transform_broadcaster.h>
00050 #include <nav_msgs/Odometry.h>
00051 #include <std_srvs/Empty.h>
00052 #include <diagnostic_msgs/DiagnosticStatus.h>
00053 #include <diagnostic_msgs/DiagnosticArray.h>
00054 #include <youbot_oodl/PowerBoardState.h>
00055
00056 #include <trajectory_msgs/JointTrajectory.h>
00057 #include <sensor_msgs/JointState.h>
00058
00059 #include <brics_actuator/JointPositions.h>
00060 #include <brics_actuator/JointVelocities.h>
00061
00062
00063 #include <youbot_oodl/YouBotConfiguration.h>
00064 #include <youbot_driver/youbot/JointTrajectoryController.hpp>
00065 #include <youbot_driver/youbot/DataTrace.hpp>
00066
00067
00068
00069
00070
00071
00072 namespace youBot
00073 {
00074
00078 class YouBotOODLWrapper
00079 {
00080 public:
00081
00086 YouBotOODLWrapper(ros::NodeHandle n);
00087
00091 virtual ~YouBotOODLWrapper();
00092
00093
00094
00099 void initializeBase(std::string baseName);
00100
00106 void initializeArm(std::string armName, bool enableStandardGripper = true);
00107
00112 void stop();
00113
00114
00115
00120 void baseCommandCallback(const geometry_msgs::Twist& youbotBaseCommand);
00121
00130 void armCommandCallback(const trajectory_msgs::JointTrajectory& youbotArmCommand);
00131
00137 void armPositionsCommandCallback(const brics_actuator::JointPositionsConstPtr& youbotArmCommand, int armIndex);
00138
00144 void armVelocitiesCommandCallback(const brics_actuator::JointVelocitiesConstPtr& youbotArmCommand, int armIndex);
00145
00151 void armJointTrajectoryGoalCallback(
00152 actionlib::ActionServer<control_msgs::FollowJointTrajectoryAction>::GoalHandle youbotArmGoal,
00153 unsigned int armIndex);
00154
00160 void armJointTrajectoryCancelCallback(
00161 actionlib::ActionServer<control_msgs::FollowJointTrajectoryAction>::GoalHandle youbotArmGoal,
00162 unsigned int armIndex);
00163
00169 void gripperPositionsCommandCallback(const brics_actuator::JointPositionsConstPtr& youbotGripperCommand,
00170 int armIndex);
00171
00178 void publishOODLSensorReadings();
00179
00183 void publishArmAndBaseDiagnostics(double publish_rate_in_secs);
00184
00185
00186
00190 void computeOODLSensorReadings();
00191
00192 bool switchOffBaseMotorsCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
00193
00194 bool switchOnBaseMotorsCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
00195
00196 bool switchOffArmMotorsCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response, int armIndex);
00197
00198 bool switchOnArmMotorsCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response, int armIndex);
00199
00200 bool calibrateArmCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response, int armIndex);
00201
00202 bool reconnectCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
00203
00204
00205
00207 YouBotConfiguration youBotConfiguration;
00208
00209 private:
00210
00211 YouBotOODLWrapper();
00212
00214 static const int youBotArmDoF = 5;
00215
00217 static const int youBotNumberOfFingers = 2;
00218
00220 static const int youBotNumberOfWheels = 4;
00221
00222 std::string youBotChildFrameID;
00223 std::string youBotOdometryFrameID;
00224 std::string youBotOdometryChildFrameID;
00225 std::string youBotArmFrameID;
00226
00228 ros::NodeHandle node;
00229
00231 ros::Time currentTime;
00232
00234 nav_msgs::Odometry odometryMessage;
00235
00237 geometry_msgs::TransformStamped odometryTransform;
00238
00240 geometry_msgs::Quaternion odometryQuaternion;
00241
00243 sensor_msgs::JointState baseJointStateMessage;
00244
00246 vector<sensor_msgs::JointState> armJointStateMessages;
00247
00249 actionlib::ActionServer<control_msgs::FollowJointTrajectoryAction>::GoalHandle armActiveJointTrajectoryGoal;
00250
00252 bool armHasActiveJointTrajectoryGoal;
00253
00254 youbot::GripperSensedBarPosition gripperBar1Position;
00255 youbot::GripperSensedBarPosition gripperBar2Position;
00256 int gripperCycleCounter;
00257
00258
00259
00260
00261
00262
00263 double youBotDriverCycleFrequencyInHz;
00264
00266 ros::Time lastDiagnosticPublishTime;
00267
00268 ros::Publisher dashboardMessagePublisher;
00269 youbot_oodl::PowerBoardState platformStateMessage;
00270
00271 ros::Publisher diagnosticArrayPublisher;
00272 diagnostic_msgs::DiagnosticArray diagnosticArrayMessage;
00273 diagnostic_msgs::DiagnosticStatus diagnosticStatusMessage;
00274 std::string diagnosticNameArms;
00275 std::string diagnosticNameBase;
00276
00277 bool areBaseMotorsSwitchedOn;
00278 bool areArmMotorsSwitchedOn;
00279 };
00280
00281 }
00282
00283 #endif
00284
00285