pxmlw6n2f/Gazebo_Distributed_MPI/gazebo/physics/GazeboID.hh

110 lines
2.7 KiB
C++

/*
* Copyright (C) 2019 AIRC 01
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/* Desc: Base class for distributed gazebo
* Author: Zhang Shuai
* Date: 28 March 2019
*/
#ifndef _GAZEBOID_HH_
#define _GAZEBOID_HH_
#include <string>
// #include <map>
#include <vector>
#include <boost/function.hpp>
// #include <boost/thread/recursive_mutex.hpp>
#include <sdf/sdf.hh>
// #include "gazebo/common/CommonTypes.hh"
#include "gazebo/physics/PhysicsTypes.hh"
// #include "gazebo/physics/ModelState.hh"
// #include "gazebo/physics/Entity.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
/// \class Distribution Distribution.hh physics/physics.hh
/// \brief Distribution is used to store information about the distributed simulation.
class GZ_PHYSICS_VISIBLE GazeboID
{
/// \brief Constructor.
/// \param[in] _parent Parent object.
public:
explicit GazeboID();
/// \brief Destructor.
public:
virtual ~GazeboID();
/// \brief Load the Distribution.
/// \param[in] _sdf SDF parameters to load from.
public:
void Load(sdf::ElementPtr _sdf);
/// \brief Get the gazebo ID of this Distribution.
/// \return the gazebo ID of this Distribution.
public:
int GetGazeboID();
/// \brief Get the gazebo ip of this Distribution.
/// \return the gazebo ip of this Distribution.
public:
std::string GetGazeboIp();
/// \brief Get the number of models this Distribution has.
/// \return Number of models associated with this Distribution.
public:
unsigned int GetModelCount();
/// \brief Get the name of the specified model.
/// \param[in] _i Number of the model name to get.
/// \return the name of the specified model.
public:
std::string GetModelName(unsigned int _i);
/// \brief Finialize the gazeboID
public:
void Fini();
/// \brief The Distribution's current SDF description.
private:
sdf::ElementPtr sdf;
/// \brief idex of distributed gazebo.
private:
int gazeboID;
/// \brief ip of distributed gazebo.
private:
std::string ip;
/// \brief port of distributed gazebo.
private:
int port;
/// \brief Models name in this gazebo
private:
std::vector<std::string> modelNames;
};
} // namespace physics
} // namespace gazebo
#endif