Main Page
Namespaces
Classes
Files
File List
File Members
src
tools
robot_description.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2015 Aldebaran
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
/*
19
* LOCAL includes
20
*/
21
#include "
robot_description.hpp
"
22
#include "../helpers/filesystem_helpers.hpp"
23
24
namespace
naoqi
{
25
26
namespace
tools{
27
28
std::string
getRobotDescription
(
const
robot::Robot
& robot){
29
std::string urdf_path;
30
static
std::string robot_desc;
31
if
(!robot_desc.empty())
32
return
robot_desc;
33
34
if
( robot ==
robot::PEPPER
)
35
{
36
urdf_path =
helpers::filesystem::getURDF
(
"pepper.urdf"
);
37
}
38
else
if
( robot ==
robot::NAO
)
39
{
40
urdf_path =
helpers::filesystem::getURDF
(
"nao.urdf"
);
41
}
42
else
if
( robot ==
robot::ROMEO
)
43
{
44
urdf_path =
helpers::filesystem::getURDF
(
"romeo.urdf"
);
45
}
46
else
47
{
48
std::cerr <<
" could not load urdf file from disk "
<< std::endl;
49
return
std::string();
50
}
51
52
std::ifstream stream( (urdf_path).c_str() );
53
if
(!stream)
54
{
55
std::cerr <<
"failed to load robot description in joint_state_publisher: "
<< urdf_path << std::endl;
56
return
std::string();
57
}
58
robot_desc = std::string( (std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
59
return
robot_desc;
60
}
61
62
}
// tools
63
64
}
// naoqi
naoqi::robot::ROMEO
Definition:
tools.hpp:42
naoqi::helpers::filesystem::getURDF
std::string & getURDF(std::string filename)
Definition:
filesystem_helpers.hpp:113
naoqi
Definition:
converter.hpp:29
naoqi::robot::Robot
Robot
Definition:
tools.hpp:37
naoqi::robot::PEPPER
Definition:
tools.hpp:41
naoqi::robot::NAO
Definition:
tools.hpp:40
robot_description.hpp
naoqi::tools::getRobotDescription
std::string getRobotDescription(const robot::Robot &robot)
Definition:
robot_description.cpp:28
naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 15 2020 03:24:26