hpp-corbaserver  4.9.0
Corba server for Humanoid Path Planner applications
constraints.hh
Go to the documentation of this file.
1 // Copyright (C) 2019 by Joseph Mirabel, LAAS-CNRS.
2 //
3 // This file is part of the hpp-corbaserver.
4 //
5 // This software is provided "as is" without warranty of any kind,
6 // either expressed or implied, including but not limited to the
7 // implied warranties of fitness for a particular purpose.
8 //
9 // See the COPYING file for more information.
10 
11 #ifndef HPP_CONSTRAINTS_IDL_CONSTRAINTS_HH
12 # define HPP_CONSTRAINTS_IDL_CONSTRAINTS_HH
13 
16 
17 # include <hpp/corbaserver/fwd.hh>
19 # include <hpp/constraints_idl/constraints-idl.hh>
20 
22 
23 namespace hpp
24 {
25  namespace corbaServer
26  {
27  namespace constraints_idl
28  {
29  template <typename _Base, typename _Storage>
30  class DifferentiableFunctionServant : public ServantBase<constraints::DifferentiableFunction, _Storage>, public virtual _Base
31  {
33 
34  public:
36  : _ServantBase (server, s) {}
37 
39 
40  floatSeq* value (const floatSeq& arg)
41  {
42  return vectorToFloatSeq (
43  (*get()) (floatSeqToVector(arg, get()->inputSize())).vector()
44  );
45  }
46 
48  {
49  matrix_t J (get()->outputDerivativeSize(), get()->inputDerivativeSize());
50  get()->jacobian (J, floatSeqToVector(arg));
51  return matrixToFloatSeqSeq (J);
52  }
53 
55  {
56  return get()->inputSize();
57  }
59  {
60  return get()->inputDerivativeSize();
61  }
63  {
64  return get()->outputSize ();
65  }
67  {
68  return get()->outputDerivativeSize ();
69  }
70  char* name ()
71  {
72  return c_str(get()->name ());
73  }
74 
75  char* str ()
76  {
77  std::ostringstream oss; oss << *get();
78  std::string res = oss.str();
79  return CORBA::string_dup(res.c_str());
80  }
81  };
82 
84 
85  template <typename _Base, typename _Storage>
86  class ImplicitServant : public ServantBase<constraints::Implicit, _Storage>, public virtual _Base
87  {
89 
90  public:
91  ImplicitServant (Server* server, const Storage& s)
92  : _ServantBase (server, s) {}
93 
94  virtual ~ImplicitServant () {}
95 
96  hpp::constraints_idl::DifferentiableFunction_ptr function ()
97  {
98  hpp::constraints_idl::DifferentiableFunction_var f =
99  makeServantDownCast<DifferentiableFunction> (server_, get()->functionPtr());
100  return f._retn();
101  }
102 
104  {
105  get()->rightHandSideFromConfig (
106  floatSeqToVector(config, get()->function().inputSize()));
107  }
108 
109  void setRightHandSide (const floatSeq& rhs)
110  {
111  get()->rightHandSide (floatSeqToVector(rhs, get()->rhsSize()));
112  }
113 
115  {
116  return vectorToFloatSeq (get()->rightHandSide());
117  }
118 
120  {
121  return get()->rhsSize();
122  }
123 
124  CORBA::Boolean constantRightHandSide ()
125  {
126  return get()->constantRightHandSide();
127  }
128 
130  {
131  return vectorToFloatSeq (get()->rightHandSideAt(s));
132  }
133  };
134 
136  } // end of namespace constraints.
137  } // end of namespace corbaServer.
138 } // end of namespace hpp.
139 
140 #endif // HPP_CONSTRAINTS_IDL_CONSTRAINTS_HH
Definition: servant-base.hh:100
ImplicitServant< POA_hpp::constraints_idl::Implicit, constraints::ImplicitPtr_t > Implicit
Definition: constraints.hh:135
ImplicitServant(Server *server, const Storage &s)
Definition: constraints.hh:91
floatSeqSeq * jacobian(const floatSeq &arg)
Definition: constraints.hh:47
Implement CORBA interface ``Obstacle&#39;&#39;.
void setRightHandSide(const floatSeq &rhs)
Definition: constraints.hh:109
size_type inputDerivativeSize()
Definition: constraints.hh:58
#define SERVANT_BASE_TYPEDEFS(idlObj, hppObj)
Definition: servant-base.hh:54
sequence< floatSeq > floatSeqSeq
Definition: common.idl:33
Definition: constraints.idl:40
size_type outputSize()
Definition: constraints.hh:62
pinocchio::value_type value_type
Definition: fwd.hh:80
vector_t floatSeqToVector(const floatSeq &dofArray, const size_type expectedSize=-1)
char * c_str(const std::string &in)
Definition: conversions.hh:68
CORBA::Boolean constantRightHandSide()
Definition: constraints.hh:124
floatSeq * value(const floatSeq &arg)
Definition: constraints.hh:40
virtual ~DifferentiableFunctionServant()
Definition: constraints.hh:38
hpp::size_type rhsSize()
Definition: constraints.hh:119
floatSeq * rightHandSideAt(value_type s)
Definition: constraints.hh:129
size_type inputSize()
Definition: constraints.hh:54
floatSeq * getRightHandSide()
Definition: constraints.hh:114
Implementation of Hpp module Corba server.
Definition: server.hh:54
pinocchio::matrix_t matrix_t
Definition: fwd.hh:81
floatSeqSeq * matrixToFloatSeqSeq(core::matrixIn_t input)
Returns a sequence of the rows of the input matrix.
size_type outputDerivativeSize()
Definition: constraints.hh:66
DifferentiableFunctionServant(Server *server, const Storage &s)
Definition: constraints.hh:35
virtual ~ImplicitServant()
Definition: constraints.hh:94
floatSeq * vectorToFloatSeq(core::vectorIn_t input)
void setRightHandSideFromConfig(const floatSeq &config)
Definition: constraints.hh:103
sequence< double > floatSeq
Robot configuration is defined by a sequence of dof value.
Definition: common.idl:32
Definition: constraints.idl:19
DifferentiableFunctionServant< POA_hpp::constraints_idl::DifferentiableFunction, constraints::DifferentiableFunctionPtr_t > DifferentiableFunction
Definition: constraints.hh:83
pinocchio::size_type size_type
Definition: fwd.hh:86
long long size_type
Definition: common.idl:19