hpp-corbaserver 4.14.0
Corba server for Humanoid Path Planner applications
Loading...
Searching...
No Matches
constraints.hh
Go to the documentation of this file.
1// Copyright (C) 2019 by Joseph Mirabel, LAAS-CNRS.
2//
3
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright
12// notice, this list of conditions and the following disclaimer in the
13// documentation and/or other materials provided with the distribution.
14//
15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26// DAMAGE.
27//
28// This software is provided "as is" without warranty of any kind,
29// either expressed or implied, including but not limited to the
30// implied warranties of fitness for a particular purpose.
31//
32// See the COPYING file for more information.
33
34#ifndef HPP_CONSTRAINTS_IDL_CONSTRAINTS_HH
35#define HPP_CONSTRAINTS_IDL_CONSTRAINTS_HH
36
37#include <hpp/constraints/differentiable-function.hh>
38#include <hpp/constraints/implicit.hh>
43
44namespace hpp {
45namespace corbaServer {
46namespace constraints_idl {
47template <typename _Base, typename _Storage>
49 : public ServantBase<constraints::DifferentiableFunction, _Storage>,
50 public virtual _Base {
52 constraints::DifferentiableFunction);
53
54 public:
56 : _ServantBase(server, s) {}
57
59
60 floatSeq* value(const floatSeq& arg) {
61 return vectorToFloatSeq(
62 (*get())(floatSeqToVector(arg, get()->inputSize())).vector());
63 }
64
67 get()->jacobian(J, floatSeqToVector(arg));
68 return matrixToFloatSeqSeq(J);
69 }
70
71 size_type inputSize() { return get()->inputSize(); }
72 size_type inputDerivativeSize() { return get()->inputDerivativeSize(); }
73 size_type outputSize() { return get()->outputSize(); }
74 size_type outputDerivativeSize() { return get()->outputDerivativeSize(); }
75 char* name() { return c_str(get()->name()); }
76
77 char* str() {
78 std::ostringstream oss;
79 oss << *get();
80 std::string res = oss.str();
81 return CORBA::string_dup(res.c_str());
82 }
83};
84
85typedef DifferentiableFunctionServant<
86 POA_hpp::constraints_idl::DifferentiableFunction,
87 constraints::DifferentiableFunctionPtr_t>
89
90template <typename _Base, typename _Storage>
91class ImplicitServant : public ServantBase<constraints::Implicit, _Storage>,
92 public virtual _Base {
94
95 public:
96 ImplicitServant(Server* server, const Storage& s) : _ServantBase(server, s) {}
97
98 virtual ~ImplicitServant() {}
99
100 hpp::constraints_idl::DifferentiableFunction_ptr function() {
101 hpp::constraints_idl::DifferentiableFunction_var f =
102 makeServantDownCast<DifferentiableFunction>(server_,
103 get()->functionPtr());
104 return f._retn();
105 }
106
108 get()->rightHandSideFromConfig(
109 floatSeqToVector(config, get()->function().inputSize()));
110 }
111
112 void setRightHandSide(const floatSeq& rhs) {
113 get()->rightHandSide(floatSeqToVector(rhs, get()->rhsSize()));
114 }
115
117 return vectorToFloatSeq(get()->rightHandSide());
118 }
119
120 hpp::size_type rhsSize() { return get()->rhsSize(); }
121
122 CORBA::Boolean constantRightHandSide() {
123 return get()->constantRightHandSide();
124 }
125
128 }
129};
130
131typedef ImplicitServant<POA_hpp::constraints_idl::Implicit,
132 constraints::ImplicitPtr_t>
134} // namespace constraints_idl
135} // end of namespace corbaServer.
136} // end of namespace hpp.
137
138#endif // HPP_CONSTRAINTS_IDL_CONSTRAINTS_HH
Definition: common-idl.hh:803
Definition: common-idl.hh:689
Server * server_
Definition: servant-base.hh:116
Definition: servant-base.hh:120
virtual TShPtr_t get() const
Definition: servant-base.hh:130
Implementation of Hpp module Corba server.
Definition: server.hh:77
DifferentiableFunctionServant(Server *server, const Storage &s)
Definition: constraints.hh:55
size_type inputSize()
Definition: constraints.hh:71
size_type outputDerivativeSize()
Definition: constraints.hh:74
floatSeqSeq * jacobian(const floatSeq &arg)
Definition: constraints.hh:65
floatSeq * value(const floatSeq &arg)
Definition: constraints.hh:60
size_type inputDerivativeSize()
Definition: constraints.hh:72
virtual ~DifferentiableFunctionServant()
Definition: constraints.hh:58
size_type outputSize()
Definition: constraints.hh:73
void setRightHandSideFromConfig(const floatSeq &config)
Definition: constraints.hh:107
CORBA::Boolean constantRightHandSide()
Definition: constraints.hh:122
floatSeq * rightHandSideAt(value_type s)
Definition: constraints.hh:126
void setRightHandSide(const floatSeq &rhs)
Definition: constraints.hh:112
hpp::size_type rhsSize()
Definition: constraints.hh:120
ImplicitServant(Server *server, const Storage &s)
Definition: constraints.hh:96
virtual ~ImplicitServant()
Definition: constraints.hh:98
floatSeq * getRightHandSide()
Definition: constraints.hh:116
hpp::constraints_idl::DifferentiableFunction_ptr function()
Definition: constraints.hh:100
#define SERVANT_BASE_TYPEDEFS(idlObj, hppObj)
Definition: servant-base.hh:73
Definition: constraints.idl:20
Definition: constraints.idl:41
DifferentiableFunctionServant< POA_hpp::constraints_idl::DifferentiableFunction, constraints::DifferentiableFunctionPtr_t > DifferentiableFunction
Definition: constraints.hh:88
ImplicitServant< POA_hpp::constraints_idl::Implicit, constraints::ImplicitPtr_t > Implicit
Definition: constraints.hh:133
floatSeq * vectorToFloatSeq(core::vectorIn_t input)
pinocchio::size_type size_type
Definition: fwd.hh:115
vector_t floatSeqToVector(const floatSeq &dofArray, const size_type expectedSize=-1)
floatSeqSeq * matrixToFloatSeqSeq(core::matrixIn_t input)
Returns a sequence of the rows of the input matrix.
pinocchio::value_type value_type
Definition: fwd.hh:109
pinocchio::matrix_t matrix_t
Definition: fwd.hh:110
char * c_str(const std::string &in)
Definition: conversions.hh:92
Implement CORBA interface `‘Obstacle’'.
Definition: basic-server.hh:35
long long size_type
Definition: common.idl:19