00691       if (gazebo::World::Instance()->GetEntityByName(model_name))
    00692       {
    00693         [ROS_ERROR](../../../api/rosconsole/html/macros__generated_8h.html#a7fb635b03cc608284eadecd2f8becd9a)("SpawnModel: Failure - model name %s already exist.",model_name.c_str());
    00694         res.[success](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelResponse__.html#a5ec6d9587b9a10ddc10ec198d41ccd62) = false;
    00695         res.[status_message](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelResponse__.html#acb4913011a74e88bdac7e11d173d8a7b) = "SpawnModel: Failure - model already exists.";
    00696         return false;
    00697       }
    00698 
    00699       // get name space for the corresponding model plugins
    00700       std::string robot_namespace = req.[robot_namespace](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#a3c578c1623a220e86e6ef67489356b12);
    00701 
    00702       // get initial pose of model
    00703       gazebo::Vector3 initial_xyz(req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[position](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#a27067d1772d85a856b0e4ed4690a80b4).[x](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Point__.html#acd9420e6916084b2a9c09019bfda1708),req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[position](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#a27067d1772d85a856b0e4ed4690a80b4).[y](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Point__.html#a46a84ff5a3e5817ab5693abda66fccb0),req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[position](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#a27067d1772d85a856b0e4ed4690a80b4).[z](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Point__.html#a061f0093e927a95998f35ceceb5cebda));
    00704       // get initial roll pitch yaw (fixed frame transform)
    00705       gazebo::Quatern initial_q(req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[orientation](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#af8c1d34a44a7628ea9c3e571339f5a28).[w](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Quaternion__.html#a440791d268a65607ecbac21e0ed153cf),req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[orientation](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#af8c1d34a44a7628ea9c3e571339f5a28).[x](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Quaternion__.html#a11f3b4e2df587ce516fd2a8140c1c7c5),req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[orientation](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#af8c1d34a44a7628ea9c3e571339f5a28).[y](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Quaternion__.html#a601c978178311ce3a618afb38c0b6b98),req.[initial_pose](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#ace209c26c913dacf3112e94d343be2b0).[orientation](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Pose__.html#af8c1d34a44a7628ea9c3e571339f5a28).[z](../../../api/geometry_msgs/html/structgeometry__msgs_1_1Quaternion__.html#ae2caceb9fc4b2fd01acd8419aa7ebc2e));
    00706 
    00707       // refernce frame for initial pose definition, modify initial pose if defined
    00708       gazebo::Body* frame = dynamic_cast<gazebo::Body*>(gazebo::World::Instance()->GetEntityByName(req.[reference_frame](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#af510727d31cfdbdd303809f180ecf421)));
    00709       if (frame)
    00710       {
    00711         // convert to relative pose
    00712         gazebo::Pose3d frame_pose = frame->GetWorldPose();
    00713         initial_xyz = frame_pose.rot.RotateVector(initial_xyz);
    00714         initial_xyz += frame_pose.pos;
    00715         initial_q = frame_pose.rot*initial_q;
    00716       }
    00717 
    00719       else if (req.[reference_frame](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#af510727d31cfdbdd303809f180ecf421) == "" || req.[reference_frame](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#af510727d31cfdbdd303809f180ecf421) == "world" || req.[reference_frame](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#af510727d31cfdbdd303809f180ecf421) == "map" || req.[reference_frame](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#af510727d31cfdbdd303809f180ecf421) == "/map")
    00720       {
    00721           [ROS_DEBUG](../../../api/rosconsole/html/macros__generated_8h.html#a83228c0b42c80605abdd0f42af64b1f7)("SpawnModel: reference_frame is empty/world/map, using inertial frame");
    00722       }
    00723       else
    00724       {
    00725         res.[success](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelResponse__.html#a5ec6d9587b9a10ddc10ec198d41ccd62) = false;
    00726         res.[status_message](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelResponse__.html#acb4913011a74e88bdac7e11d173d8a7b) = "SpawnModel: reference reference_frame not found, did you forget to scope the link by model name?";
    00727         return false;
    00728       }
    00729 
    00730       // incoming robot model string
    00731       std::string model_xml = req.[model_xml](../../gazebo_msgs/html/structgazebo__msgs_1_1SpawnModelRequest__.html#a4ea852fe421bee28bcaa852e69e13004);