1 |
|
|
// Copyright (c) 2014, LAAS-CNRS |
2 |
|
|
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
// Redistribution and use in source and binary forms, with or without |
6 |
|
|
// modification, are permitted provided that the following conditions are |
7 |
|
|
// met: |
8 |
|
|
// |
9 |
|
|
// 1. Redistributions of source code must retain the above copyright |
10 |
|
|
// notice, this list of conditions and the following disclaimer. |
11 |
|
|
// |
12 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright |
13 |
|
|
// notice, this list of conditions and the following disclaimer in the |
14 |
|
|
// documentation and/or other materials provided with the distribution. |
15 |
|
|
// |
16 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 |
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 |
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 |
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 |
|
|
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 |
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 |
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 |
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 |
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
27 |
|
|
// DAMAGE. |
28 |
|
|
|
29 |
|
|
#include "hpp/manipulation/srdf/util.hh" |
30 |
|
|
|
31 |
|
|
#include <hpp/manipulation/device.hh> |
32 |
|
|
#include <hpp/pinocchio/urdf/util.hh> |
33 |
|
|
#include <hpp/util/exception-factory.hh> |
34 |
|
|
|
35 |
|
|
#include "hpp/manipulation/parser/parser.hh" |
36 |
|
|
#include "hpp/manipulation/srdf/factories/position.hh" |
37 |
|
|
|
38 |
|
|
namespace hpp { |
39 |
|
|
namespace manipulation { |
40 |
|
|
namespace srdf { |
41 |
|
|
void loadModelFromFile(const DevicePtr_t& robot, const std::string& prefix, |
42 |
|
|
const std::string& package, const std::string& modelName, |
43 |
|
|
const std::string& srdfSuffix) { |
44 |
|
|
std::string srdfName = |
45 |
|
|
"package://" + package + "/srdf/" + modelName + srdfSuffix + ".srdf"; |
46 |
|
|
loadModelFromFile(robot, prefix, srdfName); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
void loadModelFromFile(const DevicePtr_t& robot, const std::string& prefix, |
50 |
|
|
const std::string& srdfName) { |
51 |
|
|
parser::Parser p; |
52 |
|
|
|
53 |
|
|
p.prefix(prefix); |
54 |
|
|
p.parseFile(srdfName, robot); |
55 |
|
|
hppDout(notice, "Finished parsing semantic informations."); |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
void loadModelFromXML(const DevicePtr_t& robot, const std::string& prefix, |
59 |
|
|
const std::string& srdfString) { |
60 |
|
|
parser::Parser p; |
61 |
|
|
p.prefix(prefix); |
62 |
|
|
p.parseString(srdfString, robot); |
63 |
|
|
hppDout(notice, "Finished parsing semantic informations."); |
64 |
|
|
} |
65 |
|
|
} // namespace srdf |
66 |
|
|
} // namespace manipulation |
67 |
|
|
} // namespace hpp |