rbprmbuilder.impl.hh 4.73 KB
Newer Older
Steve Tonneau's avatar
Steve Tonneau committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2014 CNRS
// Author: Florent Lamiraux
//
// This file is part of hpp-manipulation-corba.
// hpp-manipulation-corba is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// hpp-manipulation-corba is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Lesser Public License for more details.  You should have
// received a copy of the GNU Lesser General Public License along with
// hpp-manipulation-corba.  If not, see
// <http://www.gnu.org/licenses/>.

#ifndef HPP_RBPRM_CORBA_BUILDER_IMPL_HH
# define HPP_RBPRM_CORBA_BUILDER_IMPL_HH

# include <hpp/core/problem-solver.hh>
# include "rbprmbuilder.hh"
Steve Tonneau's avatar
Steve Tonneau committed
23
# include <hpp/rbprm/rbprm-device.hh>
Steve Tonneau's avatar
Steve Tonneau committed
24
# include <hpp/rbprm/rbprm-fullbody.hh>
Steve Tonneau's avatar
Steve Tonneau committed
25
26
# include <hpp/rbprm/rbprm-shooter.hh>
# include <hpp/rbprm/rbprm-validation.hh>
Steve Tonneau's avatar
Steve Tonneau committed
27
28
29
30
31
32

namespace hpp {
  namespace rbprm {
    namespace impl {
      using CORBA::Short;

Steve Tonneau's avatar
Steve Tonneau committed
33
34
35
    struct BindShooter
    {
        BindShooter(const std::size_t shootLimit = 10000,
Steve Tonneau's avatar
Steve Tonneau committed
36
                    const std::size_t displacementLimit = 1000)
Steve Tonneau's avatar
Steve Tonneau committed
37
38
39
40
41
42
43
            : shootLimit_(shootLimit)
            , displacementLimit_(displacementLimit) {}

        hpp::rbprm::RbPrmShooterPtr_t create (const hpp::model::DevicePtr_t& robot)
        {
            hpp::model::RbPrmDevicePtr_t robotcast = boost::static_pointer_cast<hpp::model::RbPrmDevice>(robot);
            return hpp::rbprm::RbPrmShooter::create
Steve Tonneau's avatar
Steve Tonneau committed
44
                    (robotcast,problemSolver_->problem ()->collisionObstacles(),shootLimit_,displacementLimit_);
Steve Tonneau's avatar
Steve Tonneau committed
45
46
47
48
49
50
        }
        hpp::core::ProblemSolverPtr_t problemSolver_;
        std::size_t shootLimit_;
        std::size_t displacementLimit_;
    };

Steve Tonneau's avatar
Steve Tonneau committed
51
52
53
      class RbprmBuilder : public virtual POA_hpp::corbaserver::rbprm::RbprmBuilder
      {
        public:
Steve Tonneau's avatar
Steve Tonneau committed
54
        RbprmBuilder ();
Steve Tonneau's avatar
Steve Tonneau committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

        virtual void loadRobotRomModel (const char* robotName,
                 const char* rootJointType,
                 const char* packageName,
                 const char* modelName,
                 const char* urdfSuffix,
                 const char* srdfSuffix) throw (hpp::Error);

        virtual void loadRobotCompleteModel (const char* robotName,
                 const char* rootJointType,
                 const char* packageName,
                 const char* modelName,
                 const char* urdfSuffix,
                 const char* srdfSuffix) throw (hpp::Error);

Steve Tonneau's avatar
Steve Tonneau committed
70
71
72
73
74
75
76
77
78

        virtual void loadFullBodyRobot (const char* robotName,
                 const char* rootJointType,
                 const char* packageName,
                 const char* modelName,
                 const char* urdfSuffix,
                 const char* srdfSuffix) throw (hpp::Error);

        virtual hpp::floatSeq* getSampleConfig(const char* limb, unsigned short sampleId) throw (hpp::Error);
Steve Tonneau's avatar
Steve Tonneau committed
79
        virtual hpp::floatSeq* getSamplePosition(const char* limb, unsigned short sampleId) throw (hpp::Error);
Steve Tonneau's avatar
Steve Tonneau committed
80

Steve Tonneau's avatar
Steve Tonneau committed
81
82
83
        virtual hpp::floatSeq* generateContacts(const hpp::floatSeq& configuration,
                                                const hpp::floatSeq& direction) throw (hpp::Error);

84
85
86
87
        virtual hpp::floatSeq* getContactSamplesIds(const char* limb,
                                                   const hpp::floatSeq& configuration,
                                                   const hpp::floatSeq& direction) throw (hpp::Error);

Steve Tonneau's avatar
Steve Tonneau committed
88
        virtual void addLimb(const char* id, const char* limb, const char* effector, const hpp::floatSeq& offset,  const hpp::floatSeq& normal, double x, double y, unsigned short samples, double resolution) throw (hpp::Error);
Steve Tonneau's avatar
Steve Tonneau committed
89

Steve Tonneau's avatar
Steve Tonneau committed
90
91
92
93
        virtual void setStartState(const hpp::floatSeq& configuration, const hpp::Names_t& contactLimbs) throw (hpp::Error);
        virtual void setEndState(const hpp::floatSeq& configuration, const hpp::Names_t& contactLimbs) throw (hpp::Error);
        virtual hpp::floatSeqSeq* interpolate(double timestep) throw (hpp::Error);

Steve Tonneau's avatar
Steve Tonneau committed
94
        public:
Steve Tonneau's avatar
Steve Tonneau committed
95
96
97
        void SetProblemSolver (hpp::core::ProblemSolverPtr_t problemSolver);

        private:
Steve Tonneau's avatar
Steve Tonneau committed
98
99
100
101
102
        /// \brief Pointer to hppPlanner object of hpp::corbaServer::Server.
        core::ProblemSolverPtr_t problemSolver_;

        private:
        model::DevicePtr_t romDevice_;
Steve Tonneau's avatar
Steve Tonneau committed
103
        rbprm::RbPrmFullBodyPtr_t fullBody_;
Steve Tonneau's avatar
Steve Tonneau committed
104
        bool romLoaded_;
Steve Tonneau's avatar
Steve Tonneau committed
105
        bool fullBodyLoaded_;
Steve Tonneau's avatar
Steve Tonneau committed
106
        BindShooter bindShooter_;
Steve Tonneau's avatar
Steve Tonneau committed
107
108
        rbprm::State startState_;
        rbprm::State endState_;
Steve Tonneau's avatar
Steve Tonneau committed
109
110
111
112
113
114
      }; // class RobotBuilder
    } // namespace impl
  } // namespace manipulation
} // namespace hpp

#endif // HPP_RBPRM_CORBA_BUILDER_IMPL_HH