Blender
V4.3
intern
itasc
ControlledObject.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2009 Ruben Smits
2
*
3
* SPDX-License-Identifier: LGPL-2.1-or-later */
4
9
#include "
ControlledObject.hpp
"
10
11
12
namespace
iTaSC
{
13
ControlledObject::ControlledObject
():
14
Object
(Controlled),m_nq(0),m_nc(0),m_nee(0)
15
{
16
// max joint variable = 0.52 radian or 0.52 meter in one timestep
17
m_maxDeltaQ
=
e_scalar
(0.52);
18
}
19
20
void
ControlledObject::initialize
(
unsigned
int
_nq,
unsigned
int
_nc,
unsigned
int
_nee)
21
{
22
assert(_nee >= 1);
23
m_nq
= _nq;
24
m_nc
= _nc;
25
m_nee
= _nee;
26
if
(
m_nq
> 0) {
27
m_Wq
=
e_identity_matrix
(
m_nq
,
m_nq
);
28
m_qdot
=
e_zero_vector
(
m_nq
);
29
}
30
if
(
m_nc
> 0) {
31
m_Wy
=
e_scalar_vector
(
m_nc
,1.0);
32
m_ydot
=
e_zero_vector
(
m_nc
);
33
}
34
if
(
m_nc
> 0 &&
m_nq
> 0)
35
m_Cq
=
e_zero_matrix
(
m_nc
,
m_nq
);
36
// clear all Jacobian if any
37
m_JqArray
.clear();
38
// reserve one more to have a zero matrix handy
39
if
(
m_nq
> 0)
40
m_JqArray
.resize(
m_nee
+1,
e_zero_matrix
(6,
m_nq
));
41
}
42
43
ControlledObject::~ControlledObject
() {}
44
45
46
47
const
e_matrix
&
ControlledObject::getJq
(
unsigned
int
ee)
const
48
{
49
assert(
m_nq
> 0);
50
return
m_JqArray
[(ee>
m_nee
)?
m_nee
:ee];
51
}
52
53
double
ControlledObject::getMaxTimestep
(
double
& timestep)
54
{
55
e_scalar
maxQdot =
m_qdot
.array().abs().maxCoeff();
56
if
(timestep*maxQdot >
m_maxDeltaQ
) {
57
timestep =
m_maxDeltaQ
/maxQdot;
58
}
59
return
timestep;
60
}
61
62
}
ControlledObject.hpp
iTaSC::ControlledObject::m_JqArray
std::vector< e_matrix > m_JqArray
Definition
ControlledObject.hpp:29
iTaSC::ControlledObject::m_Wq
e_matrix m_Wq
Definition
ControlledObject.hpp:27
iTaSC::ControlledObject::m_ydot
e_vector m_ydot
Definition
ControlledObject.hpp:28
iTaSC::ControlledObject::m_qdot
e_vector m_qdot
Definition
ControlledObject.hpp:28
iTaSC::ControlledObject::getJq
virtual const e_matrix & getJq(unsigned int ee) const
Definition
ControlledObject.cpp:47
iTaSC::ControlledObject::ControlledObject
ControlledObject()
Definition
ControlledObject.cpp:13
iTaSC::ControlledObject::m_Wy
e_vector m_Wy
Definition
ControlledObject.hpp:28
iTaSC::ControlledObject::~ControlledObject
virtual ~ControlledObject()
Definition
ControlledObject.cpp:43
iTaSC::ControlledObject::getMaxTimestep
virtual double getMaxTimestep(double ×tep)
Definition
ControlledObject.cpp:53
iTaSC::ControlledObject::m_nq
unsigned int m_nq
Definition
ControlledObject.hpp:26
iTaSC::ControlledObject::m_nee
unsigned int m_nee
Definition
ControlledObject.hpp:26
iTaSC::ControlledObject::initialize
virtual void initialize(unsigned int _nq, unsigned int _nc, unsigned int _nee)
Definition
ControlledObject.cpp:20
iTaSC::ControlledObject::m_maxDeltaQ
e_scalar m_maxDeltaQ
Definition
ControlledObject.hpp:25
iTaSC::ControlledObject::m_nc
unsigned int m_nc
Definition
ControlledObject.hpp:26
iTaSC::ControlledObject::m_Cq
e_matrix m_Cq
Definition
ControlledObject.hpp:27
iTaSC::Object
Definition
Object.hpp:20
e_scalar_vector
#define e_scalar_vector
Definition
eigen_types.hpp:44
e_scalar
#define e_scalar
Definition
eigen_types.hpp:38
e_zero_vector
#define e_zero_vector
Definition
eigen_types.hpp:40
e_identity_matrix
#define e_identity_matrix
Definition
eigen_types.hpp:43
e_zero_matrix
#define e_zero_matrix
Definition
eigen_types.hpp:45
e_matrix
#define e_matrix
Definition
eigen_types.hpp:41
iTaSC
Definition
Armature.cpp:14
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0