17 #include <gazebo/common/common.hh>    18 #include <ignition/math.hh>    19 #include <osrf_gear/SubmitTray.h>    44   if (_sdf->HasElement(
"index"))
    46     index = _sdf->Get<std::string>(
"index");
    50     gzerr << 
"AGV is missing an index. The AGV will not work.\n";
    55   if (_sdf->HasElement(
"robotNamespace"))
    58         "robotNamespace")->Get<std::string>() + 
"/";
    65         << 
"unable to load plugin. Load the Gazebo system plugin "    66         << 
"'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
    70   this->
agvName = std::string(
"agv") + index;
    72   std::string agvControlTopic = 
"/ariac/" + this->
agvName;
    75   std::string submitTrayTopic = 
"submit_tray";
    76   if (_sdf->HasElement(
"submit_tray_service_name"))
    77     submitTrayTopic = _sdf->Get<std::string>(
"submit_tray_service_name");
    82   this->
anim.reset(
new gazebo::common::PoseAnimation(this->
agvName, 22, 
false));
    84   gazebo::common::PoseKeyFrame *key = 
anim->CreateKeyFrame(0);
    85   key->Translation(ignition::math::Vector3d(0.3, 3.3, 0));
    86   key->Rotation(ignition::math::Quaterniond(0, 0, 3.1415));
    88   key = 
anim->CreateKeyFrame(4);
    89   key->Translation(ignition::math::Vector3d(-4.2, 3.8, 0));
    90   key->Rotation(ignition::math::Quaterniond(0, 0, 3.1415));
    92   key = 
anim->CreateKeyFrame(10);
    93   key->Translation(ignition::math::Vector3d(-4.2, 9.45, 0));
    94   key->Rotation(ignition::math::Quaterniond(0, 0, 3.1415));
    96   key = 
anim->CreateKeyFrame(16);
    97   key->Translation(ignition::math::Vector3d(-4.2, 3.8, 0));
    98   key->Rotation(ignition::math::Quaterniond(0, 0, 3.1415));
   100   key = 
anim->CreateKeyFrame(22);
   101   key->Translation(ignition::math::Vector3d(0.3, 3.3, 0));
   102   key->Rotation(ignition::math::Quaterniond(0, 0, 3.1415));
   104   this->
model = _parent;
   116   osrf_gear::AGVControl::Request &_req,
   117   osrf_gear::AGVControl::Response &_res)
   119   bool triggerAnim = this->
agvName == 
"agv1" &&
   120     (
anim->GetTime() <= 0.0 || 
anim->GetTime() >= 
anim->GetLength());
   134   osrf_gear::SubmitTray srv;
   135   srv.request.tray_id.data = this->
agvName + 
"::kit_tray::tray";
   136   srv.request.kit_type.data = _req.kit_type.data;
   138   if (!srv.response.success) {
   140     _res.success = 
false;
   143   ROS_INFO_STREAM(
"Result of inspection: " << srv.response.inspection_result);
 ros::ServiceServer rosService
Receives service calls for controlling the AGV. 
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load the plugin. 
gazebo::common::PoseAnimationPtr anim
Robot animation. 
bool OnCommand(osrf_gear::AGVControl::Request &_req, osrf_gear::AGVControl::Response &_res)
Receives requests on the conveyor belt's topic. 
ROSCPP_DECL bool isInitialized()
bool call(MReq &req, MRes &res)
ROS implementation of the ConveyorBeltPlugin plugin. 
virtual ~ROSAGVPlugin()
Destructor. 
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ros::ServiceClient rosSubmitTrayClient
Client for submitting trays for inspection. 
std::string agvName
Name of the AGV. 
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
#define ROS_FATAL_STREAM(args)
ROSAGVPlugin()
Constructor. 
ros::NodeHandle * rosnode
ros node handle 
gazebo::physics::ModelPtr model
Pointer to the model. 
#define ROS_DEBUG_STREAM(args)
std::string robotNamespace
for setting ROS name space 
#define ROS_INFO_STREAM(args)
GZ_REGISTER_MODEL_PLUGIN(GazeboRosP3D)
#define ROS_ERROR_STREAM(args)