Initial version of MPI_Gazebo

This commit is contained in:
zhangshuai 2019-04-26 11:20:11 +08:00
parent a2732f8bbd
commit 7e41222cfa
502 changed files with 2188284 additions and 208 deletions

View File

@ -1,3 +1,5 @@
find_package(MPI REQUIRED) # Added by zhangshuai 2019.04.22 for MPI
include_directories(SYSTEM
${OPENGL_INCLUDE_DIR}
${OGRE_INCLUDE_DIRS}
@ -7,6 +9,8 @@ include_directories(SYSTEM
${IGNITION-MATH_INCLUDE_DIRS}
${TBB_INCLUDEDIR}
${tinyxml_INCLUDE_DIRS}
${MPI_INCLUDE_PATH} # Added by zhangshuai 2019.04.22 for MPI
)
link_directories(
@ -46,6 +50,9 @@ add_dependencies(gazebo_gui gazebo_msgs)
add_dependencies(gazebo_rendering gazebo_msgs)
add_dependencies(gazebo_sensors gazebo_rendering)
SET(CMAKE_C_COMPILER mpicc.openmpi) # Added by zhangshuai 2019.04.22 for MPI
SET(CMAKE_CXX_COMPILER mpicxx.openmpi) # Added by zhangshuai 2019.04.22 for MPI
gz_add_executable(gzserver server_main.cc)
target_link_libraries(gzserver

View File

@ -1,3 +1,4 @@
find_package(MPI REQUIRED) # Added by zhangshuai 2019.04.22 for MPI
include (${gazebo_cmake_dir}/GazeboUtils.cmake)
link_directories(
@ -6,7 +7,10 @@ link_directories(
)
# Build in ODE by default
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/deps/opende/include)
include_directories(SYSTEM
${CMAKE_SOURCE_DIR}/deps/opende/include
${MPI_INCLUDE_PATH}
) # Added by zhangshuai 2019.04.22 for MPI
add_subdirectory(ode)
# Add Bullet support if present
@ -43,6 +47,9 @@ if (WIN32)
include_directories(${libdl_include_dir})
endif()
SET(CMAKE_C_COMPILER mpicc.openmpi) # Added by zhangshuai 2019.04.22 for MPI
SET(CMAKE_CXX_COMPILER mpicxx.openmpi) # Added by zhangshuai 2019.04.22 for MPI
set (sources ${sources}
Actor.cc
Base.cc

View File

@ -91,16 +91,16 @@ void Distribution::Load(sdf::ElementPtr _sdf)
}
//////////////////////////////////////////////////
unsigned int Distribution::GetGazeboID(unsigned int _i)
int Distribution::GetGazeboID(unsigned int _i)
{
return gazeboIDs[_i]->GetGazeboID();
}
//////////////////////////////////////////////////
GazeboIDPtr Distribution::GetGazeboIDPtr(unsigned int _gazeboID)
GazeboIDPtr Distribution::GetGazeboIDPtr(int _gazeboID)
{
GazeboIDPtr result;
for (unsigned int i = 0; i < this->GetGazeboCount(); i++)
for (int i = 0; i < this->GetGazeboCount(); i++)
{
if (this->GetGazeboID(i) == _gazeboID)
{
@ -112,7 +112,7 @@ GazeboIDPtr Distribution::GetGazeboIDPtr(unsigned int _gazeboID)
}
//////////////////////////////////////////////////
unsigned int Distribution::GetGazeboCount()
int Distribution::GetGazeboCount()
{
return gazeboIDs.size();
}

View File

@ -64,18 +64,18 @@ public:
/// \param[in] _i Number of the gazebo ID to get.
/// \return the gazebo ID of the specified gazebo.
public:
unsigned int GetGazeboID(unsigned int _i);
int GetGazeboID(unsigned int _i);
/// \brief Get the gazebo ID pointer of the specified gazebo.
/// \param[in] _i Number of the gazebo ID to get.
/// \return the gazebo ID pointer of the specified gazebo.
public:
GazeboIDPtr GetGazeboIDPtr(unsigned int _gazeboID);
GazeboIDPtr GetGazeboIDPtr(int _gazeboID);
/// \brief Get the number of Gazebos this Distribution has.
/// \return Number of Gazebos associated with this Distribution.
public:
unsigned int GetGazeboCount();
int GetGazeboCount();
/// \brief Finialize the Distribution
public:
@ -87,7 +87,7 @@ private:
// /// \brief Gazebos' ID in this distribution gazebo.
// private:
// std::vector<unsigned int> gazeboIDs;
// std::vector<int> gazeboIDs;
/// \brief Gazebos' ID in this distribution gazebo.
private:

View File

@ -77,7 +77,7 @@ void GazeboID::Load(sdf::ElementPtr _sdf)
this->sdf = _sdf;
if (this->sdf->HasAttribute("num"))
this->gazeboID = this->sdf->Get<unsigned int>("num");
this->gazeboID = this->sdf->Get<int>("num");
if (this->sdf->HasAttribute("ip"))
this->ip = this->sdf->Get<std::string>("ip");
@ -106,7 +106,7 @@ void GazeboID::Load(sdf::ElementPtr _sdf)
}
//////////////////////////////////////////////////
unsigned int GazeboID::GetGazeboID()
int GazeboID::GetGazeboID()
{
return gazeboID;
}

View File

@ -61,7 +61,7 @@ public:
/// \brief Get the gazebo ID of this Distribution.
/// \return the gazebo ID of this Distribution.
public:
unsigned int GetGazeboID();
int GetGazeboID();
/// \brief Get the gazebo ip of this Distribution.
/// \return the gazebo ip of this Distribution.
@ -89,7 +89,7 @@ private:
/// \brief idex of distributed gazebo.
private:
unsigned int gazeboID;
int gazeboID;
/// \brief ip of distributed gazebo.
private:

View File

@ -21,6 +21,7 @@
#include <Winsock2.h>
#endif
#include <mpi.h> // Added by zhangshuai 2019.04.23 for MPI
#include <time.h>
#include <tbb/parallel_for.h>
@ -84,9 +85,7 @@
#include "gazebo/physics/ContactManager.hh"
#include "gazebo/physics/Population.hh"
// Added by zhangshuai 2019.04.03 for count time ----Begin
#include "gazebo/countTime.hh"
// Added by zhangshuai 2019.04.03 for count time ----End
#include "gazebo/countTime.hh" // Added by zhangshuai 2019.04.03 for count time
using namespace gazebo;
using namespace physics;
@ -272,34 +271,25 @@ void World::Load(sdf::ElementPtr _sdf)
this->dataPtr->lightFactoryPub = this->dataPtr->node->Advertise<msgs::Light>(
"~/factory/light");
// Added by zhangshuai based on zenglei 2019.03.19 ----Begin
// Added by zhangshuai based on zenglei 2019.04.23 ----Begin
if (this->dataPtr->sdf->HasElement("distribution"))
{
sdf::ElementPtr distributionElem = this->dataPtr->sdf->GetElement("distribution");
this->gazeboLocalID = distributionElem->Get<unsigned int>("gazebo_local_ID");
this->port = distributionElem->Get<int>("port");
// int myid = 0;
MPI_Comm_rank(MPI_COMM_WORLD, &this->gazeboLocalID);
this->flag = distributionElem->Get<int>("flag");
std::cout << "================= gazebo_local_ID: " << gazeboLocalID << "\t Port: " << port << "\t Flag: " << flag << " =================" << std::endl;
std::cout << "================= gazebo_local_ID: " << this->gazeboLocalID << "\t Flag: " << this->flag << " =================" << std::endl;
if (1 == this->flag)
{
DistributionPtr distribution_tmp(new physics::Distribution());
this->distribution = distribution_tmp;
this->distribution->Load(distributionElem);
std::cout << "================= gazebo_counts: " << this->distribution->GetGazeboCount() << " =================" << std::endl;
std::cout << "================= gazebo_ID: " << this->distribution->GetGazeboIDPtr(this->gazeboLocalID)->GetGazeboID() << " =================" << std::endl;
std::cout << "================= model_counts: " << this->distribution->GetGazeboIDPtr(this->gazeboLocalID)->GetModelCount() << " =================" << std::endl;
}
std::cout << "================= gazebo_counts: " << this->distribution->GetGazeboCount() << " =================" << std::endl;
std::cout << "================= gazebo_ID: " << this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetGazeboID() << " =================" << std::endl;
std::cout << "================= gazebo_ip: " << this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetGazeboIp() << " =================" << std::endl;
std::cout << "================= model_counts: " << this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount() << " =================" << std::endl;
// std::cout << "================= the second model name: " << this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelName(1) << " =================" << std::endl;
// ip = eventElem->Get<std::string>("ip");
// simula_entity_num = eventElem->Get<int>("simula_entity_num");
// shadow_entity_num = eventElem->Get<int>("shadow_entity_num");
}
//Added by zhangshuai based on zenglei 2019.03.19 ----End
@ -455,24 +445,6 @@ void World::Run(unsigned int _iterations)
{
this->dataPtr->stop = false;
this->dataPtr->stopIterations = _iterations;
// Added by zhangshuai based on zenglei 2019.03.19 ----Begin
if (1 == this->flag)
{
if (0 == this->gazeboLocalID)
{
gazeboZero.SetPort(port);
gazeboZero.StartServer();
}
else if (1 == this->gazeboLocalID)
{
gazeboOne.SetIp(this->distribution->GetGazeboIDPtr(0)->GetGazeboIp());
gazeboOne.SetPort(port);
gazeboOne.ConnectServer();
}
}
// Added by zhangshuai based on zenglei 2019.03.19 ----End
this->dataPtr->thread = new boost::thread(boost::bind(&World::RunLoop, this));
}
@ -552,20 +524,6 @@ void World::RunLoop()
}
}
// Added by zhangshuai based on zenglei 2019.03.19 ----Begin
if (1 == this->flag)
{
if (0 == this->gazeboLocalID)
{
gazeboZero.Close();
}
else if (1 == this->gazeboLocalID)
{
gazeboOne.Close();
}
}
// Added by zhangshuai based on zenglei 2019.03.19 ----End
this->dataPtr->stop = true;
if (this->dataPtr->logThread)
@ -940,126 +898,150 @@ void World::Update()
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
// Added by zhangshuai based on zenglei 2019.03.19 ----Begin
if (1 == this->flag)
{
// if (this->dataPtr->iterations % 10 == 0)
// Modified by zhangshuai 2019.04.02 ----Begin
// Added by zhangshuai 2019.04.23 for MPI communication----Begin
if (1 == this->flag)
{
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount(); i++)
{
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelName(i);
unsigned int j = 0;
for (j = 0; j < this->GetModel(tmp_model_name)->GetLink("base_link")->GetName().length(); j++)
infor[i].link_name[j] = this->GetModel(tmp_model_name)->GetLink("base_link")->GetName()[j];
infor[i].link_name[j] = '\0';
infor[i].ID = this->GetModel(tmp_model_name)->GetLink("base_link")->GetId();
infor[i].link_pose = this->GetModel(tmp_model_name)->GetLink("base_link")->GetWorldPose();
}
MPI_Status *status = (MPI_Status *)malloc(sizeof(MPI_Status) * (this->distribution->GetGazeboCount()));
MPI_Request *request = (MPI_Request *)malloc(sizeof(MPI_Request) * (this->distribution->GetGazeboCount()));
CommunicationData temp[50];
msgs::Pose_V modelPoseListSend;
for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(this->gazeboLocalID)->GetModelCount(); i++)
{
msgs::Pose *modelPose;
modelPose = modelPoseListSend.add_pose();
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(this->gazeboLocalID)->GetModelName(i);
modelPose->set_name(tmp_model_name);
modelPose->set_id(this->GetModel(tmp_model_name)->GetLink("canonical")->GetId());
modelPose->mutable_position()->set_x(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().pos.x);
modelPose->mutable_position()->set_y(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().pos.y);
modelPose->mutable_position()->set_z(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().pos.z);
modelPose->mutable_orientation()->set_x(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().rot.x);
modelPose->mutable_orientation()->set_y(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().rot.y);
modelPose->mutable_orientation()->set_z(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().rot.z);
modelPose->mutable_orientation()->set_w(this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose().rot.w);
tmp_model_name.clear();
}
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
before_tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
if (0 == this->gazeboLocalID)
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
//send poses to another process
for (int tmp_gazebo_id = 0; tmp_gazebo_id < this->distribution->GetGazeboCount(); tmp_gazebo_id++)
{
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
if (!gazeboZero.sendInfor(infor, this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount()))
std::cout << "Send Infor fail!" << std::endl;
if (!gazeboZero.recvInfor(temp, this->distribution->GetGazeboIDPtr(1)->GetModelCount()))
std::cout << "Rcceive Infor fail!" << std::endl;
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(1)->GetModelCount(); i++)
if (this->gazeboLocalID != tmp_gazebo_id)
{
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(1)->GetModelName(i);
this->GetModel(tmp_model_name)->GetLink("base_link")->SetWorldPose(temp[i].link_pose);
}
std::string send_messages = "";
if (modelPoseListSend.pose_size() > 0)
{
modelPoseListSend.SerializeToString(&send_messages);
modelPoseListSend.clear_pose();
}
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
after_tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
int bufferLen = send_messages.size();
char *sendBuffer = new char[bufferLen + 1];
for (int i = 0; i < bufferLen; i++)
{
sendBuffer[i] = send_messages[i];
}
sendBuffer[bufferLen] = '\0';
send_messages.clear();
MPI_Isend(sendBuffer, bufferLen, MPI_CHAR, tmp_gazebo_id, 99, MPI_COMM_WORLD, &request[tmp_gazebo_id]);
}
}
else if (1 == this->gazeboLocalID)
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
//receive and get information from other processes
for (int tmp_gazebo_id = 0; tmp_gazebo_id < this->distribution->GetGazeboCount(); tmp_gazebo_id++)
{
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
if (!gazeboOne.recvInfor(temp, this->distribution->GetGazeboIDPtr(0)->GetModelCount()))
std::cout << "Rcceive Infor fail!" << std::endl;
if (!gazeboOne.sendInfor(infor, this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount()))
std::cout << "Send Infor fail!" << std::endl;
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
cur_time = (double)tv.tv_sec + (double)tv.tv_usec / 1.e6;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(0)->GetModelCount(); i++)
if (this->gazeboLocalID != tmp_gazebo_id)
{
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(0)->GetModelName(i);
this->GetModel(tmp_model_name)->GetLink("base_link")->SetWorldPose(temp[i].link_pose);
}
MPI_Probe(tmp_gazebo_id, 99, MPI_COMM_WORLD, &status[tmp_gazebo_id]);
int size;
MPI_Get_count(&status[tmp_gazebo_id], MPI_CHAR, &size);
char *receiveBuffer = (char *)malloc(sizeof(char) * (size));
MPI_Recv(receiveBuffer, size, MPI_CHAR, tmp_gazebo_id, 99, MPI_COMM_WORLD, &status[tmp_gazebo_id]);
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
after_tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
if (size > 0)
{
std::string receive_messages;
for (int j = 0; j < size; j++)
{
receive_messages.push_back(receiveBuffer[j]);
}
msgs::Pose_V modelPoseListReceive;
modelPoseListReceive.ParseFromString(receive_messages);
receive_messages.clear();
//insert models according to name,pose,vel from process 0
for (int i = 0; i < modelPoseListReceive.pose_size(); i++)
{
math::Pose tmp_pose;
std::string tmp_model_name = modelPoseListReceive.pose(i).name();
// std::string tmp_model_name = this->distribution->GetGazeboIDPtr(1)->GetModelName(i);
tmp_pose.pos.x = modelPoseListReceive.pose(i).position().x();
tmp_pose.pos.y = modelPoseListReceive.pose(i).position().y();
tmp_pose.pos.z = modelPoseListReceive.pose(i).position().z();
tmp_pose.rot.x = modelPoseListReceive.pose(i).orientation().x();
tmp_pose.rot.y = modelPoseListReceive.pose(i).orientation().y();
tmp_pose.rot.z = modelPoseListReceive.pose(i).orientation().z();
tmp_pose.rot.w = modelPoseListReceive.pose(i).orientation().w();
this->GetModel(tmp_model_name)->GetLink("canonical")->SetWorldPose(tmp_pose);
}
}
}
}
// Added by zhangshuai 2019.04.03 for count time ----Begin
#ifdef USE_COUNT_TIME
gettimeofday(&tv, NULL);
after_tcpTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - cur_time;
#endif
// Added by zhangshuai 2019.04.03 for count time ----End
// MPI_Waitall(this->distribution->GetGazeboCount(), request, status);
// MPI_Barrier(MPI_COMM_WORLD);
}
// Modified by zhangshuai 2019.04.02 ----End
}
// Added by zhangshuai based on zenglei 2019.03.19 ----End
MPI_Barrier(MPI_COMM_WORLD);
// Added by zhangshuai 2019.04.23 for MPI communication ----End
// Only update state information if logging data.
if (util::LogRecord::Instance()->Running())
@ -1080,21 +1062,25 @@ void World::Update()
wholeUpdataTime += (double)tv.tv_sec + (double)tv.tv_usec / 1.e6 - start_time;
#endif
if (this->dataPtr->iterations == 100000)
// std::cout << "===== iterations:\t" << this->dataPtr->iterations << std::endl;
if (this->dataPtr->iterations == 1000000)
{
std::cout << "===== average before_worldUpdateBeginTime:\t" << before_worldUpdateBeginTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average worldUpdateBeginTime:\t" << worldUpdateBeginTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average modelUpdateFuncTime:\t" << modelUpdateFuncTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average updateCollisionTime:\t" << updateCollisionTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average loggingTime:\t" << loggingTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average before_updatePhysicsTime:\t" << before_updatePhysicsTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average updatePhysicsTime:\t" << updatePhysicsTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average before_tcpTime:\t" << before_tcpTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average tcpTime:\t" << tcpTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average after_tcpTime:\t" << after_tcpTime / 100.0 << "\tms =====" << std::endl;
double wholeAddTime = before_worldUpdateBeginTime + worldUpdateBeginTime + modelUpdateFuncTime + updateCollisionTime + loggingTime + before_updatePhysicsTime + updatePhysicsTime + before_tcpTime + tcpTime + after_tcpTime;
std::cout << "===== average wholeAddTime:\t" << wholeAddTime / 100.0 << "\tms =====" << std::endl;
std::cout << "===== average wholeUpdateTime:\t" << wholeUpdataTime / 100.0 << "\tms =====" << std::endl;
if (this->gazeboLocalID == 0)
{
std::cout << "===== average before_worldUpdateBeginTime:\t" << before_worldUpdateBeginTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average worldUpdateBeginTime:\t" << worldUpdateBeginTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average modelUpdateFuncTime:\t" << modelUpdateFuncTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average updateCollisionTime:\t" << updateCollisionTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average loggingTime:\t" << loggingTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average before_updatePhysicsTime:\t" << before_updatePhysicsTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average updatePhysicsTime:\t" << updatePhysicsTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average before_tcpTime:\t" << before_tcpTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average tcpTime:\t" << tcpTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average after_tcpTime:\t" << after_tcpTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
double wholeAddTime = before_worldUpdateBeginTime + worldUpdateBeginTime + modelUpdateFuncTime + updateCollisionTime + loggingTime + before_updatePhysicsTime + updatePhysicsTime + before_tcpTime + tcpTime + after_tcpTime;
std::cout << "===== average wholeAddTime:\t" << wholeAddTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
std::cout << "===== average wholeUpdateTime:\t" << wholeUpdataTime * 1000.0 / this->dataPtr->iterations << "\tms =====" << std::endl;
}
}
}
@ -1862,7 +1848,26 @@ void World::LoadPlugins()
{
ModelPtr model = boost::static_pointer_cast<Model>(
this->dataPtr->rootElement->GetChild(i));
model->LoadPlugins();
// Modified by zhangshuai 2019.04.02 ----Begin
if (this->flag == 1)
{
// Judge if the model to load is simulated in this gazebo
for (unsigned int j = 0; j < this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount(); j++)
{
if (model->GetName() == this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelName(j))
{
// Original part
model->LoadPlugins();
// Original part
}
}
}
else
{
model->LoadPlugins();
}
// Modified by zhangshuai 2019.04.02 ----End
// model->LoadPlugins();
}
}
}
@ -3310,14 +3315,14 @@ DistributionPtr World::GetDistribution()
//////////////////////////////////////////////////
/// add for read the element of "gazeboLocalID"
unsigned int World::GetGazeboLocalID()
int World::GetGazeboLocalID()
{
return this->gazeboLocalID;
}
//////////////////////////////////////////////////
/// add for read the element of "flag"
unsigned int World::GetFlag()
int World::GetFlag()
{
return this->flag;
}

View File

@ -713,39 +713,14 @@ private:
friend class SimbodyPhysics;
// Added by zhangshuai based on zenglei 2019.03.19 ----Begin
/// add for Tcp communication
private:
TcpClient gazeboOne;
private:
TcpServer gazeboZero;
// private:
// std::string ip;
// private:
// int type_; //0:server:gazeboZero; 1:client:gazeboOne;
private:
int port;
private:
int flag;
// private:
// unsigned int simula_entity_num;
// private:
// unsigned int shadow_entity_num;
private:
CommunicationData infor[50];
// Added by zhangshuai based on zenglei 2019.03.19 ----End
// Added by zhangshuai 2019.04.01 ----Begin
/// \brief the .
private:
unsigned int gazeboLocalID;
int gazeboLocalID;
/// \brief the .
private:
@ -756,10 +731,10 @@ public:
DistributionPtr GetDistribution();
public:
unsigned int GetGazeboLocalID();
int GetGazeboLocalID();
public:
unsigned int GetFlag();
int GetFlag();
// Added by zhangshuai 2019.04.01 ----End
};
/// \}

View File

@ -18,10 +18,18 @@
#include "gazebo/util/LogRecord.hh"
#include "gazebo/common/Console.hh"
#include "gazebo/Server.hh"
#include <mpi.h> // Added by zhangshuai 2019.04.22 for MPI
//////////////////////////////////////////////////
int main(int argc, char **argv)
{
// Added by zhangshuai 2019.04.22 for MPI ----Begin
//int myid;
MPI_Init(&argc, &argv);
// MPI_Comm_rank(MPI_COMM_WORLD,&myid);
// std::cerr<<myid<<"\n";
// Added by zhangshuai 2019.04.22 for MPI ----End
gazebo::Server *server = NULL;
try
@ -42,14 +50,19 @@ int main(int argc, char **argv)
delete server;
}
catch(gazebo::common::Exception &_e)
catch (gazebo::common::Exception &_e)
{
_e.Print();
server->Fini();
delete server;
MPI_Finalize(); // Added by zhangshuai 2019.04.22 for MPI
return -1;
}
MPI_Finalize(); // Added by zhangshuai 2019.04.22 for MPI
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
localhost slots=2

View File

@ -0,0 +1 @@
mpirun -machinefile ./machinefile -np 1 -env GAZEBO_MASTER_URI=http://localhost:11346 gzserver --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi.world : -np 1 -env GAZEBO_MASTER_URI=http://localhost:11347 gzserver --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi.world

View File

@ -0,0 +1,5 @@
mpirun -machinefile ./machinefile -np 1 -x GAZEBO_MASTER_URI=http://localhost:11346 gzserver --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world : -np 1 -x GAZEBO_MASTER_URI=http://localhost:11347 gzserver --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world
mpirun -machinefile ./machinefile -np 1 -x GAZEBO_MASTER_URI=http://localhost:11346 gazebo --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world : -np 1 -x GAZEBO_MASTER_URI=http://localhost:11347 gazebo --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world
mpirun -machinefile ./machinefile -np 2 -x GAZEBO_MASTER_URI=http://localhost:11346 gazebo --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world : -np 2 -x GAZEBO_MASTER_URI=http://localhost:11347 gazebo --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world : -np 2 -x GAZEBO_MASTER_URI=http://localhost:11348 gazebo --verbose /home/zhangshuai/Git/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport_distribution_2hector_mpi_test.world

View File

@ -0,0 +1,126 @@
<!-- This is a launch file that runs the bare minimum requirements to get -->
<!-- gazebo running for a fixed-wing aircraft -->
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="true"/>
<arg name="gui" value="true"/>
<arg name="verbose" value="false"/>
<arg name="debug" value="false"/>
<arg name="world_name" value="$(find hector_quadrotor_gazebo)/worlds/kunming_airport_distribution_10hector.world"/>
</include>
<group ns="bebop_0">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_0" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_0" />
<arg name="x" value="0.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_1">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_1" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_1" />
<arg name="x" value="0.0" />
<arg name="y" value="5.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_2">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_2" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_2" />
<arg name="x" value="0.0" />
<arg name="y" value="10.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_3">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_3" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_3" />
<arg name="x" value="0.0" />
<arg name="y" value="15.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_4">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_4" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_4" />
<arg name="x" value="0.0" />
<arg name="y" value="20.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_5">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_5" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_5" />
<arg name="x" value="0.0" />
<arg name="y" value="25.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_6">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_6" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_6" />
<arg name="x" value="0.0" />
<arg name="y" value="30.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_7">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_7" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_7" />
<arg name="x" value="0.0" />
<arg name="y" value="35.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_8">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_8" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_8" />
<arg name="x" value="0.0" />
<arg name="y" value="40.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_9">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_9" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_9" />
<arg name="x" value="0.0" />
<arg name="y" value="45.0" />
<arg name="z" value="0.186" />
</include>
</group>
<node name="simple_takeoff" pkg="hector" type="hector_simple_takeoff"/>
</launch>

View File

@ -0,0 +1,38 @@
<!-- This is a launch file that runs the bare minimum requirements to get -->
<!-- gazebo running for a fixed-wing aircraft -->
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="true"/>
<arg name="gui" value="true"/>
<arg name="verbose" value="false"/>
<arg name="debug" value="false"/>
<arg name="world_name" value="$(find hector_quadrotor_gazebo)/worlds/kunming_airport_distribution_2hector.world"/>
</include>
<group ns="bebop_0">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_0" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_0" />
<arg name="x" value="0.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_1">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_1" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_1" />
<arg name="x" value="0.0" />
<arg name="y" value="5.0" />
<arg name="z" value="0.186" />
</include>
</group>
<node name="simple_takeoff" pkg="hector" type="hector_simple_takeoff"/>
</launch>

View File

@ -0,0 +1,346 @@
<!-- This is a launch file that runs the bare minimum requirements to get -->
<!-- gazebo running for a fixed-wing aircraft -->
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="true"/>
<arg name="gui" value="true"/>
<arg name="verbose" value="false"/>
<arg name="debug" value="false"/>
<arg name="world_name" value="$(find hector_quadrotor_gazebo)/worlds/kunming_airport_distribution_30hector.world"/>
</include>
<group ns="bebop_0">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_0" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_0" />
<arg name="x" value="0.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_1">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_1" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_1" />
<arg name="x" value="0.0" />
<arg name="y" value="5.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_2">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_2" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_2" />
<arg name="x" value="0.0" />
<arg name="y" value="10.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_3">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_3" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_3" />
<arg name="x" value="0.0" />
<arg name="y" value="15.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_4">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_4" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_4" />
<arg name="x" value="0.0" />
<arg name="y" value="20.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_5">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_5" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_5" />
<arg name="x" value="0.0" />
<arg name="y" value="25.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_6">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_6" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_6" />
<arg name="x" value="0.0" />
<arg name="y" value="30.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_7">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_7" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_7" />
<arg name="x" value="0.0" />
<arg name="y" value="35.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_8">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_8" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_8" />
<arg name="x" value="0.0" />
<arg name="y" value="40.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_9">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_9" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_9" />
<arg name="x" value="0.0" />
<arg name="y" value="45.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_10">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_10" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_10" />
<arg name="x" value="5.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_11">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_11" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_11" />
<arg name="x" value="5.0" />
<arg name="y" value="5.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_12">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_12" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_12" />
<arg name="x" value="5.0" />
<arg name="y" value="10.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_13">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_13" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_13" />
<arg name="x" value="5.0" />
<arg name="y" value="15.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_14">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_14" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_14" />
<arg name="x" value="5.0" />
<arg name="y" value="20.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_15">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_15" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_15" />
<arg name="x" value="5.0" />
<arg name="y" value="25.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_16">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_16" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_16" />
<arg name="x" value="5.0" />
<arg name="y" value="30.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_17">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_17" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_17" />
<arg name="x" value="5.0" />
<arg name="y" value="35.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_18">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_18" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_18" />
<arg name="x" value="5.0" />
<arg name="y" value="40.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_19">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_19" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_19" />
<arg name="x" value="5.0" />
<arg name="y" value="45.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_20">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_20" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_20" />
<arg name="x" value="10.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_21">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_21" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_21" />
<arg name="x" value="10.0" />
<arg name="y" value="5.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_22">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_22" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_22" />
<arg name="x" value="10.0" />
<arg name="y" value="10.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_23">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_23" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_23" />
<arg name="x" value="10.0" />
<arg name="y" value="15.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_24">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_24" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_24" />
<arg name="x" value="10.0" />
<arg name="y" value="20.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_25">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_25" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_25" />
<arg name="x" value="10.0" />
<arg name="y" value="25.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_26">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_26" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_26" />
<arg name="x" value="10.0" />
<arg name="y" value="30.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_27">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_27" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_27" />
<arg name="x" value="10.0" />
<arg name="y" value="35.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_28">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_28" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_28" />
<arg name="x" value="10.0" />
<arg name="y" value="40.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_29">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_29" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_29" />
<arg name="x" value="10.0" />
<arg name="y" value="45.0" />
<arg name="z" value="0.186" />
</include>
</group>
<node name="simple_takeoff" pkg="hector" type="hector_simple_takeoff"/>
</launch>

View File

@ -0,0 +1,60 @@
<!-- This is a launch file that runs the bare minimum requirements to get -->
<!-- gazebo running for a fixed-wing aircraft -->
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="true"/>
<arg name="gui" value="true"/>
<arg name="verbose" value="false"/>
<arg name="debug" value="false"/>
<arg name="world_name" value="$(find hector_quadrotor_gazebo)/worlds/kunming_airport_distribution_4hector.world"/>
</include>
<group ns="bebop_0">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_0" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_0" />
<arg name="x" value="0.0" />
<arg name="y" value="0.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_1">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_1" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_1" />
<arg name="x" value="0.0" />
<arg name="y" value="5.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_2">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_2" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_2" />
<arg name="x" value="0.0" />
<arg name="y" value="10.0" />
<arg name="z" value="0.186" />
</include>
</group>
<group ns="bebop_3">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
<arg name="name" value="bebop_3" />
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_downward_cam.gazebo.xacro"/>
<arg name="tf_prefix" value="bebop_3" />
<arg name="x" value="0.0" />
<arg name="y" value="15.0" />
<arg name="z" value="0.186" />
</include>
</group>
<node name="simple_takeoff" pkg="hector" type="hector_simple_takeoff"/>
</launch>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution flag=1>
<gazebo_id num=0 ip="192.168.1.7">
<model_name>bebop_0</model_name>
<model_name>bebop_1</model_name>
<model_name>bebop_2</model_name>
<model_name>bebop_3</model_name>
<model_name>bebop_4</model_name>
</gazebo_id>
<gazebo_id num=1 ip="192.168.1.4">
<model_name>bebop_5</model_name>
<model_name>bebop_6</model_name>
<model_name>bebop_7</model_name>
<model_name>bebop_8</model_name>
<model_name>bebop_9</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
</world>
</sdf>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution flag=1>
<gazebo_id num=0>
<model_name>bebop_0</model_name>
</gazebo_id>
<gazebo_id num=1>
<model_name>bebop_1</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
</world>
</sdf>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution flag=1>
<gazebo_id num=0>
<model_name>bebop_0</model_name>
</gazebo_id>
<gazebo_id num=1>
<model_name>bebop_1</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
<model name="bebop_0">
<pose>0 5 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
<model name="bebop_1">
<pose>0 -5 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
</world>
</sdf>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution gazebo_local_ID=0 port=8888 flag=1>
<gazebo_id num=0 ip="192.168.1.7">
<model_name>bebop_0</model_name>
</gazebo_id>
<gazebo_id num=1 ip="192.168.1.7">
<model_name>bebop_1</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
<model name="bebop_0">
<pose>0 5 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
<model name="bebop_1">
<pose>0 -5 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
</world>
</sdf>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution flag=1>
<gazebo_id num=0 ip="192.168.1.7">
<model_name>bebop_0</model_name>
<model_name>bebop_1</model_name>
<model_name>bebop_2</model_name>
<model_name>bebop_3</model_name>
<model_name>bebop_4</model_name>
<model_name>bebop_5</model_name>
<model_name>bebop_6</model_name>
<model_name>bebop_7</model_name>
<model_name>bebop_8</model_name>
<model_name>bebop_9</model_name>
<model_name>bebop_10</model_name>
<model_name>bebop_11</model_name>
<model_name>bebop_12</model_name>
<model_name>bebop_13</model_name>
<model_name>bebop_14</model_name>
</gazebo_id>
<gazebo_id num=1 ip="192.168.1.4">
<model_name>bebop_15</model_name>
<model_name>bebop_16</model_name>
<model_name>bebop_17</model_name>
<model_name>bebop_18</model_name>
<model_name>bebop_19</model_name>
<model_name>bebop_20</model_name>
<model_name>bebop_21</model_name>
<model_name>bebop_22</model_name>
<model_name>bebop_23</model_name>
<model_name>bebop_24</model_name>
<model_name>bebop_25</model_name>
<model_name>bebop_26</model_name>
<model_name>bebop_27</model_name>
<model_name>bebop_28</model_name>
<model_name>bebop_29</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
</world>
</sdf>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution flag=1>
<gazebo_id num=0 ip="192.168.1.7">
<model_name>bebop_0</model_name>
<model_name>bebop_1</model_name>
</gazebo_id>
<gazebo_id num=1 ip="192.168.1.4">
<model_name>bebop_2</model_name>
<model_name>bebop_3</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
</world>
</sdf>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" ?>
<sdf version="1.4">
<world name="default">
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://kunming_airport</uri>
<pose>0 0 0 0 0 0</pose>
</include>
<scene>
<ambient>0.68 0.68 0.68 1.0</ambient>
<sky>
<sunrise/>
<clouds>
<speed>0</speed>
</clouds>
</sky>
</scene>
<!-- For distributed simulation -->
<distribution flag=1>
<gazebo_id num=0>
<model_name>bebop_0</model_name>
<model_name>bebop_1</model_name>
</gazebo_id>
<gazebo_id num=1>
<model_name>bebop_2</model_name>
<model_name>bebop_3</model_name>
</gazebo_id>
</distribution>
<physics type="ode" name="ode">
<real_time_update_rate>0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>0</real_time_factor>
<!-- <ode>
<solver>
<thread_position_correction>0</thread_position_correction>
<island_threads>8</island_threads>
</solver>
</ode> -->
</physics>
<model name="bebop_0">
<pose>0 5 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
<model name="bebop_1">
<pose>0 -5 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
<model name="bebop_2">
<pose>5 0 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
<model name="bebop_3">
<pose>-5 0 0.186 0 0 0</pose>
<include>
<uri>model://quadrotor</uri>
</include>
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
</model>
</world>
</sdf>

1
sdformat_for_mpi/AUTHORS Normal file
View File

@ -0,0 +1 @@
Nate Koenig <nate@osrfoundation.org>

View File

@ -0,0 +1,306 @@
cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
if(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
CMAKE_POLICY(SET CMP0004 NEW)
endif(COMMAND CMAKE_POLICY)
enable_testing()
# with -fPIC
if(UNIX AND NOT WIN32)
set (CMAKE_INSTALL_PREFIX "/usr" CACHE STRING "Install Prefix")
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
if(CMAKE_UNAME)
exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL
"processor type (i386 and x86_64)")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ADD_DEFINITIONS(-fPIC)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
endif(CMAKE_UNAME)
endif()
project (SDFormat)
string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
# The protocol version has nothing to do with the package version set below.
# It represents the current version of sdformat implement by the software
set (SDF_PROTOCOL_VERSION 1.6)
set (SDF_MAJOR_VERSION 4)
set (SDF_MINOR_VERSION 4)
set (SDF_PATCH_VERSION 0)
set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION})
set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION})
set (project_cmake_dir ${PROJECT_SOURCE_DIR}/cmake
CACHE PATH "Location of CMake scripts")
message (STATUS "${PROJECT_NAME} version ${SDF_VERSION_FULL}")
set (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Include GNUInstallDirs to get canonical paths
include(GNUInstallDirs)
# Default test type for test all over source
set(TEST_TYPE "UNIT")
# developer's option to cache PKG_CONFIG_PATH and
# LD_LIBRARY_PATH for local installs
if(PKG_CONFIG_PATH)
set (ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH})
endif()
if(LD_LIBRARY_PATH)
set (ENV{LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}:$ENV{LD_LIBRARY_PATH})
endif()
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/sdformat-${SDF_VERSION}/sdf")
set (LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Installation directory for libraries (relative to CMAKE_INSTALL_PREFIX)")
set (BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "Installation directory for binaries (relative to CMAKE_INSTALL_PREFIX)")
set (USE_FULL_RPATH OFF CACHE BOOL "Set to true to enable full rpath")
if (USE_FULL_RPATH)
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if its not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
endif("${isSystemDir}" STREQUAL "-1")
endif()
set (BUILD_SDF ON CACHE INTERNAL "Build SDF" FORCE)
set (build_errors "" CACHE INTERNAL "build errors" FORCE)
set (build_warnings "" CACHE INTERNAL "build warnings" FORCE)
set (sdf_cmake_dir ${PROJECT_SOURCE_DIR}/cmake CACHE PATH
"Location of CMake scripts")
include (${sdf_cmake_dir}/SDFUtils.cmake)
message (STATUS "\n\n====== Finding 3rd Party Packages ======")
# Use of tinyxml. System installation on UNIX. Internal copy on WIN
if (UNIX)
message (STATUS "Using system tinyxml")
set (USE_EXTERNAL_TINYXML True)
elseif(WIN32)
message (STATUS "Using internal tinyxml code")
set (USE_EXTERNAL_TINYXML False)
else()
message (STATUS "Unknown platform")
BUILD_ERROR("Unknown platform")
endif()
include (${sdf_cmake_dir}/SearchForStuff.cmake)
message (STATUS "----------------------------------------\n")
#####################################
# Set the default build type
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo Profile Check" FORCE)
endif (NOT CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE)
set (BUILD_TYPE_PROFILE FALSE)
set (BUILD_TYPE_RELEASE FALSE)
set (BUILD_TYPE_RELWITHDEBINFO FALSE)
set (BUILD_TYPE_DEBUG FALSE)
if ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "PROFILE")
set (BUILD_TYPE_PROFILE TRUE)
elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELEASE")
set (BUILD_TYPE_RELEASE TRUE)
elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELWITHDEBINFO")
set (BUILD_TYPE_RELWITHDEBINFO TRUE)
elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "DEBUG")
set (BUILD_TYPE_DEBUG TRUE)
elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "COVERAGE")
include (${project_cmake_dir}/CodeCoverage.cmake)
set (BUILD_TYPE_DEBUG TRUE)
SETUP_TARGET_FOR_COVERAGE(coverage ctest coverage)
else()
build_error("CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} unknown. Valid options are: Debug Release RelWithDebInfo Profile Check")
endif()
#####################################
# Handle CFlags
unset (CMAKE_C_FLAGS_ALL CACHE)
unset (CMAKE_CXX_FLAGS CACHE)
# USE_HOST_CFLAGS (default TRUE)
# Will check building host machine for proper cflags
if(NOT DEFINED USE_HOST_CFLAGS OR USE_HOST_CFLAGS)
message(STATUS "Enable host CFlags")
include (${project_cmake_dir}/HostCFlags.cmake)
endif()
# USE_UPSTREAM_CFLAGS (default TRUE)
# Will use predefined ignition developers cflags
if(NOT DEFINED USE_UPSTREAM_CFLAGS OR USE_UPSTREAM_CFLAGS)
message(STATUS "Enable upstream CFlags")
include(${project_cmake_dir}/DefaultCFlags.cmake)
endif()
# Check if warning options are avaliable for the compiler and return WARNING_CXX_FLAGS variable
if (MSVC)
set(WARN_LEVEL "/W4")
# Unable to be filtered flags (failing due to limitations in filter_valid_compiler_warnings)
# Handling exceptions rightly and ignore unknown pragmas
set(UNFILTERED_FLAGS "/EHsc /wd4068")
else()
# Equivalent to Wall (according to man gcc) but removed the unknown pragmas since we use
# MSVC only pragmas all over the code
list(APPEND WARN_LEVEL -Waddress -Warray-bounds -Wcomment -Wformat -Wnonnull)
list(APPEND WARN_LEVEL -Wparentheses -Wreorder -Wreturn-type)
list(APPEND WARN_LEVEL -Wsequence-point -Wsign-compare -Wstrict-aliasing)
list(APPEND WARN_LEVEL -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized)
list(APPEND WARN_LEVEL -Wunused-function -Wunused-label -Wunused-value)
list(APPEND WARN_LEVEL -Wunused-variable -Wvolatile-register-var)
# Unable to be filtered flags (failing due to limitations in filter_valid_compiler_warnings)
set(UNFILTERED_FLAGS "-Wc++11-compat")
endif()
filter_valid_compiler_warnings(${WARN_LEVEL} -Wextra -Wno-long-long
-Wno-unused-value -Wno-unused-value -Wno-unused-value -Wno-unused-value
-Wfloat-equal -Wshadow -Winit-self -Wswitch-default
-Wmissing-include-dirs -pedantic -Wno-pragmas)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WARNING_CXX_FLAGS} ${UNFILTERED_FLAGS}")
#################################################
# OS Specific initialization
if (UNIX)
sdf_setup_unix()
endif ()
if (WIN32)
sdf_setup_windows()
endif ()
if (APPLE)
sdf_setup_apple()
endif ()
#################################################
# Print warnings and errors
if ( build_warnings )
message(STATUS "BUILD WARNINGS")
foreach (msg ${build_warnings})
message(STATUS ${msg})
endforeach ()
message(STATUS "END BUILD WARNINGS\n")
endif (build_warnings)
########### Add uninstall target ###############
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
if (build_errors)
message(STATUS "BUILD ERRORS: These must be resolved before compiling.")
foreach (msg ${build_errors})
message(STATUS ${msg})
endforeach ()
message(STATUS "END BUILD ERRORS\n")
message (FATAL_ERROR "Errors encountered in build. Please see the BUILD ERRORS above.")
else (buid_errors)
########################################
# Write the config.h file
configure_file (${sdf_cmake_dir}/sdf_config.h.in
${PROJECT_BINARY_DIR}/sdf/sdf_config.h)
sdf_install_includes("" ${PROJECT_BINARY_DIR}/sdf/sdf_config.h)
message (STATUS "C Flags:${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
message (STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
message (STATUS "Install path: ${CMAKE_INSTALL_PREFIX}")
if (BUILD_SDF)
include_directories(include
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/include
)
link_directories(${PROJECT_BINARY_DIR}/src)
add_subdirectory(test)
add_subdirectory(src)
add_subdirectory(include/sdf)
add_subdirectory(sdf)
add_subdirectory(doc)
endif(BUILD_SDF)
########################################
# Make the package config file
configure_file(${CMAKE_SOURCE_DIR}/cmake/sdformat_pc.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/sdformat.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/sdformat.pc DESTINATION
${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
########################################
# Configure documentation uploader
configure_file("${CMAKE_SOURCE_DIR}/cmake/upload_doc.sh.in"
${CMAKE_BINARY_DIR}/upload_doc.sh @ONLY)
########################################
# Make the cmake config files
set(PKG_NAME ${PROJECT_NAME})
set(PKG_LIBRARIES sdformat)
set(cmake_conf_file "cmake/sdf_config.cmake")
set(cmake_conf_version_file "cmake/SDFormatConfigVersion.cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${cmake_conf_file}.in" "${CMAKE_CURRENT_BINARY_DIR}/SDFormatConfig.cmake" @ONLY)
# Use write_basic_package_version_file to generate a ConfigVersion file that
# allow users of gazebo to specify the API or version to depend on
# TODO: keep this instruction until deprecate Ubuntu/Precise and update with
# https://github.com/Kitware/CMake/blob/v2.8.8/Modules/CMakePackageConfigHelpers.cmake
include(WriteBasicConfigVersionFile)
write_basic_config_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_version_file}
VERSION "${SDF_VERSION_FULL}"
COMPATIBILITY SameMajorVersion)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/SDFormatConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_version_file}
DESTINATION
${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME_LOWER}/
COMPONENT cmake)
########################################
# Package Creation:
include (${sdf_cmake_dir}/sdf_cpack.cmake)
set (CPACK_PACKAGE_VERSION "${SDF_VERSION_FULL}")
set (CPACK_PACKAGE_VERSION_MAJOR "${SDF_MAJOR_VERSION}")
set (CPACK_PACKAGE_VERSION_MINOR "${SDF_MINOR_VERSION}")
set (CPACK_PACKAGE_VERSION_PATCH "${SDF_PATCH_VERSION}")
if (CPACK_GENERATOR)
message(STATUS "Found CPack generators: ${CPACK_GENERATOR}")
configure_file("${sdf_cmake_dir}/cpack_options.cmake.in"
${SDF_CPACK_CFG_FILE} @ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${SDF_CPACK_CFG_FILE})
include (CPack)
endif()
message(STATUS "Configuration successful. Type make to compile sdf")
endif(build_errors)

178
sdformat_for_mpi/COPYING Normal file
View File

@ -0,0 +1,178 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View File

@ -0,0 +1,345 @@
## SDFormat 4.0
### SDFormat 4.x.x (2017-xx-xx)
### SDFormat 4.4.0 (2017-10-26)
1. Add ODE parallelization parameters: threaded islands and position correction
* [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380)
1. surface.sdf: expand documentation of friction and slip coefficients
* [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343)
1. Add preserveFixedJoint option to the URDF parser
* [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352)
1. Add light as child of link
* [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373)
### SDFormat 4.3.2 (2017-07-19)
1. Add documentation for `Element::GetFirstElement()` and `Element::GetNextElement()`
* [Pull request 341](https://bitbucket.org/osrf/sdformat/pull-request/341)
1. Fix parser to read plugin child elements within an `<include>`
* [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350)
### SDFormat 4.3.1 (2017-03-24)
1. Fix segmentation Fault in `sdf::getBestSupportedModelVersion`
* [Pull request 327](https://bitbucket.org/osrf/sdformat/pull-requests/327)
* [Issue 152](https://bitbucket.org/osrf/sdformat/issues/152)
### SDFormat 4.3.0 (2017-03-20)
1. Choosing models with more recent sdf version with `<include>` tag
* [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291)
* [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123)
1. Added `<category_bitmask>` to 1.6 surface contact parameters
* [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318)
1. Support light insertion in state
* [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325)
1. Case insensitive boolean strings
* [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322)
1. Enable coverage testing
* [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317)
1. Add `friction_model` parameter to ode solver
* [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294)
* [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522)
1. Added `sampling` parameter to `<heightmap>` SDF element.
* [Pull request 293](https://bitbucket.org/osrf/sdformat/pull-request/293)
1. Added Migration guide
* [Pull request 290](https://bitbucket.org/osrf/sdformat/pull-request/290)
1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file
* [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292)
### SDFormat 4.2.0 (2016-10-10)
1. Added tag to specify ODE friction model.
* [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294)
1. Fix URDF to SDF `self_collide` bug.
* [Pull request 287](https://bitbucket.org/osrf/sdformat/pull-request/287)
1. Added IMU orientation specification to SDF.
* [Pull request 284](https://bitbucket.org/osrf/sdformat/pull-request/284)
### SDFormat 4.1.1 (2016-07-08)
1. Added documentation and animation to `<actor>` element.
* [Pull request 280](https://bitbucket.org/osrf/sdformat/pull-request/280)
1. Added tag to specify initial joint position
* [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-request/279)
### SDFormat 4.1.0 (2016-04-01)
1. Added SDF conversion functions to parser including sdf::convertFile and sdf::convertString.
* [Pull request 266](https://bitbucket.org/osrf/sdformat/pull-request/266)
1. Added an upload script
* [Pull request 256](https://bitbucket.org/osrf/sdformat/pull-request/256)
### SDFormat 4.0.0 (2015-01-12)
1. Boost pointers and boost::function in the public API have been replaced
by their std::equivalents (C++11 standard)
1. Move gravity and magnetic_field tags from physics to world
* [Pull request 247](https://bitbucket.org/osrf/sdformat/pull-request/247)
1. Switch lump link prefix from lump:: to lump_
* [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245)
1. New <wind> element.
A contribution from Olivier Crave
* [Pull request 240](https://bitbucket.org/osrf/sdformat/pull-request/240)
1. Add scale to model state
* [Pull request 246](https://bitbucket.org/osrf/sdformat/pull-request/246)
1. Use stof functions to parse hex strings as floating point params.
A contribution from Rich Mattes
* [Pull request 250](https://bitbucket.org/osrf/sdformat/pull-request/250)
1. Fix memory leaks.
A contribution from Silvio Traversaro
* [Pull request 249](https://bitbucket.org/osrf/sdformat/pull-request/249)
1. Update SDF to version 1.6: new style for representing the noise properties
of an `imu`
* [Pull request 243](https://bitbucket.org/osrf/sdformat/pull-request/243)
* [Pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199)
## SDFormat 3.0
### SDFormat 3.X.X (201X-XX-XX)
1. Improve precision of floating point parameters
* [Pull request 273](https://bitbucket.org/osrf/sdformat/pull-requests/273)
* [Pull request 276](https://bitbucket.org/osrf/sdformat/pull-requests/276)
### SDFormat 3.7.0 (2015-11-20)
1. Add spring pass through for sdf3
* [Design document](https://bitbucket.org/osrf/gazebo_design/pull-requests/23)
* [Pull request 242](https://bitbucket.org/osrf/sdformat/pull-request/242)
1. Support frame specification in SDF
* [Pull request 237](https://bitbucket.org/osrf/sdformat/pull-request/237)
1. Remove boost from SDFExtension
* [Pull request 229](https://bitbucket.org/osrf/sdformat/pull-request/229)
### SDFormat 3.6.0 (2015-10-27)
1. Add light state
* [Pull request 227](https://bitbucket.org/osrf/sdformat/pull-request/227)
1. redo pull request #222 for sdf3 branch
* [Pull request 232](https://bitbucket.org/osrf/sdformat/pull-request/232)
1. Fix links in API documentation
* [Pull request 231](https://bitbucket.org/osrf/sdformat/pull-request/231)
### SDFormat 3.5.0 (2015-10-07)
1. Camera lens description (Replaces #213)
* [Pull request 215](https://bitbucket.org/osrf/sdformat/pull-request/215)
1. Fix shared pointer reference loop in Element and memory leak (#104)
* [Pull request 230](https://bitbucket.org/osrf/sdformat/pull-request/230)
### SDFormat 3.4.0 (2015-10-05)
1. Support nested model states
* [Pull request 223](https://bitbucket.org/osrf/sdformat/pull-request/223)
1. Cleaner way to set SDF_PATH for tests
* [Pull request 226](https://bitbucket.org/osrf/sdformat/pull-request/226)
### SDFormat 3.3.0 (2015-09-15)
1. Windows Boost linking errors
* [Pull request 206](https://bitbucket.org/osrf/sdformat/pull-request/206)
1. Nested SDF -> sdf3
* [Pull request 221](https://bitbucket.org/osrf/sdformat/pull-request/221)
1. Pointer types
* [Pull request 218](https://bitbucket.org/osrf/sdformat/pull-request/218)
1. Torsional friction default surface radius not infinity
* [Pull request 217](https://bitbucket.org/osrf/sdformat/pull-request/217)
### SDFormat 3.2.2 (2015-08-24)
1. Added battery element (contribution from Olivier Crave)
* [Pull request #204](https://bitbucket.org/osrf/sdformat/pull-request/204)
1. Torsional friction backport
* [Pull request #211](https://bitbucket.org/osrf/sdformat/pull-request/211)
1. Allow Visual Studio 2015
* [Pull request #208](https://bitbucket.org/osrf/sdformat/pull-request/208)
### SDFormat 3.1.1 (2015-08-03)
1. Fix tinyxml linking error
* [Pull request #209](https://bitbucket.org/osrf/sdformat/pull-request/209)
### SDFormat 3.1.0 (2015-08-02)
1. Added logical camera sensor to SDF
* [Pull request #207](https://bitbucket.org/osrf/sdformat/pull-request/207)
### SDFormat 3.0.0 (2015-07-24)
1. Added battery to SDF
* [Pull request 204](https://bitbucket.org/osrf/sdformat/pull-request/204)
1. Added altimeter sensor to SDF
* [Pull request #197](https://bitbucket.org/osrf/sdformat/pull-request/197)
1. Added magnetometer sensor to SDF
* [Pull request 198](https://bitbucket.org/osrf/sdformat/pull-request/198)
1. Fix detection of XML parsing errors
* [Pull request 190](https://bitbucket.org/osrf/sdformat/pull-request/190)
1. Support for fixed joints
* [Pull request 194](https://bitbucket.org/osrf/sdformat/pull-request/194)
1. Adding iterations to state
* [Pull request 188](https://bitbucket.org/osrf/sdformat/pull-request/188)
1. Convert to use ignition-math
* [Pull request 173](https://bitbucket.org/osrf/sdformat/pull-request/173)
1. Add world origin to scene
* [Pull request 183](https://bitbucket.org/osrf/sdformat/pull-request/183)
1. Fix collide bitmask
* [Pull request 182](https://bitbucket.org/osrf/sdformat/pull-request/182)
1. Adding meta information to visuals
* [Pull request 180](https://bitbucket.org/osrf/sdformat/pull-request/180)
1. Add projection type to gui camera
* [Pull request 178](https://bitbucket.org/osrf/sdformat/pull-request/178)
1. Fix print description to include attribute description
* [Pull request 170](https://bitbucket.org/osrf/sdformat/pull-request/170)
1. Add -std=c++11 flag to sdf_config.cmake.in and sdformat.pc.in, needed by downstream code
* [Pull request 172](https://bitbucket.org/osrf/sdformat/pull-request/172)
1. Added boost::any accessor for Param and Element
* [Pull request 166](https://bitbucket.org/osrf/sdformat/pull-request/166)
1. Remove tinyxml from dependency list
* [Pull request 152](https://bitbucket.org/osrf/sdformat/pull-request/152)
1. Added self_collide element for model
* [Pull request 149](https://bitbucket.org/osrf/sdformat/pull-request/149)
1. Added a collision bitmask field to sdf-1.5 and c++11 support
* [Pull request 145](https://bitbucket.org/osrf/sdformat/pull-request/145)
1. Fix problems with latin locales and decimal numbers (issue #60)
* [Pull request 147](https://bitbucket.org/osrf/sdformat/pull-request/147)
* [Issue 60](https://bitbucket.org/osrf/sdformat/issues/60)
## SDFormat 2.x
1. rename cfm_damping --> implicit_spring_damper
* [Pull request 59](https://bitbucket.org/osrf/sdformat/pull-request/59)
1. add gear_ratio and reference_body for gearbox joint.
* [Pull request 62](https://bitbucket.org/osrf/sdformat/pull-request/62)
1. Update joint stop stiffness and dissipation
* [Pull request 61](https://bitbucket.org/osrf/sdformat/pull-request/61)
1. Support for GNUInstallDirs
* [Pull request 64](https://bitbucket.org/osrf/sdformat/pull-request/64)
1. `<use_true_size>` element used by DEM heightmaps
* [Pull request 67](https://bitbucket.org/osrf/sdformat/pull-request/67)
1. Do not export urdf symbols in sdformat 1.4
* [Pull request 75](https://bitbucket.org/osrf/sdformat/pull-request/75)
1. adding deformable properties per issue #32
* [Pull request 78](https://bitbucket.org/osrf/sdformat/pull-request/78)
* [Issue 32](https://bitbucket.org/osrf/sdformat/issues/32)
1. Support to use external URDF
* [Pull request 77](https://bitbucket.org/osrf/sdformat/pull-request/77)
1. Add lighting element to visual
* [Pull request 79](https://bitbucket.org/osrf/sdformat/pull-request/79)
1. SDF 1.5: add flag to fix joint axis frame #43 (gazebo issue 494)
* [Pull request 83](https://bitbucket.org/osrf/sdformat/pull-request/83)
* [Issue 43](https://bitbucket.org/osrf/sdformat/issues/43)
* [Gazebo issue 494](https://bitbucket.org/osrf/gazebo/issues/494)
1. Implement SDF_PROTOCOL_VERSION (issue #51)
* [Pull request 90](https://bitbucket.org/osrf/sdformat/pull-request/90)
1. Port sdformat to compile on Windows (MSVC)
* [Pull request 101](https://bitbucket.org/osrf/sdformat/pull-request/101)
1. Separate material properties in material.sdf
* [Pull request 104](https://bitbucket.org/osrf/sdformat/pull-request/104)
1. Add road textures (repeat pull request #104 for sdf_2.0)
* [Pull request 105](https://bitbucket.org/osrf/sdformat/pull-request/105)
1. Add Extruded Polylines as a model
* [Pull request 93](https://bitbucket.org/osrf/sdformat/pull-request/93)
1. Added polyline for sdf_2.0
* [Pull request 106](https://bitbucket.org/osrf/sdformat/pull-request/106)
1. Add spring_reference and spring_stiffness tags to joint axis dynamics
* [Pull request 102](https://bitbucket.org/osrf/sdformat/pull-request/102)
1. Fix actor static
* [Pull request 110](https://bitbucket.org/osrf/sdformat/pull-request/110)
1. New <Population> element
* [Pull request 112](https://bitbucket.org/osrf/sdformat/pull-request/112)
1. Add camera distortion element
* [Pull request 120](https://bitbucket.org/osrf/sdformat/pull-request/120)
1. Inclusion of magnetic field strength sensor
* [Pull request 123](https://bitbucket.org/osrf/sdformat/pull-request/123)
1. Properly add URDF gazebo extensions blobs to SDF joint elements
* [Pull request 125](https://bitbucket.org/osrf/sdformat/pull-request/125)
1. Allow gui plugins to be specified in SDF
* [Pull request 127](https://bitbucket.org/osrf/sdformat/pull-request/127)
1. Backport magnetometer
* [Pull request 128](https://bitbucket.org/osrf/sdformat/pull-request/128)
1. Add flag for MOI rescaling to sdf 1.4
* [Pull request 121](https://bitbucket.org/osrf/sdformat/pull-request/121)
1. Parse urdf joint friction parameters, add corresponding test
* [Pull request 129](https://bitbucket.org/osrf/sdformat/pull-request/129)
1. Allow reading of boolean values from plugin elements.
* [Pull request 132](https://bitbucket.org/osrf/sdformat/pull-request/132)
1. Implement generation of XML Schema files (issue #2)
* [Pull request 91](https://bitbucket.org/osrf/sdformat/pull-request/91)
1. Fix build for OS X 10.10
* [Pull request 135](https://bitbucket.org/osrf/sdformat/pull-request/135)
1. Improve performance in loading <include> SDF elements
* [Pull request 138](https://bitbucket.org/osrf/sdformat/pull-request/138)
1. Added urdf gazebo extension option to disable fixed joint lumping
* [Pull request 133](https://bitbucket.org/osrf/sdformat/pull-request/133)
1. Support urdfdom 0.3 (alternative to pull request #122)
* [Pull request 141](https://bitbucket.org/osrf/sdformat/pull-request/141)
1. Update list of supported joint types
* [Pull request 142](https://bitbucket.org/osrf/sdformat/pull-request/142)
1. Ignore unknown elements
* [Pull request 148](https://bitbucket.org/osrf/sdformat/pull-request/148)
1. Physics preset attributes
* [Pull request 146](https://bitbucket.org/osrf/sdformat/pull-request/146)
1. Backport fix for latin locales (pull request #147)
* [Pull request 150](https://bitbucket.org/osrf/sdformat/pull-request/150)
## SDFormat 1.4
### SDFormat 1.4.8 (2013-09-06)
1. Fix inertia transformations when reducing fixed joints in URDF
* [Pull request 48](https://bitbucket.org/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff)
1. Add <use_terrain_paging> element to support terrain paging in gazebo
* [Pull request 47](https://bitbucket.org/osrf/sdformat/pull-request/47/add-element-inside-heightmap/diff)
1. Further reduce console output when using URDF models
* [Pull request 46](https://bitbucket.org/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff)
* [Commit](https://bitbucket.org/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc)
### SDFormat 1.4.7 (2013-08-22)
1. Direct console messages to std_err
* [Pull request 44](https://bitbucket.org/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err)
### SDFormat 1.4.6 (2013-08-20)
1. Add tags for GPS sensor and sensor noise
* [Pull request 36](https://bitbucket.org/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical)
1. Add tags for wireless transmitter/receiver models
* [Pull request 34](https://bitbucket.org/osrf/sdformat/pull-request/34/transceiver-support)
* [Pull request 43](https://bitbucket.org/osrf/sdformat/pull-request/43/updated-description-of-the-transceiver-sdf)
1. Add tags for playback of audio files in Gazebo
* [Pull request 26](https://bitbucket.org/osrf/sdformat/pull-request/26/added-audio-tags)
* [Pull request 35](https://bitbucket.org/osrf/sdformat/pull-request/35/move-audio-to-link-and-playback-on-contact)
1. Add tags for simbody physics parameters
* [Pull request 32](https://bitbucket.org/osrf/sdformat/pull-request/32/merging-some-updates-from-simbody-branch)
1. Log messages to a file, reduce console output
* [Pull request 33](https://bitbucket.org/osrf/sdformat/pull-request/33/log-messages-to-file-8)
1. Generalize ode's <provide_feedback> element
* [Pull request 38](https://bitbucket.org/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint)
1. Various bug, style and test fixes
### SDFormat 1.4.5 (2013-07-23)
1. Deprecated Gazebo's internal SDF code
1. Use templatized Get functions for retrieving values from SDF files
1. Removed dependency on ROS

View File

@ -0,0 +1,46 @@
# Installation on Windows
This documentation describes how to set up a workspace for trying to compile sdformat on Windows.
## Supported compilers
At this moment, compilation has been tested on Windows 7 and 8.1 and is supported
when using Visual Studio 2013. Patches for other versions are welcome.
## Installation
Totally experimental, using pre-compiled binaries in a local workspace. To
make things easier, use a MinGW shell for your editing work, and only use the
Windows `cmd` for configuring and building.
1. Make a directory to work in, e.g.:
mkdir sdformat-ws
cd sdformat-ws
1. Download boost into that directory:
- [boost 1.56.0](http://packages.osrfoundation.org/win32/deps/boost_1_56_0.zip)
1. Unzip it in sdformat-ws.
1. Clone sdformat
hg clone https://bitbucket.org/osrf/sdformat
1. Load your compiler setup, e.g. (note that we are asking for the 64-bit toolchain here):
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
1. Configure and build sdformat:
cd sdformat
mkdir build
cd build
..\configure
nmake
nmake install
You should now have an installation of sdformat in sdformat-ws/sdformat/build/install/Release.
Once this all works (which it does with tender love and care): you should now have an installation of sdformat in sdformat-ws/sdformat/build/install/Release.

15
sdformat_for_mpi/LICENSE Normal file
View File

@ -0,0 +1,15 @@
Software License Agreement (Apache License)
Copyright 2012 Open Source Robotics Foundation
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.

View File

@ -0,0 +1,116 @@
# Migration Guide for SDF Protocol
This document contains information about migrating
between different versions of the SDF protocol.
The SDF protocol version number is specified in the `version` attribute
of the `sdf` element (1.4, 1.5, 1.6, etc.)
and is distinct from sdformat library version
(2.3, 3.0, 4.0, etc.).
# Note on backward compatibility
There are `*.convert` files that allow old sdf files to be migrated
forward programmatically.
This document aims to contain similar information to those files
but with improved human-readability..
## SDFormat 3.x to 4.x
### Additions
1. **New SDF protocol version 1.6**
+ Details about the 1.5 to 1.6 transition are explained below in this same
document
### Modifications
1. **Boost pointers and boost::function**
+ All boost pointers, boost::function in the public API have been replaced
by their std:: equivalents (C++11 standard)
1. **`gravity` and `magnetic_field` elements are moved from `physics` to `world`**
+ In physics element: gravity and magnetic_field tags have been moved
from Physics to World element.
+ [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247)
+ [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090)
1. **New noise for IMU**
+ A new style for representing the noise properties of an `imu` was implemented
in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199)
for sdf 1.5 and the old style was declared as deprecated.
The old style has been removed from sdf 1.6 with the conversion script
updating to the new style.
+ [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199)
+ [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243)
+ [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244)
1. **Lump:: prefix in link names**
+ Changed to \_fixed_joint_lump__ to avoid confusion with scoped names
+ [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245)
## SDF protocol 1.5 to 1.6
### Additions
1. **link.sdf** `enable_wind` element
+ description: If true, the link is affected by the wind
+ type: bool
+ default: false
+ required: 0
+ [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240)
1. **link.sdf** `light` element
+ included from `light.sdf` with required="*",
so a link can have any number of attached lights.
+ [pull request 373](https://bitbucket.org/osrf/sdformat/pull-requests/373)
1. **model.sdf** `enable_wind` element
+ description: If set to true, all links in the model will be affected by
the wind. Can be overriden by the link wind property.
+ type: bool
+ default: false
+ required: 0
+ [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240)
1. **model_state.sdf** `scale` element
+ description: Scale for the 3 dimensions of the model.
+ type: vector3
+ default: "1 1 1"
+ required: 0
+ [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246)
1. **physics.sdf** `island_threads` element under `ode::solver`
+ description: Number of threads to use for "islands" of disconnected models.
+ type: int
+ default: 0
+ required: 0
+ [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380)
1. **physics.sdf** `thread_position_correction` element under `ode::solver`
+ description: Flag to use threading to speed up position correction computation.
+ type: bool
+ default: 0
+ required: 0
+ [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380)
1. **state.sdf** allow `light` tags within `insertions` element
* [pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325)
1. **surface.sdf** `category_bitmask` element
+ description: Bitmask for category of collision filtering.
Collision happens if `((category1 & collision2) | (category2 & collision1))` is not zero.
If not specified, the category_bitmask should be interpreted as being the same as collide_bitmask.
+ type: unsigned int
+ default: 65535
+ required: 0
+ [pull request 318](https://bitbucket.org/osrf/sdformat/pull-requests/318)
1. **world.sdf** `wind` element
+ description: The wind tag specifies the type and properties of the wind.
+ required: 0
+ [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240)
1. **world.sdf** `wind::linear_velocity` element
+ description: Linear velocity of the wind.
+ type: vector3
+ default: "0 0 0"
+ required: 0
+ [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240)

0
sdformat_for_mpi/NEWS Normal file
View File

36
sdformat_for_mpi/README Normal file
View File

@ -0,0 +1,36 @@
sdformat - Simulation Description Format (SDF) parser
-----------------------------------------------------
SDF is an XML file format that describes environments, objects, and robots
in a manner suitable for robotic applications. SDF is capable of representing
and describing different physic engines, lighting properties, terrain, static
or dynamic objects, and articulated robots with various sensors, and acutators.
The format of SDF is also described by XML, which facilitates updates and
allows conversion from previous versions. A parser is also contained within
this package that reads SDF files and returns a C++ interface.
http://sdformat.org
Installation
------------
Standard installation can be performed in UNIX systems using the following
steps:
- mkdir build/
- cd build/
- cmake ..
- sudo make install
sdformat supported cmake parameters at configuring time:
- USE_EXTERNAL_URDF (bool) [default False]
Do not use the internal copy of urdfdom and use the one installed in the
system instead. Recommended if you have a working installation of urdfdom.
- USE_UPSTREAM_CFLAGS (bool) [default True]
Use the sdformat team compilation flags instead of the common set defined
by cmake.
Uninstallation
--------------
To uninstall the software installed with the previous steps:
- cd build/
- sudo make uninstall

View File

@ -0,0 +1,132 @@
#
# 2012-01-31, Lars Bilke
# - Enable Code Coverage
#
# 2013-09-17, Joakim Söderberg
# - Added support for Clang.
# - Some additional usage instructions.
#
# USAGE:
# 1. Copy this file into your cmake modules path.
#
# 2. Add the following line to your CMakeLists.txt:
# INCLUDE(CodeCoverage)
#
# 3. Set compiler flags to turn off optimization and enable coverage:
# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
#
# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
# which runs your test executable and produces a lcov code coverage report:
# Example:
# SETUP_TARGET_FOR_COVERAGE(
# my_coverage_target # Name for custom target.
# test_driver # Name of the test driver executable that runs the tests.
# # NOTE! This should always have a ZERO as exit code
# # otherwise the coverage generation will not complete.
# coverage # Name of output directory.
# )
#
# 4. Build a Debug build:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
#
#
# Check prereqs
FIND_PROGRAM( GCOV_PATH gcov )
FIND_PROGRAM( LCOV_PATH lcov )
FIND_PROGRAM( GREP_PATH grep )
FIND_PROGRAM( GENHTML_PATH genhtml )
FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
IF(NOT GCOV_PATH)
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
ENDIF() # NOT GCOV_PATH
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
# Clang version 3.0.0 and greater now supports gcov as well.
MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")
IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF()
ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
SET(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 --coverage -fprofile-arcs -ftest-coverage"
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE )
SET(CMAKE_C_FLAGS_COVERAGE
"-g -O0 --coverage -fprofile-arcs -ftest-coverage"
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE )
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE )
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
IF ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage"))
MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" )
ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests.
# MUST return ZERO always, even on errors.
# If not, no coverage report will be created!
# Param _outputname lcov output is generated as _outputname.info
# HTML report is generated in _outputname/index.html
# Optional fourth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
IF(NOT LCOV_PATH)
MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
ENDIF() # NOT LCOV_PATH
IF(NOT GENHTML_PATH)
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
ENDIF() # NOT GENHTML_PATH
IF(NOT GREP_PATH)
MESSAGE(FATAL_ERROR "grep not found! Run code coverage on linux or mac.")
ENDIF()
# Setup target
ADD_CUSTOM_TARGET(${_targetname}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} -q --no-checksum --directory ${PROJECT_BINARY_DIR}
--capture --output-file ${_outputname}.info 2>/dev/null
COMMAND ${LCOV_PATH} -q --remove ${_outputname}.info
'test/*' '/usr/*' '*_TEST*' --output-file ${_outputname}.info.cleaned
COMMAND ${GENHTML_PATH} -q --legend -o ${_outputname}
${_outputname}.info.cleaned
COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "lines" | cut -d ' ' -f 4 | cut -d '%' -f 1 > coverage/lines.txt
COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "functions" | cut -d ' ' -f 4 | cut -d '%' -f 1 > coverage/functions.txt
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info
${_outputname}.info.cleaned
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\n"
"Processing code coverage counters and generating report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND COMMAND ${LCOV_PATH} -q --zerocounters --directory ${PROJECT_BINARY_DIR};
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE

View File

@ -0,0 +1,77 @@
# Build type link flags
set (CMAKE_LINK_FLAGS_RELEASE " " CACHE INTERNAL "Link flags for release" FORCE)
set (CMAKE_LINK_FLAGS_RELWITHDEBINFO " " CACHE INTERNAL "Link flags for release with debug support" FORCE)
set (CMAKE_LINK_FLAGS_DEBUG " " CACHE INTERNAL "Link flags for debug" FORCE)
set (CMAKE_LINK_FLAGS_PROFILE " -pg" CACHE INTERNAL "Link flags for profile" FORCE)
set (CMAKE_LINK_FLAGS_COVERAGE " --coverage" CACHE INTERNAL "Link flags for static code coverage" FORCE)
set (CMAKE_C_FLAGS_RELEASE "")
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT MSVC)
# -s doesn't work with clang or Visual Studio, see alternative in link below:
# http://stackoverflow.com/questions/6085491/gcc-vs-clang-symbol-strippingu
set (CMAKE_C_FLAGS_RELEASE "-s")
endif()
if (NOT MSVC)
set (CMAKE_C_FLAGS_RELEASE " ${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
set (CMAKE_C_FLAGS_RELWITHDEBINFO " -g -O2 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release with debug support" FORCE)
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
set (CMAKE_C_FLAGS_DEBUG " -ggdb3 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for debug" FORCE)
set (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set (CMAKE_C_FLAGS_PROFILE " -fno-omit-frame-pointer -g -pg ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for profile" FORCE)
set (CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})
set (CMAKE_C_FLAGS_COVERAGE " -g -O0 -Wformat=2 --coverage -fno-inline ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for static code coverage" FORCE)
set (CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}")
foreach(flag
-fno-default-inline
-fno-elide-constructors
-fno-implicit-inline-templates)
CHECK_CXX_COMPILER_FLAG(${flag} R${flag})
if (R${flag})
set (CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} ${flag}")
endif()
endforeach()
endif()
#####################################
# Set all the global build flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
# Visual Studio enables c++11 support by default
if (NOT MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}} -std=c++11")
endif()
if (UNIX)
# Add visibility in UNIX
check_gcc_visibility()
if (GCC_SUPPORTS_VISIBILITY)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
endif()
# Compiler-specific C++11 activation.
if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "GNU ")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (NOT (GCC_VERSION VERSION_GREATER 4.7))
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.8 or greater.")
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
elseif ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC ")
if (MSVC_VERSION LESS 1800)
message(FATAL_ERROR "${PROJECT_NAME} requires VS 2013 or greater.")
endif()
else ()
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif ()

View File

@ -0,0 +1,45 @@
# Check the OS type.
# CMake does not distinguish Linux from other Unices.
STRING (REGEX MATCH "Linux" PLAYER_OS_LINUX ${CMAKE_SYSTEM_NAME})
# Nor *BSD
STRING (REGEX MATCH "BSD" PLAYER_OS_BSD ${CMAKE_SYSTEM_NAME})
# Or Solaris. I'm seeing a trend, here
STRING (REGEX MATCH "SunOS" PLAYER_OS_SOLARIS ${CMAKE_SYSTEM_NAME})
# Windows is easy (for once)
IF (WIN32)
SET (PLAYER_OS_WIN TRUE BOOL INTERNAL)
ENDIF (WIN32)
# Check if it's an Apple OS
IF (APPLE)
# Check if it's OS X or another MacOS (that's got to be pretty unlikely)
STRING (REGEX MATCH "Darwin" PLAYER_OS_OSX ${CMAKE_SYSTEM_NAME})
IF (NOT PLAYER_OS_OSX)
SET (PLAYER_OS_MACOS TRUE BOOL INTERNAL)
ENDIF (NOT PLAYER_OS_OSX)
ENDIF (APPLE)
# QNX
IF (QNXNTO)
SET (PLAYER_OS_QNX TRUE BOOL INTERNAL)
ENDIF (QNXNTO)
IF (PLAYER_OS_LINUX)
MESSAGE (STATUS "Operating system is Linux")
ELSEIF (PLAYER_OS_BSD)
MESSAGE (STATUS "Operating system is BSD")
ELSEIF (PLAYER_OS_WIN)
MESSAGE (STATUS "Operating system is Windows")
ELSEIF (PLAYER_OS_OSX)
MESSAGE (STATUS "Operating system is Apple MacOS X")
ELSEIF (PLAYER_OS_MACOS)
MESSAGE (STATUS "Operating system is Apple MacOS (not OS X)")
ELSEIF (PLAYER_OS_QNX)
MESSAGE (STATUS "Operating system is QNX")
ELSEIF (PLAYER_OS_SOLARIS)
MESSAGE (STATUS "Operating system is Solaris")
ELSE (PLAYER_OS_LINUX)
MESSAGE (STATUS "Operating system is generic Unix")
ENDIF (PLAYER_OS_LINUX)

View File

@ -0,0 +1,115 @@
# Check if SSE instructions are available on the machine where
# the project is compiled.
IF (ARCH MATCHES "i386" OR ARCH MATCHES "x86_64")
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
IF (SSE2_TRUE)
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
ELSE (SSE2_TRUE)
set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
ENDIF (SSE2_TRUE)
# /proc/cpuinfo apparently omits sse3 :(
STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE)
IF (NOT SSE3_TRUE)
STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE)
ENDIF (NOT SSE3_TRUE)
STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE)
IF (SSE3_TRUE OR SSSE3_TRUE)
set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
ELSE (SSE3_TRUE OR SSSE3_TRUE)
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
ENDIF (SSE3_TRUE OR SSSE3_TRUE)
IF (SSSE3_TRUE)
set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
ELSE (SSSE3_TRUE)
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
ENDIF (SSSE3_TRUE)
STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE)
IF (SSE41_TRUE)
set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
ELSE (SSE41_TRUE)
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
ENDIF (SSE41_TRUE)
STRING(REGEX REPLACE "^.*(sse4_2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse4_2" "${SSE_THERE}" SSE42_TRUE)
IF (SSE42_TRUE)
set(SSE4_2_FOUND true CACHE BOOL "SSE4.2 available on host")
ELSE (SSE42_TRUE)
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
ENDIF (SSE42_TRUE)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
CPUINFO)
STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE)
IF (SSE2_TRUE)
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
ELSE (SSE2_TRUE)
set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
ENDIF (SSE2_TRUE)
STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE)
IF (SSE3_TRUE)
set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
ELSE (SSE3_TRUE)
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
ENDIF (SSE3_TRUE)
STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE)
IF (SSSE3_TRUE)
set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
ELSE (SSSE3_TRUE)
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
ENDIF (SSSE3_TRUE)
STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE)
IF (SSE41_TRUE)
set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
ELSE (SSE41_TRUE)
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
ENDIF (SSE41_TRUE)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
# TODO
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
ENDIF(ARCH MATCHES "i386" OR ARCH MATCHES "x86_64")
if(NOT SSE2_FOUND)
MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.")
endif(NOT SSE2_FOUND)
if(NOT SSE3_FOUND)
MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.")
endif(NOT SSE3_FOUND)
if(NOT SSSE3_FOUND)
MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.")
endif(NOT SSSE3_FOUND)
if(NOT SSE4_1_FOUND)
MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.")
endif(NOT SSE4_1_FOUND)
mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND)

View File

@ -0,0 +1,27 @@
include (${project_cmake_dir}/FindSSE.cmake)
if (SSE2_FOUND)
set (CMAKE_C_FLAGS_ALL "-msse -msse2 ${CMAKE_C_FLAGS_ALL}")
if (NOT APPLE)
set (CMAKE_C_FLAGS_ALL "-mfpmath=sse ${CMAKE_C_FLAGS_ALL}")
endif()
endif()
if (SSE3_FOUND)
set (CMAKE_C_FLAGS_ALL "-msse3 ${CMAKE_C_FLAGS_ALL}")
endif()
if (SSSE3_FOUND)
set (CMAKE_C_FLAGS_ALL "-mssse3 ${CMAKE_C_FLAGS_ALL}")
endif()
if (SSE4_1_FOUND OR SSE4_2_FOUND)
if (SSE4_1_FOUND)
set (CMAKE_C_FLAGS_ALL "-msse4.1 ${CMAKE_C_FLAGS_ALL}")
endif()
if (SSE4_2_FOUND)
set (CMAKE_C_FLAGS_ALL "-msse4.2 ${CMAKE_C_FLAGS_ALL}")
endif()
else()
message(STATUS "\nSSE4 disabled.\n")
endif()

View File

@ -0,0 +1,278 @@
################################################################################
#APPEND_TO_CACHED_STRING(_string _cacheDesc [items...])
# Appends items to a cached list.
MACRO (APPEND_TO_CACHED_STRING _string _cacheDesc)
FOREACH (newItem ${ARGN})
SET (${_string} "${${_string}} ${newItem}" CACHE INTERNAL ${_cacheDesc} FORCE)
ENDFOREACH (newItem ${ARGN})
#STRING(STRIP ${${_string}} ${_string})
ENDMACRO (APPEND_TO_CACHED_STRING)
################################################################################
# APPEND_TO_CACHED_LIST (_list _cacheDesc [items...]
# Appends items to a cached list.
MACRO (APPEND_TO_CACHED_LIST _list _cacheDesc)
SET (tempList ${${_list}})
FOREACH (newItem ${ARGN})
LIST (APPEND tempList ${newItem})
ENDFOREACH (newItem ${newItem})
SET (${_list} ${tempList} CACHE INTERNAL ${_cacheDesc} FORCE)
ENDMACRO(APPEND_TO_CACHED_LIST)
#################################################
# Macro to turn a list into a string (why doesn't CMake have this built-in?)
MACRO (LIST_TO_STRING _string _list)
SET (${_string})
FOREACH (_item ${_list})
SET (${_string} "${${_string}} ${_item}")
ENDFOREACH (_item)
#STRING(STRIP ${${_string}} ${_string})
ENDMACRO (LIST_TO_STRING)
#################################################
# BUILD ERROR macro
macro (BUILD_ERROR)
foreach (str ${ARGN})
SET (msg "\t${str}")
MESSAGE (STATUS ${msg})
APPEND_TO_CACHED_LIST(build_errors "build errors" ${msg})
endforeach ()
endmacro (BUILD_ERROR)
#################################################
# BUILD WARNING macro
macro (BUILD_WARNING)
foreach (str ${ARGN})
SET (msg "\t${str}" )
MESSAGE (STATUS ${msg} )
APPEND_TO_CACHED_LIST(build_warnings "build warning" ${msg})
endforeach (str ${ARGN})
endmacro (BUILD_WARNING)
#################################################
macro (sdf_add_library _name)
set(LIBS_DESTINATION ${PROJECT_BINARY_DIR}/src)
set_source_files_properties(${ARGN} PROPERTIES COMPILE_DEFINITIONS "BUILDING_DLL")
add_library(${_name} SHARED ${ARGN})
target_link_libraries (${_name} ${general_libraries})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBS_DESTINATION})
if (MSVC)
set_target_properties( ${_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${LIBS_DESTINATION})
set_target_properties( ${_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIBS_DESTINATION})
set_target_properties( ${_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIBS_DESTINATION})
endif ()
endmacro ()
#################################################
macro (sdf_add_executable _name)
add_executable(${_name} ${ARGN})
target_link_libraries (${_name} ${general_libraries})
endmacro ()
#################################################
macro (sdf_install_includes _subdir)
install(FILES ${ARGN} DESTINATION ${INCLUDE_INSTALL_DIR}/${_subdir} COMPONENT headers)
endmacro()
#################################################
macro (sdf_install_library _name)
set_target_properties(${_name} PROPERTIES SOVERSION ${SDF_MAJOR_VERSION} VERSION ${SDF_VERSION_FULL})
install (TARGETS ${_name} DESTINATION ${LIB_INSTALL_DIR} COMPONENT shlib)
endmacro ()
#################################################
macro (sdf_install_executable _name)
set_target_properties(${_name} PROPERTIES VERSION ${SDF_VERSION_FULL})
install (TARGETS ${_name} DESTINATION ${BIN_INSTALL_DIR})
endmacro ()
#################################################
macro (sdf_setup_unix)
endmacro()
#################################################
macro (sdf_setup_windows)
# Need for M_PI constant
add_definitions(-D_USE_MATH_DEFINES -DWINDOWS_LEAN_AND_MEAN)
# Suppress warnings caused by boost
add_definitions(/wd4512 /wd4996)
# Use dynamic linking for boost
add_definitions(-DBOOST_ALL_DYN_LINK)
# And force linking to MSVC dynamic runtime
set(CMAKE_C_FLAGS_DEBUG "/MDd ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "/MD ${CMAKE_C_FLAGS_RELEASE}")
if (MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
# Not need if proper cmake gnerator (-G "...Win64") is passed to cmake
# Enable as a second measeure to workaround over bug
# http://www.cmake.org/Bug/print_bug_page.php?bug_id=11240
set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64")
endif()
endmacro()
#################################################
macro (sdf_setup_apple)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
endmacro()
#################################################
include_directories(${PROJECT_SOURCE_DIR}/test/gtest/include)
macro (sdf_build_tests)
# Build all the tests
foreach(GTEST_SOURCE_file ${ARGN})
string(REGEX REPLACE ".cc" "" BINARY_NAME ${GTEST_SOURCE_file})
set(BINARY_NAME ${TEST_TYPE}_${BINARY_NAME})
if (UNIX)
add_executable(${BINARY_NAME} ${GTEST_SOURCE_file})
elseif(WIN32)
add_executable(${BINARY_NAME}
${GTEST_SOURCE_file}
${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinystr.cpp
${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxmlerror.cpp
${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxml.cpp
${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxmlparser.cpp
)
else()
message(FATAL_ERROR "Unsupported platform")
endif()
add_dependencies(${BINARY_NAME}
gtest gtest_main sdformat
)
link_directories(${IGNITION-MATH_LIBRARY_DIRS})
if (UNIX)
target_link_libraries(${BINARY_NAME}
libgtest.a
libgtest_main.a
sdformat
pthread
${tinyxml_LIBRARIES}
${IGNITION-MATH_LIBRARIES}
)
elseif(WIN32)
target_link_libraries(${BINARY_NAME}
gtest.lib
gtest_main.lib
sdformat.dll
${IGNITION-MATH_LIBRARIES}
${Boost_LIBRARIES}
)
# Copy in sdformat library
add_custom_command(TARGET ${BINARY_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:sdformat>
$<TARGET_FILE_DIR:${BINARY_NAME}> VERBATIM)
# Copy in ignition-math library
add_custom_command(TARGET ${BINARY_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${IGNITION-MATH_LIBRARY_DIRS}/${IGNITION-MATH_LIBRARIES}.dll"
$<TARGET_FILE_DIR:${BINARY_NAME}> VERBATIM)
# Copy in boost libraries
foreach(lib ${Boost_LIBRARIES})
if (EXISTS ${lib})
add_custom_command(TARGET ${BINARY_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${lib}"
$<TARGET_FILE_DIR:${BINARY_NAME}> VERBATIM)
string(REPLACE ".lib" ".dll" dll ${lib})
if (EXISTS ${dll})
add_custom_command(TARGET ${BINARY_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${dll}"
$<TARGET_FILE_DIR:${BINARY_NAME}> VERBATIM)
endif()
# Check if there is a .dll in the /bin/ directory, sibling of /lib/
# This is the structure used by vcpkg boost port
string(REPLACE "/lib/" "/bin/" alt_dll ${dll})
if (EXISTS ${alt_dll})
add_custom_command(TARGET ${BINARY_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${alt_dll}"
$<TARGET_FILE_DIR:${BINARY_NAME}> VERBATIM)
endif()
endif()
endforeach()
endif()
add_test(${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
--gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
set (_env_vars)
set (sdf_paths)
# Get all the sdf protocol directory names
file(GLOB dirs RELATIVE "${PROJECT_SOURCE_DIR}/sdf"
"${PROJECT_SOURCE_DIR}/sdf/*")
list(SORT dirs)
# Add each sdf protocol to the sdf_path variable
foreach(dir ${dirs})
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/sdf/${dir})
set(sdf_paths "${PROJECT_SOURCE_DIR}/sdf/${dir}:${sdf_paths}")
endif()
endforeach()
# Set the SDF_PATH environment variable
list(APPEND _env_vars "SDF_PATH=${sdf_paths}")
set_tests_properties(${BINARY_NAME} PROPERTIES
TIMEOUT 240
ENVIRONMENT "${_env_vars}")
if(PYTHONINTERP_FOUND)
# Check that the test produced a result and create a failure if it didn't.
# Guards against crashed and timed out tests.
add_test(check_${BINARY_NAME} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/check_test_ran.py
${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
endif()
if(SDFORMAT_RUN_VALGRIND_TESTS AND VALGRIND_PROGRAM)
add_test(memcheck_${BINARY_NAME} ${VALGRIND_PROGRAM} --leak-check=full
--error-exitcode=1 --show-leak-kinds=all ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME})
endif()
endforeach()
endmacro()
#################################################
# Macro to setup supported compiler warnings
# Based on work of Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST.
include(CheckCXXCompilerFlag)
macro(filter_valid_compiler_warnings)
foreach(flag ${ARGN})
CHECK_CXX_COMPILER_FLAG(${flag} R${flag})
if(${R${flag}})
set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} ${flag}")
endif()
endforeach()
endmacro()
#################################################
# Copied from catkin/cmake/empy.cmake
function(find_python_module module)
# cribbed from http://www.cmake.org/pipermail/cmake/2011-January/041666.html
string(TOUPPER ${module} module_upper)
if(NOT PY_${module_upper})
if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
set(${module}_FIND_REQUIRED TRUE)
endif()
# A module's location is usually a directory, but for
# binary modules
# it's a .so file.
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
RESULT_VARIABLE _${module}_status
OUTPUT_VARIABLE _${module}_location
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _${module}_status)
set(PY_${module_upper} ${_${module}_location} CACHE STRING "Location of Python module ${module}")
endif(NOT _${module}_status)
endif(NOT PY_${module_upper})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper})
endfunction(find_python_module)

View File

@ -0,0 +1,142 @@
include (${sdf_cmake_dir}/FindOS.cmake)
include (FindPkgConfig)
# Detect the architecture
include (${project_cmake_dir}/TargetArch.cmake)
target_architecture(ARCH)
message(STATUS "Building for arch: ${ARCH}")
########################################
# Find Boost, if not specified manually
if (WIN32)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
endif()
include(FindBoost)
find_package(Boost ${MIN_BOOST_VERSION} REQUIRED system filesystem program_options regex iostreams)
if (NOT Boost_FOUND)
set (BUILD_SDF OFF CACHE INTERNAL "Build SDF" FORCE)
BUILD_ERROR ("Boost not found. Please install thread signals system filesystem program_options regex boost version ${MIN_BOOST_VERSION} or higher.")
endif()
if (USE_EXTERNAL_TINYXML)
#################################################
# Find tinyxml. Only debian distributions package tinyxml with a pkg-config
# Use pkg_check_modules and fallback to manual detection (needed, at least, for MacOS)
pkg_check_modules(tinyxml tinyxml)
if (NOT tinyxml_FOUND)
find_path (tinyxml_include_dirs tinyxml.h ${tinyxml_include_dirs} ENV CPATH)
find_library(tinyxml_LIBRARIES NAMES tinyxml)
set (tinyxml_FAIL False)
if (NOT tinyxml_include_dirs)
message (STATUS "Looking for tinyxml headers - not found")
set (tinyxml_FAIL True)
endif()
if (NOT tinyxml_LIBRARIES)
message (STATUS "Looking for tinyxml library - not found")
set (tinyxml_FAIL True)
endif()
endif()
if (tinyxml_FAIL)
message (STATUS "Looking for tinyxml.h - not found")
BUILD_ERROR("Missing: tinyxml")
endif()
else()
# Needed in WIN32 since in UNIX the flag is added in the code installed
add_definitions(-DTIXML_USE_STL)
include_directories (${PROJECT_SOURCE_DIR}/src/win/tinyxml)
set (tinyxml_LIBRARIES "tinyxml")
set (tinyxml_LIBRARY_DIRS "")
endif()
################################################
# Find urdfdom parser
if (USE_EXTERNAL_URDF)
if (NOT PKG_CONFIG_FOUND)
BUILD_ERROR ("pkgconfig not found. Please install to so USE_EXTERNAL_URDF can found the urdf library")
else()
# check for urdfdom with pkg-config
pkg_check_modules(URDF urdfdom>=0.3)
if (NOT URDF_FOUND)
# version >= 0.3.x not found, check for urdfdom again with no version
# restriction.
pkg_check_modules(URDF urdfdom)
if (NOT URDF_FOUND)
BUILD_ERROR ("URDF library not found. Please install it to use with USE_EXTERNAL_URDF or set this flag to false to use internal URDF code")
else()
# urdfdom library found < 0.3, unset flag
set (URDF_GE_0P3 FALSE)
endif()
else()
# urdfdom library found >= 0.3, set flag
set (URDF_GE_0P3 TRUE)
endif()
# what am I doing here? pkg-config and cmake
set(URDF_INCLUDE_DIRS ${URDF_INCLUDEDIR})
set(URDF_LIBRARY_DIRS ${URDF_LIBDIR})
endif()
else()
# the internal copy is currently 0.3.0
set (URDF_GE_0P3 TRUE)
endif()
################################################
# Find the Python interpreter for running the
# check_test_ran.py script
find_package(PythonInterp QUIET)
################################################
# Find psutil python package for memory tests
find_python_module(psutil)
if(NOT PY_PSUTIL)
BUILD_WARNING("Python psutil package not found. Memory leak tests will be skipped")
endif()
################################################
# Find Valgrind for checking memory leaks in the
# tests
find_program(VALGRIND_PROGRAM NAMES valgrind PATH ${VALGRIND_ROOT}/bin)
option(SDFORMAT_RUN_VALGRIND_TESTS "Run sdformat tests with Valgrind" FALSE)
mark_as_advanced(SDFORMAT_RUN_VALGRIND_TESTS)
if (SDFORMAT_RUN_VALGRIND_TESTS AND NOT VALGRIND_PROGRAM)
BUILD_WARNING("valgrind not found. Memory check tests will be skipped.")
endif()
################################################
# Find ruby executable to produce xml schemas
find_program(RUBY ruby)
if (NOT RUBY)
BUILD_ERROR ("Ruby version 1.9 is needed to build xml schemas")
else()
message(STATUS "Found ruby executable: ${RUBY}")
endif()
#################################################
# Macro to check for visibility capability in compiler
# Original idea from: https://gitorious.org/ferric-cmake-stuff/
macro (check_gcc_visibility)
include (CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fvisibility=hidden GCC_SUPPORTS_VISIBILITY)
endmacro()
########################################
# Find ignition math
set(IGNITION-MATH_REQUIRED_MAJOR_VERSION 2)
if (NOT DEFINED IGNITION-MATH_LIBRARY_DIRS AND NOT DEFINED IGNITION-MATH_INCLUDE_DIRS AND NOT DEFINED IGNITION-MATH_LIBRARIES)
find_package(ignition-math${IGNITION-MATH_REQUIRED_MAJOR_VERSION} QUIET)
if (NOT ignition-math${IGNITION-MATH_REQUIRED_MAJOR_VERSION}_FOUND)
message(STATUS "Looking for ignition-math${IGNITION-MATH_REQUIRED_MAJOR_VERSION}-config.cmake - not found")
BUILD_ERROR ("Missing: Ignition math${IGNITION-MATH_REQUIRED_MAJOR_VERSION} library.")
else()
message(STATUS "Looking for ignition-math${IGNITION-MATH_REQUIRED_MAJOR_VERSION}-config.cmake - found")
endif()
endif()

View File

@ -0,0 +1,158 @@
# Copyright (c) 2012 Petroules Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer. Redistributions in binary
# form must reproduce the above copyright notice, this list of conditions and
# the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
#if defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
|| defined(__ARM_ARCH_6T2__) \\
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
#error cmake_ARCH armv5
#else
#error cmake_ARCH arm
#endif
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|| defined(_M_MPPC) || defined(_M_PPC)
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
#error cmake_ARCH ppc64
#else
#error cmake_ARCH ppc
#endif
#endif
#error cmake_ARCH unknown
")
# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple
function(target_architecture output_var)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
# First let's normalize the order of the values
# Note that it's not possible to compile PowerPC applications if you are using
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
# disable it by default
# See this page for more information:
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()
# Now add all the architectures in our normalized order
if(osx_arch_ppc)
list(APPEND ARCH ppc)
endif()
if(osx_arch_i386)
list(APPEND ARCH i386)
endif()
if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
enable_language(C)
# Detect the architecture in a rather creative way...
# This compiles a small C program which is a series of ifdefs that selects a
# particular #error preprocessor directive whose message string contains the
# target architecture. The program will always fail to compile (both because
# file is not a valid C program, and obviously because of the presence of the
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/arch.c"
COMPILE_OUTPUT_VARIABLE ARCH
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)
# Parse the architecture name from the compiler output
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
# Get rid of the value marker leaving just the architecture name
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
# If we are compiling with an unknown architecture this variable should
# already be set to "unknown" but in the case that it's empty (i.e. due
# to a typo in the code), then set it to unknown
if (NOT ARCH)
set(ARCH unknown)
endif()
endif()
set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

View File

@ -0,0 +1,23 @@
set(CPACK_PACKAGE_NAME "@PROJECT_NAME@")
set(CPACK_PACKAGE_VENDOR "sdformat.org")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scene Description Format (SDF)")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "@PROJECT_NAME_LOWER@")
set(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_CURRENT_SOURCE_DIR@/LICENSE")
set(CPACK_RESOURCE_FILE_README "@CMAKE_CURRENT_SOURCE_DIR@/README")
set(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_CURRENT_SOURCE_DIR@/README")
set(CPACK_PACKAGE_MAINTAINER "Nate Koenig <nate@osrfoundation.org>")
set(CPACK_PACKAGE_CONTACT "Nate Koenig <nate@osrfoundation.org>")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "@DPKG_ARCH@")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "@DEBIAN_PACKAGE_DEPENDS@")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Format and parser for scene description files.")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "@DPKG_ARCH@")
set(CPACK_RPM_PACKAGE_REQUIRES "@DEBIAN_PACKAGE_DEPENDS@")
set(CPACK_RPM_PACKAGE_DESCRIPTION "Format and parser for scene description files.")
set (CPACK_PACKAGE_FILE_NAME "@PROJECT_NAME_LOWER@-@SDF_VERSION_FULL@")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "@PROJECT_NAME_LOWER@-@SDF_VERSION_FULL@")

View File

@ -0,0 +1,37 @@
if (@PKG_NAME@_CONFIG_INCLUDED)
return()
endif()
set(@PKG_NAME@_CONFIG_INCLUDED TRUE)
list(APPEND @PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include/sdformat-@SDF_VERSION@")
list(APPEND @PKG_NAME@_CFLAGS "-I@CMAKE_INSTALL_PREFIX@/include/sdformat-@SDF_VERSION@")
if (NOT WIN32)
list(APPEND @PKG_NAME@_CXX_FLAGS "${@PKG_NAME@_CFLAGS} -std=c++11")
endif()
list(APPEND @PKG_NAME@_LIBRARY_DIRS "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@")
foreach(lib @PKG_LIBRARIES@)
set(onelib "${lib}-NOTFOUND")
find_library(onelib ${lib}
PATHS "@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@"
NO_DEFAULT_PATH
)
if(NOT onelib)
message(FATAL_ERROR "Library '${lib}' in package @PKG_NAME@ is not installed properly")
endif()
list(APPEND @PKG_NAME@_LIBRARIES "${onelib}")
endforeach()
find_package(ignition-math@IGNITION-MATH_REQUIRED_MAJOR_VERSION@)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${IGNITION-MATH_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${IGNITION-MATH_LIBRARIES})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${IGNITION-MATH_LIBRARY_DIRS})
find_package(Boost)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${Boost_LIBRARIES})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LDFLAGS "-L@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@")

View File

@ -0,0 +1,32 @@
/* config.h. Generated by CMake for @PROJECT_NAME@. */
/* Protocol version */
#define SDF_PROTOCOL_VERSION "${SDF_PROTOCOL_VERSION}"
/* \deprecated SDF_VERSION is deprecated. Please
* use SDF_PROTOCOL_VERSION or SDF_PKG_VERSION
*
* SDF_VERSION is here to keep backwards compatibility. It was used
* when the package version and protocol version were the same
*/
#define SDF_VERSION "${SDF_PROTOCOL_VERSION}"
/* Package version number */
#define SDF_MAJOR_VERSION ${SDF_MAJOR_VERSION}
#define SDF_MINOR_VERSION ${SDF_MINOR_VERSION}
#define SDF_PATCH_VERSION ${SDF_PATCH_VERSION}
#define SDF_PKG_VERSION "${SDF_VERSION}"
#define SDF_VERSION_FULL "${SDF_VERSION_FULL}"
#define SDF_VERSION_NAME ${SDF_VERSION_NAME}
#define SDF_VERSION_HEADER "Simulation Description Format (SDF), version ${SDF_PROTOCOL_VERSION}\nCopyright (C) 2014 Open Source Robotics Foundation.\nReleased under the Apache 2 License.\nhttp://gazebosim.org/sdf\n\n"
#cmakedefine BUILD_TYPE_PROFILE 1
#cmakedefine BUILD_TYPE_DEBUG 1
#cmakedefine BUILD_TYPE_RELEASE 1
#cmakedefine HAVE_URDFDOM 1
#cmakedefine USE_EXTERNAL_URDF 1
#cmakedefine URDF_GE_0P3 1
#define SDF_SHARE_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/"
#define SDF_VERSION_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat/${SDF_PKG_VERSION}"

View File

@ -0,0 +1,25 @@
################################################################################
#Find available package generators
# DEB
if ("${CMAKE_SYSTEM}" MATCHES "Linux")
find_program(DPKG_PROGRAM dpkg)
if (EXISTS ${DPKG_PROGRAM})
list (APPEND CPACK_GENERATOR "DEB")
endif(EXISTS ${DPKG_PROGRAM})
find_program(RPMBUILD_PROGRAM rpmbuild)
endif()
list (APPEND CPACK_SOURCE_GENERATOR "TBZ2")
list (APPEND CPACK_SOURCE_GENERATOR "ZIP")
list (APPEND CPACK_SOURCE_IGNORE_FILES ";TODO;/.hg/;.swp$;/build/")
include (InstallRequiredSystemLibraries)
#execute_process(COMMAND dpkg --print-architecture _NPROCE)
set (DEBIAN_PACKAGE_DEPENDS "libboost-all-dev, libtinyxml-dev")
set (RPM_PACKAGE_DEPENDS "libboost-all-dev, libtinyxml-dev")
set (SDF_CPACK_CFG_FILE "${PROJECT_BINARY_DIR}/cpack_options.cmake")

View File

@ -0,0 +1,10 @@
prefix="@CMAKE_INSTALL_PREFIX@"
libdir=${prefix}/@LIB_INSTALL_DIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: SDF
Description: Robot Modeling Language (SDF)
Version: @SDF_VERSION_FULL@
Requires: ignition-math@IGNITION-MATH_REQUIRED_MAJOR_VERSION@
Libs: -L${libdir} -lsdformat
CFlags: -I${includedir}/sdformat-@SDF_VERSION@ -std=c++11

View File

@ -0,0 +1,30 @@
#!/bin/sh
# Usage: Only an administrator of OSRF's amazon s3 bucket will be able to use
# this script.
#
# sh build/upload_doc.sh
# Check if the node was configured to use s3cmd
# This is done by running s3cmd --configure
if [ ! -f "${HOME}/.s3cfg" ]; then
echo "No $HOME/.s3cfg file found. Please config the software first in your system"
exit 1
fi
# Make documentation if not build
make doc
if [ ! -f "@CMAKE_BINARY_DIR@/doxygen/html/index.html" ]; then
echo "Documentation not present. Install doxygen, and run `make doc` in the build directory"
exit 1
fi
# The code API
s3cmd sync @CMAKE_BINARY_DIR@/doxygen/html/* s3://osrf-distributions/sdformat/api/@SDF_VERSION_FULL@/ --dry-run -v
echo -n "Upload code API(Y/n)? "
read ans
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
s3cmd sync @CMAKE_BINARY_DIR@/doxygen/html/* s3://osrf-distributions/sdformat/api/@SDF_VERSION_FULL@/ -v
fi

View File

@ -0,0 +1,12 @@
@set build_type=Release
@if not "%1"=="" set build_type=%1
@echo Configuring for build type %build_type%
cmake -G "NMake Makefiles"^
-DBOOST_ROOT:STRING="%cd%\..\..\boost_1_56_0"^
-DBOOST_LIBRARYDIR:STRING="%cd%\..\..\boost_1_56_0\lib64-msvc-12.0"^
-DCMAKE_INSTALL_PREFIX="install/%build_type%"^
-DIGNITION-MATH_INCLUDE_DIRS:STRING="%cd%\..\..\ign-math\build\install\%build_type%\include\ignition\math2"^
-DIGNITION-MATH_LIBRARY_DIRS:STRING="%cd%\..\..\ign-math\build\install\%build_type%\lib"^
-DIGNITION-MATH_LIBRARIES="ignition-math2"^
-DCMAKE_BUILD_TYPE="%build_type%" ..

View File

@ -0,0 +1,21 @@
find_package(Doxygen)
if (DOXYGEN_FOUND)
configure_file(${CMAKE_SOURCE_DIR}/doc/sdf.in
${CMAKE_BINARY_DIR}/sdf.dox @ONLY)
add_custom_target(doc
# Generate the API documentation
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/sdf.dox
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND cp ${CMAKE_SOURCE_DIR}/doc/sdf_logo.png
${CMAKE_BINARY_DIR}/doxygen/html
COMMAND cp ${CMAKE_SOURCE_DIR}/doc/search.js
${CMAKE_BINARY_DIR}/doxygen/html/search
COMMAND make -C ${CMAKE_BINARY_DIR}/doxygen/latex
COMMAND mv ${CMAKE_BINARY_DIR}/doxygen/latex/refman.pdf
${CMAKE_BINARY_DIR}/doxygen/latex/sdf-${SDF_VERSION_FULL}.pdf
COMMENT "Generating API documentation with Doxygen" VERBATIM)
endif()

View File

@ -0,0 +1,775 @@
/* The standard CSS for doxygen */
body, table, div, p, dl {
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
font-size: 12px;
}
/* @group Heading Levels */
h1 {
font-size: 150%;
}
h2 {
font-size: 120%;
}
h3 {
font-size: 100%;
}
dt {
font-weight: bold;
}
div.multicol {
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
-moz-column-count: 3;
-webkit-column-count: 3;
}
p.startli, p.startdd, p.starttd {
margin-top: 2px;
}
p.endli {
margin-bottom: 0px;
}
p.enddd {
margin-bottom: 4px;
}
p.endtd {
margin-bottom: 2px;
}
/* @end */
caption {
font-weight: bold;
}
span.legend {
font-size: 70%;
text-align: center;
}
h3.version {
font-size: 90%;
text-align: center;
}
div.qindex, div.navtab{
background-color: #EBEFF6;
border: 1px solid #A3B4D7;
text-align: center;
margin: 2px;
padding: 2px;
}
div.qindex
{
width: 100%;
line-height: 140%;
}
div.navpath
{
margin-left: 20em;
line-height: 140%;
}
div.navtab {
margin-right: 15px;
}
/* @group Link Styling */
a {
color: #3D578C;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #4665A2;
}
a:hover {
text-decoration: underline;
}
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #9CAFD4;
color: #ffffff;
border: 1px double #869DCA;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.el {
font-weight: bold;
}
a.elRef {
}
a.code {
color: #4665A2;
}
a.codeRef {
color: #4665A2;
}
/* @end */
dl.el {
margin-left: -1cm;
}
.fragment {
font-family: monospace, fixed;
font-size: 105%;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px;
padding: 0.2em;
border: solid thin #333;
border-radius: 0.5em;
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
-webkit-box-shadow: 2px 2px 3px #999;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
body {
background: white;
color: black;
margin: 0;
}
div.contents {
margin-top: 10px;
margin-left: 20em;
margin-right: 10px;
}
td.indexkey {
background-color: #EBEFF6;
font-weight: bold;
border: 1px solid #C4CFE5;
margin: 2px 0px 2px 0;
padding: 2px 10px;
}
td.indexvalue {
background-color: #EBEFF6;
border: 1px solid #C4CFE5;
padding: 2px 10px;
margin: 2px 0px;
}
tr.memlist {
background-color: #EEF1F7;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
address.footer {
text-align: right;
padding-right: 12px;
}
img.footer {
border: 0px;
vertical-align: middle;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
/* @end */
/*
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
*/
td.tiny {
font-size: 75%;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #A3B4D7;
}
th.dirtab {
background: #EBEFF6;
font-weight: bold;
}
hr {
height: 0px;
border: none;
border-top: 1px solid #4A6AAA;
}
hr.footer {
height: 1px;
}
/* @group Member Descriptions */
table.memberdecls {
border-spacing: 0px;
padding: 0px;
}
.mdescLeft, .mdescRight,
.memItemLeft, .memItemRight,
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
background-color: #F9FAFC;
border: none;
margin: 4px;
padding: 1px 0 0 8px;
}
.mdescLeft, .mdescRight {
padding: 0px 8px 4px 8px;
color: #555;
}
.memItemLeft, .memItemRight, .memTemplParams {
border-top: 1px solid #C4CFE5;
}
.memItemLeft, .memTemplItemLeft {
white-space: nowrap;
}
.memTemplParams {
color: #4665A2;
white-space: nowrap;
}
/* @end */
/* @group Member Details */
/* Styles for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #4665A2;
font-weight: normal;
margin-left: 3px;
}
.memnav {
background-color: #EBEFF6;
border: 1px solid #A3B4D7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.memitem {
padding: 0;
margin-bottom: 10px;
}
.memname {
white-space: nowrap;
font-weight: bold;
margin-left: 6px;
}
.memproto {
border-top: 1px solid #A8B8D9;
border-left: 1px solid #A8B8D9;
border-right: 1px solid #A8B8D9;
padding: 6px 0px 6px 0px;
color: #253555;
font-weight: bold;
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
/* firefox specific markup */
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
-moz-border-radius-topright: 8px;
-moz-border-radius-topleft: 8px;
/* webkit specific markup */
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-webkit-border-top-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
background-image:url('nav_f.png');
background-repeat:repeat-x;
background-color: #E2E8F2;
}
.memdoc {
border-bottom: 1px solid #A8B8D9;
border-left: 1px solid #A8B8D9;
border-right: 1px solid #A8B8D9;
padding: 2px 5px;
background-color: #FBFCFD;
border-top-width: 0;
/* firefox specific markup */
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
/* webkit specific markup */
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
white-space: nowrap;
}
.paramname em {
font-style: normal;
}
/* @end */
/* @group Directory (tree) */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin: 0px;
}
/* these are for tree view when used as main index */
.directory {
font-size: 9pt;
font-weight: bold;
margin: 5px;
}
.directory h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
/*
The following two styles can be used to replace the root node title
with an image of your choice. Simply uncomment the next two styles,
specify the name of your image and be sure to set 'height' to the
proper pixel height of your image.
*/
/*
.directory h3.swap {
height: 61px;
background-repeat: no-repeat;
background-image: url("yourimage.gif");
}
.directory h3.swap span {
display: none;
}
*/
.directory > h3 {
margin-top: 0;
}
.directory p {
margin: 0px;
white-space: nowrap;
}
.directory div {
display: none;
margin: 0px;
}
.directory img {
vertical-align: -30%;
}
/* these are for tree view when not used as main index */
.directory-alt {
font-size: 100%;
font-weight: bold;
}
.directory-alt h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
.directory-alt > h3 {
margin-top: 0;
}
.directory-alt p {
margin: 0px;
white-space: nowrap;
}
.directory-alt div {
display: none;
margin: 0px;
}
.directory-alt img {
vertical-align: -30%;
}
/* @end */
div.dynheader {
margin-top: 8px;
}
address {
font-style: normal;
color: #2A3D61;
}
table.doxtable {
border-collapse:collapse;
}
table.doxtable td, table.doxtable th {
border: 1px solid #2D4068;
padding: 3px 7px 2px;
}
table.doxtable th {
background-color: #374F7F;
color: #FFFFFF;
font-size: 110%;
padding-bottom: 4px;
padding-top: 5px;
text-align:left;
}
.tabsearch {
top: 0px;
left: 10px;
height: 36px;
background-image: url('tab_b.png');
z-index: 101;
overflow: hidden;
font-size: 13px;
}
.navpath ul
{
font-size: 11px;
background-image:url('tab_b.png');
background-repeat:repeat-x;
height:30px;
line-height:30px;
color:#8AA0CC;
border:solid 1px #C2CDE4;
overflow:hidden;
margin:0px;
padding:0px;
}
.navpath li
{
list-style-type:none;
float:left;
padding-left:10px;
padding-right: 15px;
background-image:url('bc_s.png');
background-repeat:no-repeat;
background-position:right;
color:#364D7C;
}
.navpath a
{
height:32px;
display:block;
text-decoration: none;
outline: none;
}
.navpath a:hover
{
color:#6884BD;
}
div.summary
{
float: right;
font-size: 8pt;
padding-right: 5px;
width: 50%;
text-align: right;
}
div.summary a
{
white-space: nowrap;
}
div.header
{
background-image:url('nav_h.png');
background-repeat:repeat-x;
background-color: #F9FAFC;
margin: 0px;
margin-left: 20em;
border-bottom: 1px solid #C4CFE5;
}
div.headertitle
{
padding: 5px 5px 5px 10px;
}
#content {
/*position: absolute; */
left:12em;
top:0em;
padding-left:3em;
padding-right:3em;
padding-bottom:2em;
margin-top:1em;
margin-right:2em;
}
.floatright
{
float: right;
margin: 0 0 1em 1em;
}
.timestamp {
text-align:right;
background-color: #DDD;
font-size:75%;
}
#MSearchBox
{
border: 1px solid black;
position: static;
margin: 10px;
display: block;
height: 20px;
}
#MSearchField
{
background:none;
}
/*iframe#MSearchResults
{
height: 500px;
text-wrap: unrestricted;
border: none;
}
*/
/*
#MSearchResultsWindow
{
display: block;
position: fixed;
}*/
div.leftbar
{
text-align:left;
float: left;
border-right: 1px solid #dddddd;
width: 18em;
margin: 5 5 5 5;
padding: 4 4 4 4;
background-color: #ffffff;
position: fixed;
height: 100%;
}
div.menu {
#display:block;
background:#ffffff;
font-size: 90%;
/*border-top: 2px solid #000000;
border-bottom: 2px solid #000000;
*/
margin: 0 0 10px 0;
}
div.menu dl {
margin-top: 0px;
margin-bottom: 5px;
}
div.menu dt {
font-weight:bold;
padding:0 4px 4px 4px;
font-size: 110%;
text-align: left;
text-decoration:none;
}
div.menu dd {
font-weight: bold;
margin-left: 0px;
padding-left: 20px;
padding-bottom: 2px;
font-size: 100%;
}
div.leftbar img {
border:0;
}
div.submenu dd {
font-size: 70%;
margin-left: 8px;
padding-left: 10px;
padding-bottom: 3px;
}
div.submenu dd .secondline {
margin-left: 12px;
}

View File

@ -0,0 +1 @@
<!--</td></tr></table>-->

View File

@ -0,0 +1,67 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="keywords" content="SDF">
<title>SDF: $title</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<!--<link href="style.css" rel="stylesheet" type="text/css">-->
</head>
<body>
<div class="leftbar">
<h2 style="text-align:center;">
<a href="index.html"><img src="sdf_logo.png"/></a>
</h2>
<div class="menu">
<dl>
<dt>Class</dt>
<dd><a href="classes.html">List</a></dd>
<dd><a href="hierarchy.html">Hierarchy</a></dd>
</dl>
</div>
<div class="menu">
<dl>
<dt>Links</dt>
<dd><a href="http://sdformat.org">SDF Website</a></dd>
<!--
<dd><a href="http://sdf.com/wiki">Wiki</a></dd>
<dd><a href="http://sdf.com/wiki/Tutorials">Tutorials</a></dd>
<dd><a href="http://sdf.com/downloads.html">Download</a></dd>
-->
<dd><a href="https://bitbucket.org/osrf/sdf/issues/new">Report Documentation Issues</a></dd>
</dl>
</div>
<div>
<div id="MSearchBox" class="MSearchBoxInactive">
<span>
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span>
</div> <!-- End MSearchBox -->
<div id="MSearchResultsWindow" style="position: static; display: block; border: none; background-color: #ffffff; width: 18em;">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" style="height: 500px; width: 18em; display: block; text-wrap: unrestricted">
</iframe>
</div>
</div>
</div>
<div id="top">

View File

@ -0,0 +1,33 @@
/** \mainpage SDF API Reference
This documentation provides useful information about the Simulation
Desctiption Format API. The code reference is divided into the groups below.
Should you find problems with this documentation - typos, unclear phrases,
or insufficient detail - please create a <a
href="https://bitbucket.org/osrf/sdf/issues/new">new bitbucket issue</a>.
Include sufficient detail to quickly locate the problematic documentation,
and set the issue's fields accordingly: Assignee - blank; Kind - bug;
Priority - minor; Version - blank.
<dl>
<dt>Class</dt>
<dd><a href="classes.html">List</a> - Index of all classes in Gazebo, organized alphabetically</dd>
<dd><a href="hierarchy.html">Hierarchy</a> - Index of classes, organized hierachically according to their inheritance</dd>
</dl>
<dl>
<dt>Links</dt>
<dd><a href="http://sdformat.org">Website</a>: The main SDF website.</dd>
<dd><a href="http://sdformat.org/spec">Specification</a>: Documentation of sdformat elements.</dd>
<dd><a href="http://sdformat.org/tutorials">Tutorials</a>: Tutorials that describe how to use SDF.</dd>
<dd><a href="http://sdformat.org/download">Download</a>: How to download and install SDF</dd>
</dl>
*/

1810
sdformat_for_mpi/doc/sdf.in Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100"
height="100"
id="svg4263"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="sdf_icon_inverted.svg">
<defs
id="defs4265" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="47.175197"
inkscape:cy="62.743618"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="536"
inkscape:window-height="575"
inkscape:window-x="1574"
inkscape:window-y="660"
inkscape:window-maximized="0"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-bbox="true" />
<metadata
id="metadata4268">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-240.04023,-318.89557)">
<path
style="color:#000000;fill:#297d0d;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 290.04023,318.89557 c -27.61418,0 -50,22.39119 -50,50.01197 0,27.44488 22.10199,49.70532 49.47343,49.98803 0.0282,-2.99127 -2.73355,-17.16035 -2.75251,-25.83193 -0.01,-4.37926 4.2938,-20.11503 1.86692,-27.05292 -23.38638,-13.46997 -14.18196,-24.15492 -30.30158,-28.56116 16.82978,0.23212 15.50922,-3.54115 28.62614,7.46948 4.55933,4.09843 4.33928,9.2997 4.21254,17.88365 -0.11042,7.47939 0.69674,7.79948 0.93346,13.43068 2.12912,-0.92082 7.28788,-2.61118 10.6989,-5.55422 5.19706,-4.48406 14.19003,-12.6681 18.14265,-12.49701 3.77387,0.0507 12.82823,1.08073 18.19052,1.24492 -4.43143,-23.08424 -24.71914,-40.53149 -49.09047,-40.53149 z m 49.28195,41.56094 c -8.06681,3.41912 -8.29868,4.5364 -21.78075,11.18026 -4.83067,1.77316 -22.49535,0.42716 -25.65821,11.63515 -0.52554,2.39975 -1.89372,8.24225 -1.26855,16.44721 0.58348,7.65779 3.16211,17.26672 4.045,18.98491 25.45037,-2.33013 45.38056,-23.73234 45.38056,-49.7965 0,-2.88258 -0.24992,-5.70188 -0.71805,-8.45103 z"
id="path4464"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,817 @@
// Search script generated by doxygen
// Copyright (C) 2009 by Dimitri van Heesch.
// The code in this file is loosly based on main.js, part of Natural Docs,
// which is Copyright (C) 2003-2008 Greg Valure
// Natural Docs is licensed under the GPL.
var indexSectionsWithContent =
{
0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000101101110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101111111101110111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010010000000101000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
8: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111010010101100101111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
9: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
10: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011010100000101001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
11: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
};
var indexSectionNames =
{
0: "all",
1: "classes",
2: "namespaces",
3: "files",
4: "functions",
5: "variables",
6: "typedefs",
7: "enums",
8: "enumvalues",
9: "related",
10: "groups",
11: "pages"
};
function convertToId(search)
{
var result = '';
for (i=0;i<search.length;i++)
{
var c = search.charAt(i);
var cn = c.charCodeAt(0);
if (c.match(/[a-z0-9]/))
{
result+=c;
}
else if (cn<16)
{
result+="_0"+cn.toString(16);
}
else
{
result+="_"+cn.toString(16);
}
}
return result;
}
function getXPos(item)
{
var x = 0;
if (item.offsetWidth)
{
while (item && item!=document.body)
{
x += item.offsetLeft;
item = item.offsetParent;
}
}
return x;
}
function getYPos(item)
{
var y = 0;
if (item.offsetWidth)
{
while (item && item!=document.body)
{
y += item.offsetTop;
item = item.offsetParent;
}
}
return y;
}
/* A class handling everything associated with the search panel.
Parameters:
name - The name of the global variable that will be
storing this instance. Is needed to be able to set timeouts.
resultPath - path to use for external files
*/
function SearchBox(name, resultsPath, inFrame, label)
{
if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
// ---------- Instance variables
this.name = name;
this.resultsPath = resultsPath;
this.keyTimeout = 0;
this.keyTimeoutLength = 500;
this.closeSelectionTimeout = 300;
this.lastSearchValue = "";
this.lastResultsPage = "";
this.hideTimeout = 0;
this.searchIndex = 0;
this.searchActive = false;
this.insideFrame = inFrame;
this.searchLabel = label;
// ----------- DOM Elements
this.DOMSearchField = function()
{ return document.getElementById("MSearchField"); }
this.DOMSearchSelect = function()
{ return document.getElementById("MSearchSelect"); }
this.DOMSearchSelectWindow = function()
{ return document.getElementById("MSearchSelectWindow"); }
this.DOMPopupSearchResults = function()
{ return document.getElementById("MSearchResults"); }
this.DOMPopupSearchResultsWindow = function()
{ return document.getElementById("MSearchResultsWindow"); }
this.DOMSearchClose = function()
{ return document.getElementById("MSearchClose"); }
this.DOMSearchBox = function()
{ return document.getElementById("MSearchBox"); }
// ------------ Event Handlers
// Called when focus is added or removed from the search field.
this.OnSearchFieldFocus = function(isActive)
{
this.Activate(isActive);
}
this.OnSearchSelectShow = function()
{
var searchSelectWindow = this.DOMSearchSelectWindow();
var searchField = this.DOMSearchSelect();
if (this.insideFrame)
{
var left = getXPos(searchField);
var top = getYPos(searchField);
left += searchField.offsetWidth + 6;
top += searchField.offsetHeight;
// show search selection popup
searchSelectWindow.style.display='block';
left -= searchSelectWindow.offsetWidth;
searchSelectWindow.style.left = left + 'px';
searchSelectWindow.style.top = top + 'px';
}
else
{
var left = getXPos(searchField);
var top = getYPos(searchField);
top += searchField.offsetHeight;
// show search selection popup
searchSelectWindow.style.display='block';
searchSelectWindow.style.left = left + 'px';
searchSelectWindow.style.top = top + 'px';
}
// stop selection hide timer
if (this.hideTimeout)
{
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
return false; // to avoid "image drag" default event
}
this.OnSearchSelectHide = function()
{
this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
this.closeSelectionTimeout);
}
// Called when the content of the search field is changed.
this.OnSearchFieldChange = function(evt)
{
if (this.keyTimeout) // kill running timer
{
clearTimeout(this.keyTimeout);
this.keyTimeout = 0;
}
var e = (evt) ? evt : window.event; // for IE
if (e.keyCode==40 || e.keyCode==13)
{
if (e.shiftKey==1)
{
this.OnSearchSelectShow();
var win=this.DOMSearchSelectWindow();
for (i=0;i<win.childNodes.length;i++)
{
var child = win.childNodes[i]; // get span within a
if (child.className=='SelectItem')
{
child.focus();
return;
}
}
return;
}
else if (window.frames.MSearchResults.searchResults)
{
var elem = window.frames.MSearchResults.searchResults.NavNext(0);
if (elem) elem.focus();
}
}
else if (e.keyCode==27) // Escape out of the search field
{
this.DOMSearchField().blur();
//this.DOMPopupSearchResultsWindow().style.display = 'none';
this.DOMSearchClose().style.display = 'none';
this.lastSearchValue = '';
this.Activate(false);
return;
}
// strip whitespaces
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
if (searchValue != this.lastSearchValue) // search value has changed
{
if (searchValue != "") // non-empty search
{
// set timer for search update
this.keyTimeout = setTimeout(this.name + '.Search()',
this.keyTimeoutLength);
}
else // empty search field
{
//this.DOMPopupSearchResultsWindow().style.display = 'none';
this.DOMSearchClose().style.display = 'none';
this.lastSearchValue = '';
}
}
}
this.SelectItemCount = function(id)
{
var count=0;
var win=this.DOMSearchSelectWindow();
for (i=0;i<win.childNodes.length;i++)
{
var child = win.childNodes[i]; // get span within a
if (child.className=='SelectItem')
{
count++;
}
}
return count;
}
this.SelectItemSet = function(id)
{
var i,j=0;
var win=this.DOMSearchSelectWindow();
for (i=0;i<win.childNodes.length;i++)
{
var child = win.childNodes[i]; // get span within a
if (child.className=='SelectItem')
{
var node = child.firstChild;
if (j==id)
{
node.innerHTML='&#8226;';
}
else
{
node.innerHTML='&#160;';
}
j++;
}
}
}
// Called when an search filter selection is made.
// set item with index id as the active item
this.OnSelectItem = function(id)
{
this.searchIndex = id;
this.SelectItemSet(id);
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
if (searchValue!="" && this.searchActive) // something was found -> do a search
{
this.Search();
}
}
this.OnSearchSelectKey = function(evt)
{
var e = (evt) ? evt : window.event; // for IE
if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
{
this.searchIndex++;
this.OnSelectItem(this.searchIndex);
}
else if (e.keyCode==38 && this.searchIndex>0) // Up
{
this.searchIndex--;
this.OnSelectItem(this.searchIndex);
}
else if (e.keyCode==13 || e.keyCode==27)
{
this.OnSelectItem(this.searchIndex);
this.CloseSelectionWindow();
this.DOMSearchField().focus();
}
return false;
}
// --------- Actions
// Closes the results window.
this.CloseResultsWindow = function()
{
this.DOMPopupSearchResultsWindow().style.display = 'none';
this.DOMSearchClose().style.display = 'none';
this.Activate(false);
}
this.CloseSelectionWindow = function()
{
this.DOMSearchSelectWindow().style.display = 'none';
}
// Performs a search.
this.Search = function()
{
this.keyTimeout = 0;
// strip leading whitespace
var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
var code = searchValue.toLowerCase().charCodeAt(0);
var hexCode;
if (code<16)
{
hexCode="0"+code.toString(16);
}
else
{
hexCode=code.toString(16);
}
var resultsPage;
var resultsPageWithSearch;
var hasResultsPage;
if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1')
{
resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
hasResultsPage = true;
}
else // nothing available for this search term
{
resultsPage = this.resultsPath + '/nomatches.html';
resultsPageWithSearch = resultsPage;
hasResultsPage = false;
}
window.frames.MSearchResults.location = resultsPageWithSearch;
var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
if (domPopupSearchResultsWindow.style.display!='block')
{
var domSearchBox = this.DOMSearchBox();
this.DOMSearchClose().style.display = 'inline';
if (this.insideFrame)
{
var domPopupSearchResults = this.DOMPopupSearchResults();
domPopupSearchResultsWindow.style.position = 'relative';
domPopupSearchResultsWindow.style.display = 'block';
var width = document.body.clientWidth - 8; // the -8 is for IE :-(
domPopupSearchResultsWindow.style.width = width + 'px';
domPopupSearchResults.style.width = width + 'px';
}
else
{
var domPopupSearchResults = this.DOMPopupSearchResults();
var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
domPopupSearchResultsWindow.style.display = 'block';
left -= domPopupSearchResults.offsetWidth;
domPopupSearchResultsWindow.style.top = top + 'px';
domPopupSearchResultsWindow.style.left = left + 'px';
}
}
this.lastSearchValue = searchValue;
this.lastResultsPage = resultsPage;
}
// -------- Activation Functions
// Activates or deactivates the search panel, resetting things to
// their default values if necessary.
this.Activate = function(isActive)
{
if (isActive || // open it
this.DOMPopupSearchResultsWindow().style.display == 'block'
)
{
this.DOMSearchBox().className = 'MSearchBoxActive';
var searchField = this.DOMSearchField();
if (searchField.value == this.searchLabel) // clear "Search" term upon entry
{
searchField.value = '';
this.searchActive = true;
}
}
else if (!isActive) // directly remove the panel
{
this.DOMSearchBox().className = 'MSearchBoxInactive';
this.DOMSearchField().value = this.searchLabel;
this.searchActive = false;
this.lastSearchValue = ''
this.lastResultsPage = '';
}
}
}
// -----------------------------------------------------------------------
// The class that handles everything on the search results page.
function SearchResults(name)
{
// The number of matches from the last run of <Search()>.
this.lastMatchCount = 0;
this.lastKey = 0;
this.repeatOn = false;
// Toggles the visibility of the passed element ID.
this.FindChildElement = function(id)
{
var parentElement = document.getElementById(id);
var element = parentElement.firstChild;
while (element && element!=parentElement)
{
if (element.nodeName == 'DIV' && element.className == 'SRChildren')
{
return element;
}
if (element.nodeName == 'DIV' && element.hasChildNodes())
{
element = element.firstChild;
}
else if (element.nextSibling)
{
element = element.nextSibling;
}
else
{
do
{
element = element.parentNode;
}
while (element && element!=parentElement && !element.nextSibling);
if (element && element!=parentElement)
{
element = element.nextSibling;
}
}
}
}
this.Toggle = function(id)
{
var element = this.FindChildElement(id);
if (element)
{
if (element.style.display == 'block')
{
element.style.display = 'none';
}
else
{
element.style.display = 'block';
}
}
}
// Searches for the passed string. If there is no parameter,
// it takes it from the URL query.
//
// Always returns true, since other documents may try to call it
// and that may or may not be possible.
this.Search = function(search)
{
if (!search) // get search word from URL
{
search = window.location.search;
search = search.substring(1); // Remove the leading '?'
search = unescape(search);
}
search = search.replace(/^ +/, ""); // strip leading spaces
search = search.replace(/ +$/, ""); // strip trailing spaces
search = search.toLowerCase();
search = convertToId(search);
var resultRows = document.getElementsByTagName("div");
var matches = 0;
var i = 0;
while (i < resultRows.length)
{
var row = resultRows.item(i);
if (row.className == "SRResult")
{
var rowMatchName = row.id.toLowerCase();
rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
if (search.length<=rowMatchName.length &&
rowMatchName.substr(0, search.length)==search)
{
row.style.display = 'block';
matches++;
}
else
{
row.style.display = 'none';
}
}
i++;
}
document.getElementById("Searching").style.display='none';
if (matches == 0) // no results
{
document.getElementById("NoMatches").style.display='block';
}
else // at least one result
{
document.getElementById("NoMatches").style.display='none';
}
this.lastMatchCount = matches;
return true;
}
// return the first item with index index or higher that is visible
this.NavNext = function(index)
{
var focusItem;
while (1)
{
var focusName = 'Item'+index;
focusItem = document.getElementById(focusName);
if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
{
break;
}
else if (!focusItem) // last element
{
break;
}
focusItem=null;
index++;
}
return focusItem;
}
this.NavPrev = function(index)
{
var focusItem;
while (1)
{
var focusName = 'Item'+index;
focusItem = document.getElementById(focusName);
if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
{
break;
}
else if (!focusItem) // last element
{
break;
}
focusItem=null;
index--;
}
return focusItem;
}
this.ProcessKeys = function(e)
{
if (e.type == "keydown")
{
this.repeatOn = false;
this.lastKey = e.keyCode;
}
else if (e.type == "keypress")
{
if (!this.repeatOn)
{
if (this.lastKey) this.repeatOn = true;
return false; // ignore first keypress after keydown
}
}
else if (e.type == "keyup")
{
this.lastKey = 0;
this.repeatOn = false;
}
return this.lastKey!=0;
}
this.Nav = function(evt,itemIndex)
{
var e = (evt) ? evt : window.event; // for IE
if (e.keyCode==13) return true;
if (!this.ProcessKeys(e)) return false;
if (this.lastKey==38) // Up
{
var newIndex = itemIndex-1;
var focusItem = this.NavPrev(newIndex);
if (focusItem)
{
var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
if (child && child.style.display == 'block') // children visible
{
var n=0;
var tmpElem;
while (1) // search for last child
{
tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
if (tmpElem)
{
focusItem = tmpElem;
}
else // found it!
{
break;
}
n++;
}
}
}
if (focusItem)
{
focusItem.focus();
}
else // return focus to search field
{
parent.document.getElementById("MSearchField").focus();
}
}
else if (this.lastKey==40) // Down
{
var newIndex = itemIndex+1;
var focusItem;
var item = document.getElementById('Item'+itemIndex);
var elem = this.FindChildElement(item.parentNode.parentNode.id);
if (elem && elem.style.display == 'block') // children visible
{
focusItem = document.getElementById('Item'+itemIndex+'_c0');
}
if (!focusItem) focusItem = this.NavNext(newIndex);
if (focusItem) focusItem.focus();
}
else if (this.lastKey==39) // Right
{
var item = document.getElementById('Item'+itemIndex);
var elem = this.FindChildElement(item.parentNode.parentNode.id);
if (elem) elem.style.display = 'block';
}
else if (this.lastKey==37) // Left
{
var item = document.getElementById('Item'+itemIndex);
var elem = this.FindChildElement(item.parentNode.parentNode.id);
if (elem) elem.style.display = 'none';
}
else if (this.lastKey==27) // Escape
{
parent.searchBox.CloseResultsWindow();
parent.document.getElementById("MSearchField").focus();
}
else if (this.lastKey==13) // Enter
{
return true;
}
return false;
}
this.NavChild = function(evt,itemIndex,childIndex)
{
var e = (evt) ? evt : window.event; // for IE
if (e.keyCode==13) return true;
if (!this.ProcessKeys(e)) return false;
if (this.lastKey==38) // Up
{
if (childIndex>0)
{
var newIndex = childIndex-1;
document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
}
else // already at first child, jump to parent
{
document.getElementById('Item'+itemIndex).focus();
}
}
else if (this.lastKey==40) // Down
{
var newIndex = childIndex+1;
var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
if (!elem) // last child, jump to parent next parent
{
elem = this.NavNext(itemIndex+1);
}
if (elem)
{
elem.focus();
}
}
else if (this.lastKey==27) // Escape
{
parent.searchBox.CloseResultsWindow();
parent.document.getElementById("MSearchField").focus();
}
else if (this.lastKey==13) // Enter
{
return true;
}
return false;
}
}
function setKeyActions(elem,action)
{
elem.setAttribute('onkeydown',action);
elem.setAttribute('onkeypress',action);
elem.setAttribute('onkeyup',action);
}
function setClassAttr(elem,attr)
{
elem.setAttribute('class',attr);
elem.setAttribute('className',attr);
}
function createResults()
{
var results = document.getElementById("SRResults");
for (var e=0; e<searchData.length; e++)
{
var id = searchData[e][0];
var srResult = document.createElement('div');
srResult.setAttribute('id','SR_'+id);
setClassAttr(srResult,'SRResult');
var srEntry = document.createElement('div');
setClassAttr(srEntry,'SREntry');
var srLink = document.createElement('a');
srLink.setAttribute('id','Item'+e);
setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
setClassAttr(srLink,'SRSymbol');
srLink.innerHTML = searchData[e][1][0];
srEntry.appendChild(srLink);
if (searchData[e][1].length==2) // single result
{
srLink.setAttribute('href',searchData[e][1][1][0]);
if (searchData[e][1][1][1])
{
srLink.setAttribute('target','_parent');
}
var srScope = document.createElement('span');
setClassAttr(srScope,'SRScope');
srScope.innerHTML = searchData[e][1][1][2];
srEntry.appendChild(srScope);
}
else // multiple results
{
srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
var srChildren = document.createElement('div');
setClassAttr(srChildren,'SRChildren');
for (var c=0; c<searchData[e][1].length-1; c++)
{
var srChild = document.createElement('a');
srChild.setAttribute('id','Item'+e+'_c'+c);
setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
setClassAttr(srChild,'SRScope');
srChild.setAttribute('href',searchData[e][1][c+1][0]);
if (searchData[e][1][c+1][1])
{
srChild.setAttribute('target','_parent');
}
srChild.innerHTML = searchData[e][1][c+1][2];
srChildren.appendChild(srChild);
}
srEntry.appendChild(srChildren);
}
srResult.appendChild(srEntry);
results.appendChild(srResult);
}
}

View File

@ -0,0 +1,86 @@
body {
font-family: arial, verdana, sans, sans-serif;
background-color: #FFF;
color:#000;
}
#content {
position: absolute;
left:12em;
top:0em;
padding-left:3em;
padding-right:3em;
padding-bottom:2em;
margin-top:1em;
margin-right:2em;
}
.floatright
{
float: right;
margin: 0 0 1em 1em;
}
.timestamp {
text-align:right;
background-color: #DDD;
font-size:75%;
}
div.leftbar{
position:absolute;
text-align:left;
float: left;
width: 12em;
margin: 5 5 5 5;
padding: 4 4 4 4;
background-color: #DDD;
height: 100%;
}
div.menu {
#display:block;
background:#EEE;
font-size: 90%;
border-top: 2px solid #000000;
border-bottom: 2px solid #000000;
margin: 0 0 10px 0;
}
div.menu dl {
margin-top: 0px;
margin-bottom: 5px;
}
div.menu dt {
font-weight:bold;
padding:0 4px 4px 4px;
font-size: 110%;
text-align: left;
text-decoration:none;
}
div.menu dd {
font-weight: bold;
margin-left: 0px;
padding-left: 20px;
padding-bottom: 2px;
font-size: 100%;
}
div.leftbar img {
border:0;
}
div.submenu dd {
font-size: 70%;
margin-left: 8px;
padding-left: 10px;
padding-bottom: 3px;
}
div.submenu dd .secondline {
margin-left: 12px;
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_ASSERT_HH_
#define _SDF_ASSERT_HH_
#include <boost/assert.hpp>
/// \brief This macro define the standard way of launching an exception
/// inside gazebo.
#define SDF_ASSERT(_expr, _msg) BOOST_ASSERT_MSG(_expr, _msg)
#endif

View File

@ -0,0 +1,25 @@
include (${sdf_cmake_dir}/SDFUtils.cmake)
set (headers
Assert.hh
Console.hh
Converter.hh
Element.hh
Exception.hh
Param.hh
parser.hh
SDFImpl.hh
Types.hh
system_util.hh
)
set (sdf_headers "" CACHE INTERNAL "SDF headers" FORCE)
foreach (hdr ${headers})
APPEND_TO_CACHED_STRING(sdf_headers
"SDF Headers" "#include <sdf/${hdr}>\n")
endforeach()
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sdf.hh.in
${CMAKE_CURRENT_BINARY_DIR}/sdf.hh)
sdf_install_includes("" ${headers} parser_urdf.hh
${CMAKE_CURRENT_BINARY_DIR}/sdf.hh)

View File

@ -0,0 +1,170 @@
/*
* Copyright 2011 Nate Koenig
*
* 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.
*
*/
#ifndef _SDF_CONSOLE_HH_
#define _SDF_CONSOLE_HH_
#include <iostream>
#include <fstream>
#include <string>
#include <memory>
#include "sdf/system_util.hh"
#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::unique_ptr
#pragma warning(push)
#pragma warning(disable: 4251)
#endif
namespace sdf
{
/// \addtogroup sdf SDF
/// \{
/// \brief Output a debug message
#define sdfdbg (sdf::Console::Instance()->Log("Dbg", \
__FILE__, __LINE__))
/// \brief Output a message
#define sdfmsg (sdf::Console::Instance()->ColorMsg("Msg", \
__FILE__, __LINE__, 32))
/// \brief Output a warning message
#define sdfwarn (sdf::Console::Instance()->ColorMsg("Warning", \
__FILE__, __LINE__, 33))
/// \brief Output an error message
#define sdferr (sdf::Console::Instance()->ColorMsg("Error", \
__FILE__, __LINE__, 31))
class ConsolePrivate;
class Console;
/// \def ConsolePtr
/// \brief Shared pointer to a Console Element
typedef std::shared_ptr<Console> ConsolePtr;
/// \brief Message, error, warning, and logging functionality
class SDFORMAT_VISIBLE Console
{
/// \brief An ostream-like class that we'll use for logging.
public: class SDFORMAT_VISIBLE ConsoleStream
{
/// \brief Constructor.
/// \param[in] _stream Pointer to an output stream operator. Can bee
/// NULL.
public: ConsoleStream(std::ostream *_stream) :
stream(_stream) {}
/// \brief Redirect whatever is passed in to both our ostream
/// (if non-NULL) and the log file (if open).
/// \param[in] _rhs Content to be logged.
/// \return Reference to myself.
public: template <class T>
ConsoleStream &operator<<(const T &_rhs);
/// \brief Print a prefix to both terminal and log file.
/// \param[in] _lbl Text label
/// \param[in] _file File containing the error
/// \param[in] _line Line containing the error
/// \param[in] _color Color to make the label. Used only on terminal.
public: void Prefix(const std::string &_lbl,
const std::string &_file,
unsigned int _line, int _color);
/// \brief The ostream to log to; can be NULL.
private: std::ostream *stream;
};
/// \brief Default constructor
private: Console();
/// \brief Destructor
public: virtual ~Console();
/// \brief Return an instance to this class.
public: static ConsolePtr Instance();
/// \brief Set quiet output
/// \param[in] q True to prevent warning
public: void SetQuiet(bool _q);
/// \brief Use this to output a colored message to the terminal
/// \param[in] _lbl Text label
/// \param[in] _file File containing the error
/// \param[in] _line Line containing the error
/// \param[in] _color Color to make the label
/// \return Reference to an output stream
public: ConsoleStream &ColorMsg(const std::string &lbl,
const std::string &file,
unsigned int line, int color);
/// \brief Use this to output a message to a log file
/// \return Reference to output stream
public: ConsoleStream &Log(const std::string &lbl,
const std::string &file,
unsigned int line);
/// \internal
/// \brief Pointer to private data.
private: std::unique_ptr<ConsolePrivate> dataPtr;
};
/// \internal
/// \brief Private data for Console
class ConsolePrivate
{
/// \brief Constructor
public: ConsolePrivate() : msgStream(&std::cerr), logStream(NULL) {}
/// \brief message stream
public: Console::ConsoleStream msgStream;
/// \brief log stream
public: Console::ConsoleStream logStream;
/// \brief logfile stream
public: std::ofstream logFileStream;
};
///////////////////////////////////////////////
template <class T>
Console::ConsoleStream &Console::ConsoleStream::operator<<(const T &_rhs)
{
if (this->stream)
*this->stream << _rhs;
if (Console::Instance()->dataPtr->logFileStream.is_open())
{
Console::Instance()->dataPtr->logFileStream << _rhs;
Console::Instance()->dataPtr->logFileStream.flush();
}
return *this;
}
/// \}
}
#ifdef _WIN32
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,89 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_CONVERTER_HH_
#define _SDF_CONVERTER_HH_
#include <tinyxml.h>
#include <string>
#include "sdf/system_util.hh"
namespace sdf
{
/// \brief Convert from one version of SDF to another
class SDFORMAT_VISIBLE Converter
{
/// \brief Convert SDF to the specified version.
/// \param[in] _doc SDF xml doc
/// \param[in] _toVersion Version number in string format
/// \param[in] _quiet False to be more verbose
public: static bool Convert(TiXmlDocument *_doc,
const std::string &_toVersion,
bool _quiet = false);
/// \cond
/// This is an internal function.
/// \brief Generic convert function that converts the SDF based on the
/// given Convert file.
/// \param[in] _doc SDF xml doc
/// \param[in] _convertDoc Convert xml doc
public: static void Convert(TiXmlDocument *_doc,
TiXmlDocument *_convertDoc);
/// \endcond
private: static void ConvertImpl(TiXmlElement *_elem,
TiXmlElement *_convert);
/// \brief Rename an element or attribute.
/// \param[in] _elem The element to be renamed, or the element which
/// has the attribute to be renamed.
/// \param[in] _renameElem A 'convert' element that describes the rename
/// operation.
private: static void Rename(TiXmlElement *_elem,
TiXmlElement *_renameElem);
/// \brief Move an element or attribute within a common ancestor element.
/// \param[in] _elem Ancestor element of the element or attribute to
/// be moved.
/// \param[in] _moveElem A 'convert' element that describes the move
/// operation.
/// \param[in] _copy True to copy the element
private: static void Move(TiXmlElement *_elem,
TiXmlElement *_moveElem,
const bool _copy);
/// \brief Add an element or attribute to an element.
/// \param[in] _elem The element to receive the value.
/// \param[in] _addElem A 'convert' element that describes the add
/// operation.
private: static void Add(TiXmlElement *_elem,
TiXmlElement *_addElem);
/// \brief Remove an element.
/// \param[in] _elem The element that has the _removeElem child.
/// \param[in] _removeElem The element to remove.
private: static void Remove(TiXmlElement *_elem, TiXmlElement *_removeElem);
private: static const char *GetValue(const char *_valueElem,
const char *_valueAttr,
TiXmlElement *_elem);
private: static void CheckDeprecation(TiXmlElement *_elem,
TiXmlElement *_convert);
};
}
#endif

View File

@ -0,0 +1,383 @@
/*
* Copyright 2015 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_ELEMENT_HH_
#define _SDF_ELEMENT_HH_
#include <string>
#include <vector>
#include <memory>
#include "sdf/Param.hh"
#include "sdf/system_util.hh"
/// \todo Remove this diagnositic push/pop in version 5
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "sdf/Types.hh"
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::enable_shared_from_this
#pragma warning(push)
#pragma warning(disable: 4251)
#endif
/// \ingroup sdf_parser
/// \brief namespace for Simulation Description Format parser
namespace sdf
{
class ElementPrivate;
class SDFORMAT_VISIBLE Element;
/// \def ElementPtr
/// \brief Shared pointer to an SDF Element
typedef std::shared_ptr<Element> ElementPtr;
/// \def ElementWeakPtr
/// \brief Weak pointer to an SDF Element
typedef std::weak_ptr<Element> ElementWeakPtr;
/// \def ElementPtr_V
/// \brief Vector of ElementPtr
typedef std::vector<ElementPtr> ElementPtr_V;
/// \addtogroup sdf
/// \{
/// \class Element Element.hh sdf/sdf.hh
/// \brief SDF Element class
class SDFORMAT_VISIBLE Element :
public std::enable_shared_from_this<Element>
{
/// \brief Constructor.
public: Element();
/// \brief Destructor.
public: virtual ~Element();
/// \brief Create a copy of this Element.
/// \return A copy of this Element.
public: ElementPtr Clone() const;
/// \brief Copy values from an Element.
/// \param[in] _elem Element to copy value from.
public: void Copy(const ElementPtr _elem);
/// \brief Get a pointer to this Element's parent.
/// \return Pointer to this Element's parent, NULL if there is no
/// parent.
public: ElementPtr GetParent() const;
/// \brief Set the parent of this Element.
/// \param[in] _parent Paren for this element.
public: void SetParent(const ElementPtr _parent);
/// \brief Set the name of the Element.
/// \param[in] _name The new name for this Element.
public: void SetName(const std::string &_name);
/// \brief Get the Element's name.
/// \return The name of this Element.
public: const std::string &GetName() const;
/// \brief Set the requirement type.
/// \param[in] _req Requirement type for this element:
/// 0: Not required
/// 1: Exactly one element is required
/// +: One or more elements are required
/// *: Zero or more elements are required.
public: void SetRequired(const std::string &_req);
/// \brief Get the requirement string.
/// \return The requirement string.
/// \sa Element::SetRequired
public: const std::string &GetRequired() const;
/// \brief Set whether this element should copy its child elements
/// during parsing.
/// \param[in] _value True to copy Element's children.
public: void SetCopyChildren(bool _value);
/// \brief Return true if this Element's child elements should be copied
/// during parsing.
/// \return True to copy child elements during parsing.
public: bool GetCopyChildren() const;
/// \brief Set reference SDF element.
/// \param[in] _value Name of the reference sdf element.
public: void SetReferenceSDF(const std::string &_value);
/// \brief Get the name of the reference SDF element.
/// \return Name of the reference SDF element.
public: std::string ReferenceSDF() const;
/// \brief Output Element's description to stdout.
/// \param[in] _prefix String value to prefix to the output.
public: void PrintDescription(const std::string &_prefix);
/// \brief Output Element's values to stdout.
/// \param[in] _prefix String value to prefix to the output.
public: void PrintValues(std::string _prefix);
public: void PrintWiki(std::string _prefix);
/// \brief Helper function for SDF::PrintDoc
///
/// This generates the SDF html documentation.
/// \param[out] _html Accumulated HTML for output.
/// \param[in] _spacing Amount of spacing for this element.
/// \param[in] _index Unique index for this element.
public: void PrintDocLeftPane(std::string &_html,
int _spacing, int &_index);
/// \brief Helper function for SDF::PrintDoc
///
/// This generates the SDF html documentation.
/// \param[out] _html Accumulated HTML for output
/// \param[in] _spacing Amount of spacing for this element.
public: void PrintDocRightPane(std::string &_html,
int _spacing, int &_index);
/// \brief Convert the element values to a string representation.
/// \param[in] _prefix String value to prefix to the output.
/// \return The string representation.
public: std::string ToString(const std::string &_prefix) const;
/// \brief Add an attribute value.
/// \param[in] _key Key value.
/// \param[in] _type Type of data the attribute will hold.
/// \param[in] _defaultValue Default value for the attribute.
/// \param[in] _required Requirement string. \as Element::SetRequired.
/// \param[in] _description A text description of the attribute.
public: void AddAttribute(const std::string &_key,
const std::string &_type,
const std::string &_defaultvalue,
bool _required,
const std::string &_description="");
/// \brief Add a value to this Element.
/// \param[in] _type Type of data the attribute will hold.
/// \param[in] _defaultValue Default value for the attribute.
/// \param[in] _required Requirement string. \as Element::SetRequired.
/// \param[in] _description A text description of the attribute.
public: void AddValue(const std::string &_type,
const std::string &_defaultValue, bool _required,
const std::string &_description="");
/// \brief Get the param of an attribute.
/// \param[in] _key the name of the attribute
/// \return The parameter attribute value. NULL if the key is invalid.
public: ParamPtr GetAttribute(const std::string &_key);
/// \brief Get the number of attributes
public: size_t GetAttributeCount() const;
/// \brief Get an attribute using an index
public: ParamPtr GetAttribute(unsigned int _index) const;
/// \brief Get the number of element descriptions
public: size_t GetElementDescriptionCount() const;
/// \brief Get an element description using an index
public: ElementPtr GetElementDescription(unsigned int _index) const;
/// \brief Get an element descriptio using a key
public: ElementPtr GetElementDescription(const std::string &_key) const;
/// \brief Return true if an element description exists
public: bool HasElementDescription(const std::string &_name);
public: bool HasAttribute(const std::string &_key);
/// \brief Return true if the attribute was set (i.e. not default value)
public: bool GetAttributeSet(const std::string &_key);
/// \brief Get the param of the elements value
public: ParamPtr GetValue();
/// \brief Get the element value/attribute as a boost::any.
/// \param[in] _key The key of the attribute. If empty, get the value of
/// the element. Defaults to empty.
/// \return The element as a boost::any.
public: boost::any GetAny(const std::string &_key = "");
public: template<typename T>
T Get(const std::string &_key = "");
public: template<typename T>
bool Set(const T &_value);
public: bool HasElement(const std::string &_name) const;
public: ElementPtr GetElement(const std::string &_name) const;
/// \brief Get the first child element
/// \returns A smart pointer to the first child of this element, or
/// sdf::ElementPtr(nullptr) if there are no children
public: ElementPtr GetFirstElement() const;
/// \brief Get the next sibling of this element
/// \param[in] _name if given then filter siblings by their xml tag
/// \remarks This function does not alter or store any state
/// Repeated calls to "GetNextElement()" with the same string will
/// always return a pointer to the same element.
/// \returns the next sibling element or sdf::ElementPtr(nullptr)
///
/// This can be used in combination with GetFirstElement() to walk the SDF
/// tree. First call parent->GetFirstElement() to get the first child. Call
/// child = child->GetNextElement() to iterate through the children.
public: ElementPtr GetNextElement(const std::string &_name = "") const;
/// \brief Return a pointer to the child element with the provided name.
///
/// A new child element, with the provided name, is added to this element
/// if there is no existing child element.
/// \remarks If there are multiple elements with the given tag, it returns
/// the first one.
/// \param[in] _name Name of the child element to retreive.
/// \return Pointer to the existing child element, or a new child
/// element if an existing child element did not exist.
public: ElementPtr GetElement(const std::string &_name);
public: ElementPtr AddElement(const std::string &_name);
public: void InsertElement(ElementPtr _elem);
/// \brief Remove this element from its parent.
public: void RemoveFromParent();
/// \brief Remove a child element.
/// \param[in] _child Pointer to the child to remove.
public: void RemoveChild(ElementPtr _child);
/// \brief Remove all child elements.
public: void ClearElements();
public: void Update();
public: void Reset();
public: void SetInclude(const std::string &_filename);
public: std::string GetInclude() const;
/// \brief Get a text description of the element
public: std::string GetDescription() const;
/// \brief Set a text description for the element
public: void SetDescription(const std::string &_desc);
/// \brief Add a new element description
public: void AddElementDescription(ElementPtr _elem);
public: ElementPtr GetElementImpl(const std::string &_name) const;
private: void ToString(const std::string &_prefix,
std::ostringstream &_out) const;
private: ParamPtr CreateParam(const std::string &_key,
const std::string &_type, const std::string &_defaultValue,
bool _required, const std::string &_description="");
/// \brief Private data pointer
private: ElementPrivate *dataPtr;
};
/// \internal
/// \brief Private data for Element
class ElementPrivate
{
/// \brief Element name
public: std::string name;
/// \brief True if element is required
public: std::string required;
/// \brief Element description
public: std::string description;
/// \brief True if element's children should be copied.
public: bool copyChildren;
/// \brief Element's parent
public: ElementWeakPtr parent;
// Attributes of this element
public: Param_V attributes;
// Value of this element
public: ParamPtr value;
// The existing child elements
public: ElementPtr_V elements;
// The possible child elements
public: ElementPtr_V elementDescriptions;
/// name of the include file that was used to create this element
public: std::string includeFilename;
/// \brief Name of reference sdf.
public: std::string referenceSDF;
};
///////////////////////////////////////////////
template<typename T>
T Element::Get(const std::string &_key)
{
T result = T();
if (_key.empty() && this->dataPtr->value)
this->dataPtr->value->Get<T>(result);
else if (!_key.empty())
{
ParamPtr param = this->GetAttribute(_key);
if (param)
param->Get(result);
else if (this->HasElement(_key))
result = this->GetElementImpl(_key)->Get<T>();
else if (this->HasElementDescription(_key))
result = this->GetElementDescription(_key)->Get<T>();
else
sdferr << "Unable to find value for key[" << _key << "]\n";
}
return result;
}
///////////////////////////////////////////////
template<typename T>
bool Element::Set(const T &_value)
{
if (this->dataPtr->value)
{
this->dataPtr->value->Set(_value);
return true;
}
return false;
}
/// \}
}
#ifdef _WIN32
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,133 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_EXCEPTION_HH_
#define _SDF_EXCEPTION_HH_
#include <iostream>
#include <sstream>
#include <stdint.h>
#include <string>
#include "sdf/system_util.hh"
namespace sdf
{
/// \addtogroup sdf
/// \{
/// \brief This macro logs an error to the throw stream and throws
/// an exception that contains the file name and line number.
#define sdfthrow(msg) {std::ostringstream throwStream;\
throwStream << msg << std::endl << std::flush;\
throw sdf::Exception(__FILE__, __LINE__, throwStream.str()); }
class ExceptionPrivate;
/// \class Exception Exception.hh common/common.hh
/// \brief Class for generating exceptions
class SDFORMAT_VISIBLE Exception
{
/// \brief Constructor
public: Exception();
/// \brief Default constructor
/// \param[in] _file File name
/// \param[in] _line Line number where the error occurred
/// \param[in] _msg Error message
public: Exception(const char *_file,
int64_t _line,
std::string _msg);
/// \brief Copy constructor
/// \param[in] _e Exception to copy.
public: Exception(const Exception &_e);
/// \brief Destructor
public: virtual ~Exception();
/// \brief Return the error function
/// \return The error function name
public: std::string GetErrorFile() const;
/// \brief Return the error string
/// \return The error string
public: std::string GetErrorStr() const;
/// \brief Print the exception to std out.
public: void Print() const;
/// \brief stream insertion operator for Gazebo Error
/// \param[in] _out the output stream
/// \param[in] _err the exception
public: friend std::ostream &operator<<(std::ostream& _out,
const sdf::Exception &_err)
{
return _out << _err.GetErrorStr();
}
/// \brief Private data pointer.
private: ExceptionPrivate *dataPtr;
};
/// \class InternalError Exception.hh common/common.hh
/// \brief Class for generating Internal Gazebo Errors:
/// those errors which should never happend and
/// represent programming bugs.
class SDFORMAT_VISIBLE InternalError : public Exception
{
/// \brief Constructor
public: InternalError();
/// \brief Default constructor
/// \param[in] _file File name
/// \param[in] _line Line number where the error occurred
/// \param[in] _msg Error message
public: InternalError(const char *_file, int64_t _line,
const std::string _msg);
/// \brief Destructor
public: virtual ~InternalError();
};
/// \class AssertionInternalError Exception.hh common/common.hh
/// \brief Class for generating Exceptions which come from
/// sdf assertions. They include information about the
/// assertion expression violated, function where problem
/// appeared and assertion debug message.
class SDFORMAT_VISIBLE AssertionInternalError : public InternalError
{
/// \brief Constructor for assertions
/// \param[in] _file File name
/// \param[in] _line Line number where the error occurred
/// \param[in] _expr Assertion expression failed resulting in an
/// internal error
/// \param[in] _function Function where assertion failed
/// \param[in] _msg Function where assertion failed
public: AssertionInternalError(const char *_file,
int64_t _line,
const std::string _expr,
const std::string _function,
const std::string _msg = "");
/// \brief Destructor
public: virtual ~AssertionInternalError();
};
/// \}
}
#endif

View File

@ -0,0 +1,41 @@
/*
* Copyright 2015 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_EXCEPTION_PRIVATE_HH_
#define _SDF_EXCEPTION_PRIVATE_HH_
#include <string>
#include <stdint.h>
namespace sdf
{
/// \internal
/// \brief Private data for Exception
class ExceptionPrivate
{
/// \brief The error function
public: std::string file;
/// \brief Line the error occured on
public: int64_t line;
/// \brief The error string
public: std::string str;
};
}
#endif

View File

@ -0,0 +1,377 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_PARAM_HH_
#define _SDF_PARAM_HH_
// See: https://bugreports.qt-project.org/browse/QTBUG-22829
#ifndef Q_MOC_RUN
#include <boost/lexical_cast.hpp>
#include <boost/any.hpp>
#include <boost/variant.hpp>
#include <boost/version.hpp>
#endif
#include <memory>
#include <functional>
#include <algorithm>
#include <typeinfo>
#include <string>
#include <vector>
#include <ignition/math.hh>
#include "sdf/Console.hh"
#include "sdf/system_util.hh"
/// \todo Remove this diagnositic push/pop in version 5
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "sdf/Types.hh"
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
namespace sdf
{
class SDFORMAT_VISIBLE Param;
/// \def ParamPtr
/// \brief Shared pointer to a Param
typedef std::shared_ptr<Param> ParamPtr;
/// \def Param_V
/// \brief vector of shared pointers to a Param
typedef std::vector<ParamPtr> Param_V;
/// \internal
class ParamPrivate;
/// \class Param Param.hh sdf/sdf.hh
/// \brief A parameter class
class SDFORMAT_VISIBLE Param
{
/// \brief Constructor.
/// \param[in] _key Key for the parameter.
/// \param[in] _typeName String name for the value type (double,
/// int,...).
/// \param[in] _default Default value.
/// \param[in] _required True if the parameter is required to be set.
/// \param[in] _description Description of the parameter.
public: Param(const std::string &_key, const std::string &_typeName,
const std::string &_default, bool _required,
const std::string &_description = "");
/// \brief Destructor
public: virtual ~Param();
/// \brief Get the value as a string.
/// \return String containing the value of the parameter.
public: std::string GetAsString() const;
/// \brief Get the default value as a string.
/// \return String containing the default value of the parameter.
public: std::string GetDefaultAsString() const;
/// \brief Set the parameter value from a string.
/// \param[in] _value New value for the parameter in string form.
public: bool SetFromString(const std::string &_value);
/// \brief Reset the parameter to the default value.
public: void Reset();
/// \brief Get the key value.
/// \return The key.
public: const std::string &GetKey() const;
/// \brief Get the type of the value stored.
/// \return The std::type_info.
/// \deprecated GetType is unstable. Use IsType().
/// \sa IsType
public: const std::type_info &GetType() const SDF_DEPRECATED(4.0);
/// \brief Return true if the param is a particular type
/// \return True if the type held by this Param matches the Type
/// template parameter.
public: template<typename Type>
bool IsType() const;
/// \brief Get the type name value.
/// \return The type name.
public: const std::string &GetTypeName() const;
/// \brief Return whether the parameter is required.
/// \return True if the parameter is required.
public: bool GetRequired() const;
/// \brief Return true if the parameter has been set.
/// \return True if the parameter has been set.
public: bool GetSet() const;
/// \brief Clone the parameter.
/// \return A new parameter that is the clone of this.
public: ParamPtr Clone() const;
/// \brief Set the update function. The updateFunc will be used to
/// set the parameter's value when Param::Update is called.
/// \param[in] _updateFunc Function pointer to an update function.
public: template<typename T>
void SetUpdateFunc(T _updateFunc);
/// \brief Set the parameter's value using the updateFunc.
/// \sa Param::SetUpdateFunc
public: void Update();
/// \brief Set the parameter's value.
///
/// The passed in value must conform to the boost::lexical_cast spec.
/// This means the value must have an input and output stream operator.
/// \param[in] _value The value to set the parameter to.
/// \return True if the value was successfully set.
public: template<typename T>
bool Set(const T &_value);
/// \brief Get the value of the parameter as a boost::any.
/// \param[out] _anyVal The boost::any object to set.
/// \return True if successfully set _anyVal, false otherwise.
public: bool GetAny(boost::any &_anyVal) const;
/// \brief Get the value of the parameter.
/// \param[out] _value The value of the parameter.
/// \return True if parameter was successfully cast to the value type
/// passed in.
public: template<typename T>
bool Get(T &_value) const;
/// \brief Get the default value of the parameter.
/// \param[out] _value The default value of the parameter.
/// \return True if parameter was successfully cast to the value type
/// passed in.
public: template<typename T>
bool GetDefault(T &_value) const;
/// \brief Equal operator. Set's the value and default value from the
/// provided Param.
/// \param[in] _param The parameter to set values from.
/// \return *This
public: Param &operator=(const Param &_param);
/// \brief Set the description of the parameter.
/// \param[in] _desc New description for the parameter.
public: void SetDescription(const std::string &_desc);
/// \brief Get the description of the parameter.
/// \return The description of the parameter.
public: std::string GetDescription() const;
/// \brief Ostream operator. Outputs the parameter's value.
/// \param[in] _out Output stream.
/// \param[in] _p The parameter to output.
/// \return The output stream.
public: friend std::ostream &operator<<(std::ostream &_out,
const Param &_p)
{
_out << _p.GetAsString();
return _out;
}
/// \brief Initialize the value. This is called from the constructor.
/// \param[in] _value Value to set the parameter to.
private: template<typename T>
void Init(const std::string &_value);
/// \brief Private data
private: ParamPrivate *dataPtr;
};
/// \internal
/// \brief Private data for the param class
class ParamPrivate
{
/// \brief Key value
public: std::string key;
/// \brief True if the parameter is required.
public: bool required;
/// \brief True if the parameter is set.
public: bool set;
//// \brief Name of the type.
public: std::string typeName;
/// \brief Description of the parameter.
public: std::string description;
/// \brief Update function pointer.
public: std::function<boost::any ()> updateFunc;
/// \todo Remove this diagnositic push/pop in version 5
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
/// \def ParamVariant
/// \briead Variant type def.
public: typedef boost::variant<bool, char, std::string, int, uint64_t,
unsigned int, double, float, sdf::Time, sdf::Color,
sdf::Vector3, sdf::Vector2i, sdf::Vector2d,
sdf::Quaternion, sdf::Pose,
ignition::math::Vector3d, ignition::math::Vector2i,
ignition::math::Vector2d, ignition::math::Quaterniond,
ignition::math::Pose3d> ParamVariant;
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
/// \brief This parameter's value
public: ParamVariant value;
/// \brief This parameter's default value
public: ParamVariant defaultValue;
};
///////////////////////////////////////////////
template<typename T>
void Param::SetUpdateFunc(T _updateFunc)
{
this->dataPtr->updateFunc = _updateFunc;
}
///////////////////////////////////////////////
template<typename T>
bool Param::Set(const T &_value)
{
try
{
this->SetFromString(boost::lexical_cast<std::string>(_value));
}
catch(...)
{
sdferr << "Unable to set parameter["
<< this->dataPtr->key << "]."
<< "Type type used must have a stream input and output"
<< "operator, which allow boost::lexical_cast to"
<< "function properly.\n";
return false;
}
return true;
}
///////////////////////////////////////////////
template<typename T>
bool Param::Get(T &_value) const
{
try
{
if (typeid(T) == typeid(bool) &&
this->dataPtr->typeName == "string")
{
std::string strValue =
boost::lexical_cast<std::string>(this->dataPtr->value);
std::transform(strValue.begin(), strValue.end(),
strValue.begin(), ::tolower);
if (strValue == "true" || strValue == "1")
_value = boost::lexical_cast<T>("1");
else
_value = boost::lexical_cast<T>("0");
}
else if (typeid(T) == this->dataPtr->value.type())
{
#if BOOST_VERSION < 105800
_value = boost::get<T>(this->dataPtr->value);
#else
_value = boost::relaxed_get<T>(this->dataPtr->value);
#endif
}
else
{
_value = boost::lexical_cast<T>(this->dataPtr->value);
}
}
catch(...)
{
sdferr << "Unable to convert parameter["
<< this->dataPtr->key << "] "
<< "whose type is["
<< this->dataPtr->typeName << "], to "
<< "type[" << typeid(T).name() << "]\n";
return false;
}
return true;
}
///////////////////////////////////////////////
template<typename T>
bool Param::GetDefault(T &_value) const
{
try
{
_value = boost::lexical_cast<T>(this->dataPtr->defaultValue);
}
catch(...)
{
sdferr << "Unable to convert parameter["
<< this->dataPtr->key << "] "
<< "whose type is["
<< this->dataPtr->typeName << "], to "
<< "type[" << typeid(T).name() << "]\n";
return false;
}
return true;
}
///////////////////////////////////////////////
template<typename T>
void Param::Init(const std::string &_value)
{
try
{
this->dataPtr->value = boost::lexical_cast<T>(_value);
}
catch(...)
{
if (this->dataPtr->typeName == "bool")
{
std::string strValue = _value;
std::transform(strValue.begin(), strValue.end(),
strValue.begin(), ::tolower);
if (strValue == "true" || strValue == "1")
this->dataPtr->value = true;
else
this->dataPtr->value = false;
}
else
{
sdferr << "Unable to init parameter value from string["
<< _value << "]\n";
}
}
this->dataPtr->defaultValue = this->dataPtr->value;
this->dataPtr->set = false;
}
///////////////////////////////////////////////
template<typename Type>
bool Param::IsType() const
{
return this->dataPtr->value.type() == typeid(Type);
}
}
#endif

View File

@ -0,0 +1,129 @@
/*
* Copyright 2015 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDFORMAT_SDFEXTENSION_HH_
#define _SDFORMAT_SDFEXTENSION_HH_
#include <tinyxml.h>
#include <memory>
#include <string>
#include <vector>
#include <ignition/math/Pose3.hh>
/// \todo Remove this diagnositic push/pop in version 5
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "sdf/Types.hh"
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
namespace sdf
{
/// \internal
/// \brief A class for holding sdf extension elements in urdf
class SDFExtension
{
/// \brief Constructor
public: SDFExtension();
/// \brief Copy constructor
/// \param[in] _ge SDFExtension to copy.
public: SDFExtension(const SDFExtension &_ge);
/// \brief Destructor
public: virtual ~SDFExtension() = default;
// for reducing fixed joints and removing links
public: std::string oldLinkName;
public: ignition::math::Pose3d reductionTransform;
// visual material
public: std::string material;
/// \brief blobs of xml to be copied into the visual sdf element
public: std::vector<std::shared_ptr<TiXmlElement> > visual_blobs;
/// \brief blobs of xml to be copied into the collision sdf element
/// An example might be:
/// <gazebo reference="link-1">
/// <collision>
/// <max_contacts>10</max_contacts>
/// <surface>
/// <contact>
/// <ode>
/// <kp>1e+06</kp>
/// <kd>100</kd>
/// <max_vel>100</max_vel>
/// <min_depth>0.001</min_depth>
/// </ode>
/// </contact>
/// <friction>
/// <ode>
/// <mu>1</mu>
/// <mu2>1</mu2>
/// </ode>
/// </friction>
/// </surface>
/// </collision>
/// </gazebo>
/// where all the contents of `<collision>` element is copied into the
/// resulting collision sdf.
public: std::vector<std::shared_ptr<TiXmlElement> > collision_blobs;
// body, default off
public: bool setStaticFlag;
public: bool gravity;
public: bool isDampingFactor;
public: double dampingFactor;
public: bool isMaxContacts;
public: int maxContacts;
public: bool isMaxVel;
public: double maxVel;
public: bool isMinDepth;
public: double minDepth;
public: bool isSelfCollide;
public: bool selfCollide;
// geom, contact dynamics
public: bool isMu1, isMu2, isKp, isKd;
public: double mu1, mu2, kp, kd;
public: std::string fdir1;
public: bool isLaserRetro;
public: double laserRetro;
// joint, joint limit dynamics
public: bool isStopCfm, isStopErp, isInitialJointPosition, isFudgeFactor;
public: double stopCfm, stopErp, initialJointPosition, fudgeFactor;
public: bool isSpringReference, isSpringStiffness;
public: double springReference, springStiffness;
public: bool isProvideFeedback;
public: bool provideFeedback;
public: bool isImplicitSpringDamper;
public: bool implicitSpringDamper;
public: bool isStopKp, isStopKd;
public: double stopKp, stopKd;
// blobs into body or robot
public: std::vector<std::shared_ptr<TiXmlElement> > blobs;
friend class SDFORMAT_VISIBLE URDF2SDF;
};
}
#endif

View File

@ -0,0 +1,130 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDFIMPL_HH_
#define _SDFIMPL_HH_
#include <string>
#include <memory>
#include <functional>
#include "sdf/Param.hh"
#include "sdf/Element.hh"
#include "sdf/system_util.hh"
/// \todo Remove this diagnositic push/pop in version 5
#ifndef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "sdf/Types.hh"
#ifndef _WIN32
#pragma GCC diagnostic pop
#endif
/// \ingroup sdf_parser
/// \brief namespace for Simulation Description Format parser
namespace sdf
{
class SDFORMAT_VISIBLE SDF;
/// \def SDFPtr
/// \brief Shared pointer to SDF
typedef std::shared_ptr<SDF> SDFPtr;
/// \addtogroup sdf
/// \{
/// \brief Find the absolute path of a file.
/// \param[in] _filename Name of the file to find.
/// \param[in] _searchLocalPath True to search for the file in the current
/// working directory.
/// \param[in] _useCallback True to find a file based on a registered
/// callback if the file is not found via the normal mechanism.
SDFORMAT_VISIBLE
std::string findFile(const std::string &_filename,
bool _searchLocalPath = true,
bool _useCallback = false);
/// \brief Associate paths to a URI.
/// Example paramters: "model://", "/usr/share/models:~/.gazebo/models"
/// \param[in] _uri URI that will be mapped to _path
/// \param[in] _path Colon separated set of paths.
SDFORMAT_VISIBLE
void addURIPath(const std::string &_uri, const std::string &_path);
/// \brief Set the callback to use when SDF can't find a file.
/// The callback should return a complete path to the requested file, or
/// and empty string if the file was not found in the callback.
/// \param[in] _cb The callback function.
SDFORMAT_VISIBLE
void setFindCallback(std::function<std::string (const std::string &)> _cb);
/// \brief Base SDF class
class SDFORMAT_VISIBLE SDF
{
public: SDF();
/// \brief Destructor
public: ~SDF();
public: void PrintDescription();
public: void PrintValues();
public: void PrintWiki();
public: void PrintDoc();
public: void Write(const std::string &_filename);
public: std::string ToString() const;
/// \brief Set SDF values from a string
public: void SetFromString(const std::string &_sdfData);
/// \brief Get a pointer to the root element
/// \return Pointer to the root element
public: ElementPtr Root() const;
/// \brief Set the root pointer
/// \param[in] _root Root element
public: void Root(const ElementPtr _root);
/// \brief Get the version
/// \return The version as a string
public: static std::string Version();
/// \brief Set the version string
/// \param[in] _version SDF version string.
public: static void Version(const std::string &_version);
// \todo Remove this warning push/pop after sdformat 4.0
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
/// \brief Deprecated.
/// \sa ElementPtr Root()
/// \sa void Root(const ElementPtr _root)
public: ElementPtr root SDF_DEPRECATED(4.0);
/// \brief Deprecated.
/// \sa std::string Version()
/// \sa Version(const std::string &_version)
public: static std::string version SDF_DEPRECATED(4.0);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
};
/// \}
}
#endif

View File

@ -0,0 +1,757 @@
/*
* Copyright 2011 Nate Koenig
*
* 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.
*
*/
#ifndef _SDF_TYPES_HH_
#define _SDF_TYPES_HH_
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <sstream>
#include <vector>
#include "sdf/system_util.hh"
#if defined(__GNUC__)
#define SDF_DEPRECATED(version) __attribute__((deprecated))
#define SDF_FORCEINLINE __attribute__((always_inline))
#elif defined(MSVC)
#define SDF_DEPRECATED(version)
#define SDF_FORCEINLINE __forceinline
#else
#define SDF_DEPRECATED(version)
#define SDF_FORCEINLINE
#endif
namespace sdf
{
/// \brief Windows equivalent of getEnv.
/// Should only be called when using windows.
/// \param[in] _name Name of the environment variable to get.
/// \return Environment variable contents, or NULL on error.
SDFORMAT_VISIBLE
const char *winGetEnv(const char *_name);
/// \brief check if two values are equal, within a tolerance
/// \param[in] _a the first value
/// \param[in] _b the second value
/// \param[in] _epsilon the tolerance
template<typename T>
inline bool equal(const T &_a, const T &_b,
const T &_epsilon = 1e-6)
{
return std::fabs(_a - _b) <= _epsilon;
}
/// \brief Defines a color
class SDFORMAT_VISIBLE Color
{
/// \brief Constructor
/// \param[in] _r Red value (range 0 to 1)
/// \param[in] _g Green value (range 0 to 1
/// \param[in] _b Blue value (range 0 to 1
/// \param[in] _a Alpha value (0=transparent, 1=opaque)
public: Color(float _r = 0.0f, float _g = 0.0f,
float _b = 0.0f, float _a = 1.0f)
: r(_r), g(_g), b(_b), a(_a) {}
/// \brief Stream insertion operator
/// \param[in] _out the output stream
/// \param[in] _pt the color
/// \return the output stream
public: friend std::ostream &operator<< (std::ostream &_out,
const Color &_pt)
{
_out << _pt.r << " " << _pt.g << " " << _pt.b << " " << _pt.a;
return _out;
}
/// \brief Stream insertion operator
/// \param[in] _in the input stream
/// \param[in] _pt
public: friend std::istream &operator>> (std::istream &_in, Color &_pt)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _pt.r >> _pt.g >> _pt.b >> _pt.a;
return _in;
}
/// \brief Equality operator
/// \param[in] _clr The color to check for equality
/// \return True if the this color equals _clf
public: bool operator ==(const Color &_clr) const
{
return equal(this->r, _clr.r) &&
equal(this->g, _clr.g) &&
equal(this->b, _clr.b) &&
equal(this->a, _clr.a);
}
/// \brief Red value
public: float r;
/// \brief Green value
public: float g;
/// \brief Blue value
public: float b;
/// \brief Alpha value
public: float a;
};
/// \deprecated Use ignition::math::Vector2i
/// \brief Generic integer x, y vector
class SDFORMAT_VISIBLE Vector2i
{
/// \brief Constructor
/// \param[in] _x value along x
/// \param[in] _y value along y
public: Vector2i(int _x = 0, int _y = 0)
: x(_x), y(_y) {}
/// \brief Stream insertion operator
/// \param[in] _out output stream
/// \param[in] pt Vector2i to output
/// \return the stream
public: friend std::ostream &operator<<(std::ostream &_out,
const Vector2i &_pt)
{
_out << _pt.x << " " << _pt.y;
return _out;
}
/// \brief Stream extraction operator
/// \param[in] _in input stream
/// \param[in] _pt Vector2i to read values into
/// \return The stream
public: friend std::istream &operator>>(std::istream &_in,
Vector2i &_pt)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _pt.x >> _pt.y;
return _in;
}
/// \brief Equality operator
/// \param _pt The vector to compare with
/// \return True if component have the same values, false otherwise
public: bool operator ==(const Vector2i &_pt) const
{
return this->x == _pt.x && this->y == _pt.y;
}
/// \brief x data
public: int x;
/// \brief y data
public: int y;
} SDF_DEPRECATED(4.0);
/// \deprecated Use ignition::math::Vector2d
/// \brief Generic double x, y vector
class SDFORMAT_VISIBLE Vector2d
{
/// \brief Constructor
/// \param[in] _x value along x
/// \param[in] _y value along y
public: Vector2d(double _x = 0.0, double _y = 0.0)
: x(_x), y(_y) {}
/// \brief Stream extraction operator
/// \param[in] _out output stream
/// \param[in] _pt Vector2d to output
/// \return The stream
public: friend std::ostream &operator<<(std::ostream &_out,
const Vector2d &_pt)
{
_out << _pt.x << " " << _pt.y;
return _out;
}
/// \brief Stream extraction operator
/// \param[in] _in input stream
/// \param[in] _pt Vector2d to read values into
/// \return The stream
public: friend std::istream &operator>>(std::istream &_in,
Vector2d &_pt)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _pt.x >> _pt.y;
return _in;
}
/// \brief Equal to operator
/// \param[in] _v the vector to compare to
/// \return true if the elements of the 2 vectors are equal within
/// a tolerence (1e-6)
public: bool operator ==(const Vector2d &_pt) const
{
return equal(this->x, _pt.x) && equal(this->y, _pt.y);
}
/// \brief x data
public: double x;
/// \brief y data
public: double y;
} SDF_DEPRECATED(4.0);
/// \deprecated Use ignition::math::Vector3d
/// \brief The Vector3 class represents the generic vector containing 3
/// elements. Since it's commonly used to keep coordinate system
/// related information, its elements are labeled by x, y, z.
class SDFORMAT_VISIBLE Vector3
{
/// \brief Copy constructor
/// \param[in] _v a vector
public: Vector3(const Vector3 &_v)
: x(_v.x), y(_v.y), z(_v.z) {}
/// \brief Constructor
/// \param[in] _x value along x
/// \param[in] _y value along y
/// \param[in] _z value along z
public: Vector3(double _x = 0.0, double _y = 0.0, double _z = 0.0)
: x(_x), y(_y), z(_z) {}
/// \brief Addition operator
/// \param[in] _v vector to add
/// \return the sum vector
public: Vector3 operator+(const Vector3 &_v) const
{
return Vector3(this->x + _v.x, this->y + _v.y, this->z + _v.z);
}
/// \brief Return the cross product of this vector and pt
/// \return the product
public: Vector3 Cross(const Vector3 &_pt) const
{
Vector3 c(0, 0, 0);
c.x = this->y * _pt.z - this->z * _pt.y;
c.y = this->z * _pt.x - this->x * _pt.z;
c.z = this->x * _pt.y - this->y * _pt.x;
return c;
}
/// \brief Multiplication operator
/// \remarks this is an element wise multiplication, not a cross product
/// \param[in] _v
public: Vector3 operator*(double _v) const
{
return Vector3(this->x * _v, this->y * _v, this->z * _v);
}
/// \brief Stream insertion operator
/// \param _out output stream
/// \param _pt Vector3 to output
/// \return the stream
public: friend std::ostream &operator<<(std::ostream &_out,
const Vector3 &_pt)
{
_out << _pt.x << " " << _pt.y << " " << _pt.z;
return _out;
}
/// \brief Multiplication by a double
/// \param[in] _v A double
/// \return this
public: const Vector3 &operator*=(double _v)
{
this->x *= _v;
this->y *= _v;
this->z *= _v;
return *this;
}
/// \brief Equal to operator
/// \param[in] _pt The vector to compare against
/// \return true if each component is equal within a
/// tolerence (1e-3), false otherwise
public: bool operator==(const sdf::Vector3 &_pt) const
{
return equal(this->x, _pt.x, 0.001) &&
equal(this->y, _pt.y, 0.001) &&
equal(this->z, _pt.z, 0.001);
}
/// \brief Stream extraction operator
/// \param _in input stream
/// \param _pt vector3 to read values into
/// \return the stream
public: friend std::istream &operator>>(std::istream &_in,
Vector3 &_pt)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _pt.x >> _pt.y >> _pt.z;
return _in;
}
/// \brief x Data
public: double x;
/// \brief y Data
public: double y;
/// \brief z Data
public: double z;
} SDF_DEPRECATED(4.0);
/// \deprecated Use ignition::math::Quaterniond
/// \brief A quaternion class
class SDFORMAT_VISIBLE Quaternion
{
/// \brief Default Constructor
public: Quaternion() : x(0), y(0), z(0), w(1)
{}
/// \brief Copy constructor
/// \param[in] _q Quaternion to copy
public: Quaternion(const Quaternion &_q)
: x(_q.x), y(_q.y), z(_q.z), w(_q.w) {}
public: Quaternion(const double &_roll, const double &_pitch,
const double &_yaw)
{
this->SetFromEuler(Vector3(_roll, _pitch, _yaw));
}
/// \brief Constructor
/// \param[in] _w W param
/// \param[in] _x X param
/// \param[in] _y Y param
/// \param[in] _z Z param
public: Quaternion(double _w, double _x, double _y, double _z)
: x(_x), y(_y), z(_z), w(_w) {}
/// \brief Convert euler angles to quatern.
/// \param[in] _x rotation along x
/// \param[in] _y rotation along y
/// \param[in] _z rotation along z
public: static Quaternion EulerToQuaternion(double _x, double _y, double _z)
{
return EulerToQuaternion(Vector3(_x, _y, _z));
}
/// \brief Convert euler angles to quatern.
/// \param[in] _vec Vector of Euler angles
public: static Quaternion EulerToQuaternion(const Vector3 &_vec)
{
Quaternion result;
result.SetFromEuler(_vec);
return result;
}
/// \brief Equal operator
/// \param[in] _qt Quaternion to copy
public: Quaternion &operator =(const Quaternion &_qt)
{
this->w = _qt.w;
this->x = _qt.x;
this->y = _qt.y;
this->z = _qt.z;
return *this;
}
/// \brief Multiplication operator
/// \param[in] _qt Quaternion for multiplication
/// \return This quaternion multiplied by the parameter
public: inline Quaternion operator*(const Quaternion &_q) const
{
return Quaternion(
this->w*_q.w - this->x*_q.x - this->y*_q.y - this->z*_q.z,
this->w*_q.x + this->x*_q.w + this->y*_q.z - this->z*_q.y,
this->w*_q.y - this->x*_q.z + this->y*_q.w + this->z*_q.x,
this->w*_q.z + this->x*_q.y - this->y*_q.x + this->z*_q.w);
}
/// \brief Get the inverse of this quaternion
/// \return Inverse quarenion
public: inline Quaternion GetInverse() const
{
double s = 0;
Quaternion q(this->w, this->x, this->y, this->z);
// use s to test if quaternion is valid
s = q.w * q.w + q.x * q.x + q.y * q.y + q.z * q.z;
if (equal(s, 0.0))
{
q.w = 1.0;
q.x = 0.0;
q.y = 0.0;
q.z = 0.0;
}
else
{
// deal with non-normalized quaternion
// div by s so q * qinv = identity
q.w = q.w / s;
q.x = -q.x / s;
q.y = -q.y / s;
q.z = -q.z / s;
}
return q;
}
/// \brief Return the rotation in Euler angles
/// \return This quaternion as an Euler vector
public: Vector3 GetAsEuler() const
{
Vector3 vec;
Quaternion copy = *this;
double squ;
double sqx;
double sqy;
double sqz;
copy.Normalize();
squ = copy.w * copy.w;
sqx = copy.x * copy.x;
sqy = copy.y * copy.y;
sqz = copy.z * copy.z;
// Roll
vec.x = atan2(2 * (copy.y*copy.z + copy.w*copy.x),
squ - sqx - sqy + sqz);
// Pitch
double sarg = -2 * (copy.x*copy.z - copy.w * copy.y);
vec.y = sarg <= -1.0 ? -0.5*M_PI :
(sarg >= 1.0 ? 0.5*M_PI : asin(sarg));
// Yaw
vec.z = atan2(2 * (copy.x*copy.y + copy.w*copy.z),
squ + sqx - sqy - sqz);
return vec;
}
/// \brief Set the quaternion from Euler angles
/// \param[in] _vec Euler angle
public: void SetFromEuler(const Vector3 &_vec)
{
double phi, the, psi;
phi = _vec.x / 2.0;
the = _vec.y / 2.0;
psi = _vec.z / 2.0;
this->w = cos(phi) * cos(the) * cos(psi) + sin(phi) *
sin(the) * sin(psi);
this->x = sin(phi) * cos(the) * cos(psi) - cos(phi) *
sin(the) * sin(psi);
this->y = cos(phi) * sin(the) * cos(psi) + sin(phi) *
cos(the) * sin(psi);
this->z = cos(phi) * cos(the) * sin(psi) - sin(phi) *
sin(the) * cos(psi);
this->Normalize();
}
/// \brief Normalize the quaternion
public: void Normalize()
{
double s = 0;
s = sqrt(this->w * this->w + this->x * this->x +
this->y * this->y +
this->z * this->z);
if (equal(s, 0.0))
{
this->w = 1.0;
this->x = 0.0;
this->y = 0.0;
this->z = 0.0;
}
else
{
this->w /= s;
this->x /= s;
this->y /= s;
this->z /= s;
}
}
/// \brief Rotate a vector using the quaternion
/// \param[in] _vec vector to rotate
/// \return the rotated vector
public: inline Vector3 RotateVector(const Vector3 &_vec) const
{
Quaternion tmp(0.0, _vec.x, _vec.y, _vec.z);
tmp = (*this) * (tmp * this->GetInverse());
return Vector3(tmp.x, tmp.y, tmp.z);
}
/// \brief Stream insertion operator
/// \param[in] _out output stream
/// \param[in] _q quaternion to output
/// \return the stream
public: friend std::ostream &operator<<(std::ostream &_out,
const Quaternion &_q)
{
Vector3 v(_q.GetAsEuler());
_out << v.x << " " << v.y << " " << v.z;
return _out;
}
/// \brief Vector3 multiplication operator
/// \param[in] _v vector to multiply
public: Vector3 operator*(const Vector3 &_v) const
{
Vector3 uv, uuv;
Vector3 qvec(this->x, this->y, this->z);
uv = qvec.Cross(_v);
uuv = qvec.Cross(uv);
uv *= (2.0f * this->w);
uuv *= 2.0f;
return _v + uv + uuv;
}
/// \brief Stream extraction operator
/// \param[in] _in input stream
/// \param[in] _q Quaternion to read values into
/// \return The istream
public: friend std::istream &operator>>(std::istream &_in,
Quaternion &_q)
{
double roll, pitch, yaw;
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> roll >> pitch >> yaw;
_q.SetFromEuler(Vector3(roll, pitch, yaw));
return _in;
}
/// \brief Equal to operator
/// \param[in] _qt Quaternion for comparison
/// \return True if equal
public: bool operator ==(const Quaternion &_qt) const
{
return this->GetAsEuler() == _qt.GetAsEuler();
}
public: inline void Correct()
{
if (!std::isfinite(this->x))
this->x = 0;
if (!std::isfinite(this->y))
this->y = 0;
if (!std::isfinite(this->z))
this->z = 0;
if (!std::isfinite(this->w))
this->w = 1;
if (equal(this->w, 0.0) && equal(this->x, 0.0) &&
equal(this->y, 0.0) && equal(this->z, 0.0))
{
this->w = 1;
}
}
/// \brief x data
public: double x;
/// \brief y data
public: double y;
/// \brief z data
public: double z;
/// \brief w data
public: double w;
} SDF_DEPRECATED(4.0);
/// \deprecated Use ignition::math::Pose3d
/// \brief Encapsulates a position and rotation in three space
class SDFORMAT_VISIBLE Pose
{
/// \brief Constructor
public: Pose()
:pos(0, 0, 0), rot(1, 0, 0, 0)
{}
/// \brief Constructor
/// \param[in] _pos A position
/// \param[in] _rot A rotation
public: Pose(Vector3 _pos, Quaternion _rot)
: pos(_pos), rot(_rot) {}
/// \brief Constructor
/// \param[in] _x x position in meters.
/// \param[in] _y y position in meters.
/// \param[in] _z z position in meters.
/// \param[in] _roll Roll (rotation about X-axis) in radians.
/// \param[in] _pitch Pitch (rotation about y-axis) in radians.
/// \param[in] _yaw Yaw (rotation about z-axis) in radians.
public: Pose(double _x, double _y, double _z,
double _roll, double _pitch, double _yaw)
: pos(_x, _y, _z), rot(_roll, _pitch, _yaw)
{
rot.Correct();
}
/// \brief Stream insertion operator
/// \param out output stream
/// \param pose pose to output
/// \return the stream
public: friend std::ostream &operator<<(std::ostream &_out,
const Pose &_pose)
{
_out << _pose.pos << " " << _pose.rot;
return _out;
}
/// \brief Stream extraction operator
/// \param[in] _in the input stream
/// \param[in] _pose the pose
/// \return the stream
public: friend std::istream &operator>>(std::istream &_in,
Pose &_pose)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _pose.pos >> _pose.rot;
return _in;
}
/// \brief Multiplication operator
/// \param[in] _pose the other pose
/// \return itself
public: Pose operator*(const Pose &pose)
{
return Pose(this->CoordPositionAdd(pose), pose.rot * this->rot);
}
/// \brief Add one point to another: result = this + pose
/// \param[in] _pose The Pose to add
/// \return The resulting position
public: Vector3 CoordPositionAdd(const Pose &_pose) const
{
Quaternion tmp;
Vector3 result;
// result = _pose.rot + _pose.rot * this->pos * _pose.rot!
tmp.w = 0.0;
tmp.x = this->pos.x;
tmp.y = this->pos.y;
tmp.z = this->pos.z;
tmp = _pose.rot * (tmp * _pose.rot.GetInverse());
result.x = _pose.pos.x + tmp.x;
result.y = _pose.pos.y + tmp.y;
result.z = _pose.pos.z + tmp.z;
return result;
}
/// \brief Equality operator
/// \param[in] _pose Pose for comparison
/// \return True if equal
public: bool operator ==(const Pose &_pose) const
{
return this->pos == _pose.pos && this->rot == _pose.rot;
}
/// \brief Position data
public: Vector3 pos;
/// \brief Orientation data
public: Quaternion rot;
} SDF_DEPRECATED(4.0);
/// \brief A Time class, can be used to hold wall- or sim-time.
/// stored as sec and nano-sec.
class SDFORMAT_VISIBLE Time
{
/// \brief Constructor
public: Time()
: sec(0), nsec(0)
{
}
/// \brief Constructor
/// \param[in] _sec Seconds
/// \param[in] _nsec Nanoseconds
public: Time(int32_t _sec, int32_t _nsec)
: sec(_sec), nsec(_nsec)
{
}
/// \brief Stream insertion operator
/// \param[in] _out the output stream
/// \param[in] _time time to write to the stream
/// \return the output stream
public: friend std::ostream &operator<<(std::ostream &_out,
const Time &_time)
{
_out << _time.sec << " " << _time.nsec;
return _out;
}
/// \brief Stream extraction operator
/// \param[in] _in the input stream
/// \param[in] _time time to read from to the stream
/// \return the input stream
public: friend std::istream &operator>>(std::istream &_in,
Time &_time)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _time.sec >> _time.nsec;
return _in;
}
/// \brief Equal to operator.
/// \param[in] _time the time to compare to.
/// \return true if values are the same, false otherwise.
public: bool operator ==(const Time &_time) const
{
return this->sec == _time.sec && this->nsec == _time.nsec;
}
/// \brief Seconds.
public: int32_t sec;
/// \brief Nanoseconds.
public: int32_t nsec;
};
/// \brief A class for inertial information about a link.
class SDFORMAT_VISIBLE Inertia
{
public: double mass;
};
}
#endif

View File

@ -0,0 +1,122 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_PARSER_HH_
#define _SDF_PARSER_HH_
#include <tinyxml.h>
#include <string>
#include "sdf/SDFImpl.hh"
#include "sdf/system_util.hh"
/// \ingroup sdf_parser
/// \brief namespace for Simulation Description Format parser
namespace sdf
{
/// \brief Init based on the installed sdf_format.xml file
SDFORMAT_VISIBLE
bool init(SDFPtr _sdf);
// \brief Initialize the SDF interface using a file
SDFORMAT_VISIBLE
bool initFile(const std::string &_filename, SDFPtr _sdf);
// \brief Initialize and SDFElement interface using a file
SDFORMAT_VISIBLE
bool initFile(const std::string &_filename, ElementPtr _sdf);
// \brief Initialize the SDF interface using a string
SDFORMAT_VISIBLE
bool initString(const std::string &_xmlString, SDFPtr _sdf);
// \brief Initialize the SDF interface using a TinyXML document
SDFORMAT_VISIBLE
bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf);
// \brief Initialize and SDF Element using a TinyXML document
SDFORMAT_VISIBLE
bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf);
// \brief For internal use only. Do not use this function.
SDFORMAT_VISIBLE
bool initXml(TiXmlElement *_xml, ElementPtr _sdf);
/// \brief Populate the SDF values from a file
SDFORMAT_VISIBLE
bool readFile(const std::string &_filename, SDFPtr _sdf);
/// \brief Populate the SDF values from a string
SDFORMAT_VISIBLE
bool readString(const std::string &_xmlString, SDFPtr _sdf);
SDFORMAT_VISIBLE
bool readString(const std::string &_xmlString, ElementPtr _sdf);
/// \brief Populate the SDF values from a TinyXML document
SDFORMAT_VISIBLE
bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, const std::string &_source);
SDFORMAT_VISIBLE
bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf,
const std::string &_source);
// \brief For internal use only. Do not use this function.
SDFORMAT_VISIBLE
bool readXml(TiXmlElement *_xml, ElementPtr _sdf);
/// \brief Get the best SDF version from models supported by this sdformat
/// \param[in] _modelXML XML element from config file pointing to the
/// model XML tag
/// \param[out] _modelFileName file name of the best model file
/// \return string with the best SDF version supported
SDFORMAT_VISIBLE
std::string getBestSupportedModelVersion(TiXmlElement *_modelXML,
std::string &_modelFileName);
/// \brief Get the file path to the model file
/// \param[in] _modelDirPath directory system path of the model
/// \return string with the full filesystem path to the best version (greater
/// SDF protocol supported by this sdformat version) of the .sdf
/// model files hosted by _modelDirPath.
SDFORMAT_VISIBLE
std::string getModelFilePath(const std::string &_modelDirPath);
SDFORMAT_VISIBLE
void copyChildren(ElementPtr _sdf, TiXmlElement *_xml);
SDFORMAT_VISIBLE
void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF);
/// \brief Convert an SDF file to a specific SDF version.
/// \param[in] _filename Name of the SDF file to convert.
/// \param[in] _version Version to convert _filename to.
/// \param[out] _sdf Pointer to the converted SDF document.
/// \return True on success.
SDFORMAT_VISIBLE
bool convertFile(const std::string &_filename, const std::string &_version,
SDFPtr _sdf);
/// \brief Convert an SDF string to a specific SDF version.
/// \param[in] _sdfString The SDF string to convert.
/// \param[in] _version Version to convert _filename to.
/// \param[out] _sdf Pointer to the converted SDF document.
/// \return True on success.
SDFORMAT_VISIBLE
bool convertString(const std::string &_sdfString,
const std::string &_version, SDFPtr _sdf);
}
#endif

View File

@ -0,0 +1,66 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDFORMAT_URDF2SDF_HH_
#define _SDFORMAT_URDF2SDF_HH_
#include <tinyxml.h>
#include <string>
#include "sdf/Console.hh"
#include "sdf/system_util.hh"
namespace sdf
{
/// \brief URDF to SDF converter
class SDFORMAT_VISIBLE URDF2SDF
{
/// \brief constructor
public: URDF2SDF();
/// \brief destructor
public: ~URDF2SDF();
/// \brief convert urdf xml document string to sdf xml document
/// \param[in] _xmlDoc a tinyxml document containing the urdf model
/// \return a tinyxml document containing sdf of the model
public: TiXmlDocument InitModelDoc(TiXmlDocument* _xmlDoc);
/// \brief convert urdf file to sdf xml document
/// \param[in] _urdfStr a string containing filename of the urdf model
/// \return a tinyxml document containing sdf of the model
public: TiXmlDocument InitModelFile(const std::string &_filename);
/// \brief convert urdf string to sdf xml document, with option to enforce
/// limits.
/// \param[in] _urdfStr a string containing model urdf
/// \param[in] _enforceLimits option to enforce joint limits
/// \return a tinyxml document containing sdf of the model
public: TiXmlDocument InitModelString(const std::string &_urdfStr,
bool _enforceLimits = true);
/// things that do not belong in urdf but should be mapped into sdf
/// @todo: do this using sdf definitions, not hard coded stuff
private: void ParseSDFExtension(TiXmlDocument &_urdfXml);
/// list extensions for debugging
private: void ListSDFExtensions();
/// list extensions for debugging
private: void ListSDFExtensions(const std::string &_reference);
};
}
#endif

View File

@ -0,0 +1,3 @@
// Automatically generated
${sdf_headers}
#include <sdf/sdf_config.h>

View File

@ -0,0 +1,53 @@
/*
* Copyright 2013 Open Source Robotics Foundation
*
* 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.
*
*/
#ifndef _SDF_VISIBLE_HH_
#define _SDF_VISIBLE_HH_
/** \def SDFORMAT_VISIBLE
* Use to represent "symbol visible" if supported
*/
/** \def SDFORMAT_HIDDEN
* Use to represent "symbol hidden" if supported
*/
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_DLL
#ifdef __GNUC__
#define SDFORMAT_VISIBLE __attribute__ ((dllexport))
#else
#define SDFORMAT_VISIBLE __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define SDFORMAT_VISIBLE __attribute__ ((dllimport))
#else
#define SDFORMAT_VISIBLE __declspec(dllimport)
#endif
#endif
#define SDFORMAT_HIDDEN
#else
#if __GNUC__ >= 4
#define SDFORMAT_VISIBLE __attribute__ ((visibility ("default")))
#define SDFORMAT_HIDDEN __attribute__ ((visibility ("hidden")))
#else
#define SDFORMAT_VISIBLE
#define SDFORMAT_HIDDEN
#endif
#endif
#endif /* SDFORMAT_VISIBLE_HH */

View File

@ -0,0 +1,30 @@
set (sdfs
actor.sdf
camera.sdf
collision.sdf
contact.sdf
gazebo.sdf
geometry.sdf
gripper.sdf
gui.sdf
inertial.sdf
joint.sdf
light.sdf
link.sdf
model.sdf
physics.sdf
plugin.sdf
projector.sdf
ray.sdf
rfidtag.sdf
rfid.sdf
road.sdf
scene.sdf
sensor.sdf
state.sdf
surface.sdf
visual.sdf
world.sdf
)
install(FILES ${sdfs} DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat/1.0/)

View File

@ -0,0 +1,40 @@
<!-- Actor -->
<element name="actor" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="static" type="bool" default="false" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<element name="skin" required="1">
<attribute name="filename" type="string" default="__default__" required="1"/>
<attribute name="scale" type="double" default="1.0" required="0"/>
</element> <!-- End Skin -->
<element name="animation" required="+">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="filename" type="string" default="__default__" required="1"/>
<attribute name="scale" type="double" default="1.0" required="0"/>
<attribute name="interpolate_x" type="bool" default="false" required="0"/>
</element> <!-- End Animation -->
<element name="script" required="1">
<attribute name="loop" type="bool" default="true" required="0"/>
<attribute name="delay_start" type="double" default="0.0" required="0"/>
<attribute name="auto_start" type="bool" default="true" required="0"/>
<element name="trajectory" required="*">
<attribute name="id" type="int" default="0" required="1"/>
<attribute name="type" type="string" default="__default__" required="1"/>
<element name="waypoint" required="*">
<attribute name="time" type="double" default="0.0" required="1"/>
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Waypoint -->
</element> <!-- End Action -->
</element> <!-- End Script -->
<include filename="link.sdf" required="+"/>
<include filename="joint.sdf" required="*"/>
<include filename="plugin.sdf" required="*"/>
</element> <!-- End Actor -->

View File

@ -0,0 +1,21 @@
<element name="camera" required="0">
<element name="horizontal_fov" required="1">
<attribute name="angle" type="double" default="1.047" required="1"/>
</element> <!-- End Horizontal_FOV -->
<element name="image" required="1">
<attribute name="width" type="int" default="320" required="1"/>
<attribute name="height" type="int" default="240" required="1"/>
<attribute name="format" type="string" default="R8G8B8" required="0"/>
</element> <!-- End Image -->
<element name="clip" required="1">
<attribute name="near" type="double" default=".1" required="1"/>
<attribute name="far" type="double" default="100" required="1"/>
</element> <!-- End Clip -->
<element name="save" required="0">
<attribute name="enabled" type="bool" default="false" required="1"/>
<attribute name="path" type="string" default="__default__" required="1"/>
</element> <!-- End Save -->
<element name="depth_camera" required="0">
<attribute name="output" type="string" default="depths" required="1"/>
</element> <!-- End Save -->
</element> <!-- End Camera -->

View File

@ -0,0 +1,16 @@
<!-- Collision -->
<element name="collision" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="laser_retro" type="double" default="0" required="0"/>
<element name="max_contacts" type="int" default="10" required="0"/>
<element name="mass" type="double" default="0" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<include filename="geometry.sdf" required="1"/>
<include filename="surface.sdf" required="0"/>
</element> <!-- End Collision -->

View File

@ -0,0 +1,6 @@
<element name="contact" required="0">
<element name="collision" required="1">
<attribute name="name" type="string" default="__default__" required="1"/>
</element> <!-- End Collision -->
<element name="topic" type="string" default="__default_topic__" required="1"/>
</element> <!-- End Contact -->

View File

@ -0,0 +1,19 @@
<!-- Server -->
<element name="distribution" required="0">
<description>The distribution tag specifies the local ID of this gazebo and port of the remote server.</description>
<attribute name="gazebo_local_ID" type="unsigned int" default="0" required="0">
<description>The ID of the gazebo.</description>
</attribute>
<attribute name="flag" type="int" default="0" required="0">
<description>The flag of the remote server.</description>
</attribute>
<attribute name="port" type="int" default="0" required="0">
<description>the port of the remote port</description>
</attribute>
<include filename="gazeboid.sdf" required="1"/>
</element> <!-- distribution -->

View File

@ -0,0 +1,21 @@
<!-- Event -->
<element name="parallel" required="0">
<description>The parallel tag specifies the numbers of threads and tbb size of the block.</description>
<attribute name="method" type="int" default="0" required="0">
<description>The type of parallel.</description>
</attribute>
<attribute name="numbers_of_thread" type="int" default="8" required="0">
<description>The numbers of the threads.</description>
</attribute>
<attribute name="size_of_block" type="int" default="25" required="0">
<description>the size of block to tbb thread</description>
</attribute>
<attribute name="type" type="int" default="0" required="0">
<description>the type to block partion</description>
</attribute>
</element> <!-- Event -->

View File

@ -0,0 +1,9 @@
<element name="gazebo" required="1">
<attribute name="version" type="string" default="1.0" required="1"/>
<include filename="world.sdf" required="*"/>
<include filename="model.sdf" required="*"/>
<include filename="actor.sdf" required="*"/>
<include filename="light.sdf" required="*"/>
</element> <!-- End Gazebo -->

View File

@ -0,0 +1,17 @@
<!-- gazeboid -->
<element name="gazebo_id" required="0">
<description>The distributed tag specifies the ip and ID of the local gazebo.</description>
<attribute name="num" type="unsigned int" default="0" required="0">
<description>The type of the distribution(0:client or 1:server).</description>
</attribute>
<attribute name="ip" type="string" default="192.168.1.4" required="0">
<description>The ip of the local gazebo.</description>
</attribute>
<element name="model_name" type="string" default="robot" required="0">
<description>model name in the local gazebo.</description>
</element>
</element> <!-- gazeboid -->

View File

@ -0,0 +1,43 @@
<!-- Geometry -->
<element name="geometry" required="1">
<element name="box" required="0">
<attribute name="size" type="vector3" default="1 1 1" required="1"/>
</element> <!-- End Box -->
<element name="sphere" required="0">
<attribute name="radius" type="double" default="1" required="1"/>
</element> <!-- End Sphere -->
<element name="cylinder" required="0">
<attribute name="radius" type="double" default="1" required="1"/>
<attribute name="length" type="double" default="1" required="1"/>
</element> <!-- End Cylinder -->
<element name="mesh" required="0">
<attribute name="filename" type="string" default="__default__" required="1"/>
<attribute name="scale" type="vector3" default="1 1 1" required="0"/>
</element> <!-- End Mesh -->
<element name="plane" required="0">
<attribute name="normal" type="vector3" default="0 0 1" required="1"/>
</element> <!-- End Plane -->
<element name="image" required="0">
<attribute name="filename" type="string" default="__default__" required="1"/>
<attribute name="scale" type="double" default="1" required="1"/>
<attribute name="threshold" type="int" default="200" required="1"/>
<attribute name="height" type="double" default="1" required="1"/>
<attribute name="granularity" type="int" default="1" required="1"/>
</element> <!-- End Image -->
<element name="heightmap" required="0">
<attribute name="filename" type="string" default="__default__" required="1"/>
<attribute name="size" type="vector3" default="1 1 1" required="1"/>
<attribute name="origin" type="vector3" default="0 0 0" required="0"/>
<element name="texture" required="*">
<element name="size" type="double" default="10" required="1"/>
<element name="diffuse" type="string" default="__default__" required="1"/>
<element name="normal" type="string" default="__default__" required="1"/>
</element>
<element name="blend" required="*">
<element name="min_height" type="double" default="0" required="1"/>
<element name="fade_dist" type="double" default="0" required="1"/>
</element>
</element> <!-- End Heightmap -->
</element><!-- End Geometry -->

View File

@ -0,0 +1,11 @@
<!-- Gripper -->
<element name="gripper" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<element name="grasp_check" required="0">
<attribute name="detach_steps" type="int" default="40" required="0"/>
<attribute name="attach_steps" type="int" default="20" required="0"/>
<attribute name="min_contact_count" type="unsigned int" default="2" required="0"/>
</element>
<element name="gripper_link" type="string" default="__default__" required="+"/>
<element name="palm_link" type="string" default="__default__" required="1"/>
</element>

View File

@ -0,0 +1,21 @@
<!-- gui -->
<element name="gui" required="0">
<attribute name="fullscreen" type="bool" default="false" required="0"/>
<element name="camera" required="0">
<attribute name="name" type="string" default="user_camera" required="1"/>
<element name="view_controller" type="string" default="oribit" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element>
<element name="track_visual" required="0">
<element name="name" type="string" default="__default__" required="1"/>
<element name="min_dist" type="double" default="0" required="0"/>
<element name="max_dist" type="double" default="0" required="0"/>
</element>
</element>
</element>

View File

@ -0,0 +1,17 @@
<!-- Inertial -->
<element name="inertial" required="0">
<attribute name="mass" type="double" default="1.0" required="0"/>
<attribute name="density" type="double" default="1.0" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<element name="inertia" required="0">
<attribute name="ixx" type="double" default="0.0" required="1"/>
<attribute name="ixy" type="double" default="0.0" required="1"/>
<attribute name="ixz" type="double" default="0.0" required="1"/>
<attribute name="iyy" type="double" default="0.0" required="1"/>
<attribute name="iyz" type="double" default="0.0" required="1"/>
<attribute name="izz" type="double" default="0.0" required="1"/>
</element> <!-- End Inertia -->
</element> <!-- End Inertial -->

View File

@ -0,0 +1,63 @@
<!-- Joint -->
<element name="joint" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="type" type="string" default="__default__" required="1"/>
<element name="parent" required="1">
<attribute name="link" type="string" default="__default__" required="1"/>
</element> <!-- End Parent -->
<element name="child" required="1">
<attribute name="link" type="string" default="__default__" required="1"/>
</element> <!-- End Child -->
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<element name="thread_pitch" type="double" default="1.0" required="0"/>
<element name="axis" required="1">
<attribute name="xyz" type="vector3" default="0 0 1" required="1"/>
<element name="dynamics" required="0">
<attribute name="damping" type="double" default="0" required="0"/>
<attribute name="friction" type="double" default="0" required="0"/>
</element> <!-- End Dynamics -->
<element name="limit" required="1">
<attribute name="lower" type="double" default="-1e16" required="1"/>
<attribute name="upper" type="double" default="1e16" required="1"/>
<attribute name="effort" type="double" default="0" required="0"/>
<attribute name="velocity" type="double" default="0" required="0"/>
</element> <!-- End Limit -->
</element> <!-- End Axis -->
<element name="axis2" required="0">
<attribute name="xyz" type="vector3" default="0 0 1" required="1"/>
<element name="dynamics" required="0">
<attribute name="damping" type="double" default="0" required="0"/>
<attribute name="friction" type="double" default="0" required="0"/>
</element> <!-- End Dynamics -->
<element name="limit" required="0">
<attribute name="lower" type="double" default="-1e16" required="0"/>
<attribute name="upper" type="double" default="1e16" required="0"/>
<attribute name="effort" type="double" default="0" required="0"/>
<attribute name="velocity" type="double" default="0" required="0"/>
</element> <!-- End Limit -->
</element> <!-- End Axis2 -->
<element name="physics" required="0">
<element name="ode" required="0">
<element name="fudge_factor" type="double" default="0" required="0"/>
<element name="cfm" type="double" default="0" required="0"/>
<element name="bounce" type="double" default="0" required="0"/>
<element name="max_force" type="double" default="0" required="0"/>
<element name="velocity" type="double" default="0" required="0"/>
<element name="limit" required="0">
<attribute name="cfm" type="double" default="0.0" required="1"/>
<attribute name="erp" type="double" default="0.2" required="1"/>
</element>
<element name="suspension" required="0">
<attribute name="cfm" type="double" default="0.0" required="1"/>
<attribute name="erp" type="double" default="0.2" required="1"/>
</element>
</element>
</element> <!-- End Physics -->
</element> <!-- End Joint -->

View File

@ -0,0 +1,37 @@
<!-- Light -->
<element name="light" required="*">
<attribute name="name" type="string" default="__default__" required="0"/>
<attribute name="type" type="string" default="point" required="1"/>
<attribute name="cast_shadows" type="bool" default="false" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<element name="diffuse" required="1">
<attribute name="rgba" type="color" default="1 1 1 1" required="1"/>
</element> <!-- End Diffuse -->
<element name="specular" required="1">
<attribute name="rgba" type="color" default=".1 .1 .1 1" required="1"/>
</element> <!-- End Specular -->
<element name="attenuation" required="0">
<attribute name="range" type="double" default="10" required="1"/>
<attribute name="linear" type="double" default="1" required="0"/>
<attribute name="constant" type="double" default="1" required="0"/>
<attribute name="quadratic" type="double" default="0" required="0"/>
</element> <!-- End Attenuation -->
<element name="direction" required="1">
<attribute name="xyz" type="vector3" default="0 0 -1" required="1"/>
</element><!-- End Directional -->
<element name="spot" required="0">
<attribute name="inner_angle" type="double" default="0" required="1"/>
<attribute name="outer_angle" type="double" default="0" required="1"/>
<attribute name="falloff" type="double" default="0" required="1"/>
</element> <!-- End Spot -->
</element> <!-- End Light -->

View File

@ -0,0 +1,23 @@
<!-- Link -->
<element name="link" required="+">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="gravity" type="bool" default="true" required="0"/>
<attribute name="self_collide" type="bool" default="false" required="0"/>
<attribute name="kinematic" type="bool" default="false" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<element name="damping" required="1">
<element name="linear" type="double" default="0.0" required="1"/>
<element name="angular" type="double" default="0.0" required="1"/>
</element> <!-- End damping -->
<include filename="inertial.sdf" required="0"/>
<include filename="collision.sdf" required="*"/>
<include filename="visual.sdf" required="*"/>
<include filename="sensor.sdf" required="*"/>
<include filename="projector.sdf" required="*"/>
</element> <!-- End Link -->

View File

@ -0,0 +1,15 @@
<!-- Model -->
<element name="model" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="static" type="bool" default="false" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<include filename="link.sdf" required="+"/>
<include filename="joint.sdf" required="*"/>
<include filename="plugin.sdf" required="*"/>
<include filename="gripper.sdf" required="*"/>
</element> <!-- End Model -->

View File

@ -0,0 +1,33 @@
<!-- Physics -->
<element name="physics" required="1">
<attribute name="type" type="string" default="ode" required="1"/>
<attribute name="update_rate" type="double" default="0" required="0"/>
<element name="max_contacts" type="int" default="20" required="0"/>
<element name="gravity" required="1">
<attribute name="xyz" type="vector3" default="0 0 -9.8" required="1"/>
</element> <!-- End Gravity -->
<element name="bullet" required="0">
<element name="dt" type="double" default="0.003" required="1"/>
</element>
<element name="ode" required="0">
<element name="solver" required="1">
<attribute name="type" type="string" default="quick" required="1"/>
<attribute name="dt" type="double" default="0.001" required="1"/>
<attribute name="iters" type="int" default="50" required="1"/>
<attribute name="precon_iters" type="int" default="0" required="0"/>
<attribute name="sor" type="double" default="1.3" required="1"/>
</element> <!-- End Solver -->
<element name="constraints" required="1">
<attribute name="cfm" type="double" default="0" required="1"/>
<attribute name="erp" type="double" default="0.2" required="1"/>
<attribute name="contact_max_correcting_vel" type="double" default="100.0" required="1"/>
<attribute name="contact_surface_layer" type="double" default="0.001" required="1"/>
</element> <!-- End Constraints -->
</element> <!-- ODE -->
</element> <!-- Physics -->

View File

@ -0,0 +1,6 @@
<!-- Plugin -->
<element name="plugin" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="filename" type="string" default="__default__" required="1"/>
<element copy_data="true" required="*"/>
</element> <!-- End Plugin -->

View File

@ -0,0 +1,10 @@
<!-- Projector -->
<element name="projector" required="0">
<attribute name="name" type="string" default="__default__" required="1"/>
<element name="texture" type="string" default="__default__" required="1"/>
<element name="pose" type="pose" default="0 0 0 0 0 0" required="0"/>
<element name="fov" type="double" default="0.785" required="0"/>
<element name="near_clip" type="double" default="0.1" required="0"/>
<element name="far_clip" type="double" default="10.0" required="0"/>
<include filename="plugin.sdf" required="*"/>
</element>

View File

@ -0,0 +1,21 @@
<element name="ray" required="0">
<element name="scan" required="1">
<element name="horizontal" required="1">
<attribute name="samples" type="unsigned int" default="1" required="1"/>
<attribute name="resolution" type="double" default="1" required="0"/>
<attribute name="min_angle" type="double" default="0" required="1"/>
<attribute name="max_angle" type="double" default="0" required="1"/>
</element> <!-- End Horizontal -->
<element name="vertical" required="0">
<attribute name="samples" type="unsigned int" default="1" required="1"/>
<attribute name="resolution" type="double" default="1" required="0"/>
<attribute name="min_angle" type="double" default="0" required="1"/>
<attribute name="max_angle" type="double" default="0" required="1"/>
</element> <!-- End Vertical -->
</element> <!-- End Scan -->
<element name="range" required="1">
<attribute name="min" type="double" default="0" required="1"/>
<attribute name="max" type="double" default="0" required="1"/>
<attribute name="resolution" type="double" default="0" required="0"/>
</element> <!-- End Range -->
</element> <!-- End Ray -->

View File

@ -0,0 +1,2 @@
<element name="rfidtag" required="0">
</element> <!-- End rfidtag -->

View File

@ -0,0 +1,2 @@
<element name="rfid" required="0">
</element> <!-- End RFID -->

View File

@ -0,0 +1,6 @@
<!-- Model -->
<element name="road" required="*">
<attribute name="name" type="string" default="__default__" required="1"/>
<element name="width" type="double" default="1.0" required="1"/>
<element name="point" type="vector3" default="0 0 0" required="+"/>
</element>

View File

@ -0,0 +1,29 @@
<!-- Scene -->
<element name="scene" required="1">
<element name="ambient" required="0">
<attribute name="rgba" type="color" default="0.0 0.0 0.0 1.0" required="1"/>
</element>
<element name="background" required="0">
<attribute name="rgba" type="color" default=".7 .7 .7 1" required="1"/>
<element name="sky" required="0">
<attribute name="material" type="string" default="Gazebo/CloudySky" required="1"/>
</element>
</element>
<element name="shadows" required="0">
<attribute name="enabled" type="bool" default="true" required="1"/>
</element>
<element name="fog" required="0">
<attribute name="rgba" type="color" default="1 1 1 1" required="0"/>
<attribute name="type" type="string" default="linear" required="0"/>
<attribute name="start" type="double" default="1.0" required="0"/>
<attribute name="end" type="double" default="100.0" required="0"/>
<attribute name="density" type="double" default="1.0" required="0"/>
</element>
<element name="grid" required="0">
<attribute name="enabled" type="bool" default="true" required="1"/>
</element>
</element> <!-- End Scene -->

View File

@ -0,0 +1,22 @@
<!-- Sensor -->
<element name="sensor" required="0">
<attribute name="name" type="string" default="__default__" required="1"/>
<attribute name="type" type="string" default="__default__" required="1"/>
<attribute name="always_on" type="bool" default="false" required="0"/>
<attribute name="update_rate" type="double" default="0" required="0"/>
<attribute name="visualize" type="bool" default="false" required="0"/>
<element name="origin" required="0">
<attribute name="pose" type="pose" default="0 0 0 0 0 0" required="1"/>
</element> <!-- End Origin -->
<element name="topic" type="string" default="__default" required="0"/>
<include filename="plugin.sdf" required="*"/>
<include filename="camera.sdf" required="0"/>
<include filename="ray.sdf" required="0"/>
<include filename="contact.sdf" required="0"/>
<include filename="rfid.sdf" required="0"/>
<include filename="rfidtag.sdf" required="0"/>
</element> <!-- End Sensor -->

Some files were not shown because too many files have changed in this diff Show More