Skip to content

Commit 8a80a00

Browse files
Merge pull request #9 from dic-iit/feature/get
Add the posibility to get the internal state of the controller
2 parents 5204bd8 + d541d5a commit 8a80a00

3 files changed

Lines changed: 114 additions & 0 deletions

File tree

include/LieGroupControllers/impl/ControllerBase.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@ template <class _Derived> class ControllerBase
8080
* express the vector in a different tangent space.
8181
*/
8282
const Vector& getControl() const;
83+
84+
/**
85+
* Get the state of the system.
86+
* @return the state of the system.
87+
*/
88+
const State& getState() const;
89+
90+
/**
91+
* Get the desired state of the system.
92+
* @return the state of the system.
93+
*/
94+
const State& getDesiredState() const;
95+
96+
/**
97+
* Get the feedforward term.
98+
* @return the controller feedforward.
99+
*/
100+
const Vector& getFeedForward() const;
83101
};
84102

85103
template <class _Derived>
@@ -118,6 +136,24 @@ const typename ControllerBase<_Derived>::Vector& ControllerBase<_Derived>::getCo
118136
return this->derived().getControl();
119137
}
120138

139+
template <class _Derived>
140+
const typename ControllerBase<_Derived>::State& ControllerBase<_Derived>::getState() const
141+
{
142+
return this->derived().getState();
143+
}
144+
145+
template <class _Derived>
146+
const typename ControllerBase<_Derived>::State& ControllerBase<_Derived>::getDesiredState() const
147+
{
148+
return this->derived().getDesiredState();
149+
}
150+
151+
template <class _Derived>
152+
const typename ControllerBase<_Derived>::Vector& ControllerBase<_Derived>::getFeedForward() const
153+
{
154+
return this->derived().getFeedForward();
155+
}
156+
121157
} // namespace LieGroupControllers
122158

123159
#endif // LIE_GROUP_CONTROLLERS_IMPL_CONTROLLER_BASE_H

include/LieGroupControllers/impl/ProportionalController/ControllerBase.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ template <typename _Derived> class ProportionalControllerBase : public Controlle
7070
* express the vector in a different tangent space.
7171
*/
7272
const Vector& getControl() const;
73+
74+
/**
75+
* Get the state of the system.
76+
* @return the state of the system.
77+
*/
78+
const State& getState() const;
79+
80+
/**
81+
* Get the desired state of the system.
82+
* @return the state of the system.
83+
*/
84+
const State& getDesiredState() const;
85+
86+
/**
87+
* Get the feedforward term.
88+
* @return the controller feedforward.
89+
*/
90+
const Vector& getFeedForward() const;
7391
};
7492

7593
template <typename _Derived> bool ProportionalControllerBase<_Derived>::setState(const State& state)
@@ -114,6 +132,27 @@ ProportionalControllerBase<_Derived>::getControl() const
114132
return m_controlOutput;
115133
}
116134

135+
template <class _Derived>
136+
const typename ProportionalControllerBase<_Derived>::State&
137+
ProportionalControllerBase<_Derived>::getState() const
138+
{
139+
return m_state;
140+
}
141+
142+
template <class _Derived>
143+
const typename ProportionalControllerBase<_Derived>::State&
144+
ProportionalControllerBase<_Derived>::getDesiredState() const
145+
{
146+
return m_desiredState;
147+
}
148+
149+
template <class _Derived>
150+
const typename ProportionalControllerBase<_Derived>::Vector&
151+
ProportionalControllerBase<_Derived>::getFeedForward() const
152+
{
153+
return m_feedForward;
154+
}
155+
117156
} // namespace LieGroupControllers
118157

119158
#endif // LIE_GROUP_CONTROLLERS_IMPL_PROPORTIONAL_CONTROLLER_CONTROLLER_BASE_H

include/LieGroupControllers/impl/ProportionalDerivativeController/ControllerBase.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ class ProportionalDerivativeControllerBase : public ControllerBase<_Derived>
7474
* express the vector in a different tangent space.
7575
*/
7676
const Vector& getControl() const;
77+
78+
/**
79+
* Get the state of the system.
80+
* @return the state of the system.
81+
*/
82+
const State& getState() const;
83+
84+
/**
85+
* Get the desired state of the system.
86+
* @return the state of the system.
87+
*/
88+
const State& getDesiredState() const;
89+
90+
/**
91+
* Get the feedforward term.
92+
* @return the controller feedforward.
93+
*/
94+
const Vector& getFeedForward() const;
7795
};
7896

7997
template <typename _Derived>
@@ -130,6 +148,27 @@ ProportionalDerivativeControllerBase<_Derived>::getControl() const
130148
return m_controlOutput;
131149
}
132150

151+
template <class _Derived>
152+
const typename ProportionalDerivativeControllerBase<_Derived>::State&
153+
ProportionalDerivativeControllerBase<_Derived>::getState() const
154+
{
155+
return m_state;
156+
}
157+
158+
template <class _Derived>
159+
const typename ProportionalDerivativeControllerBase<_Derived>::State&
160+
ProportionalDerivativeControllerBase<_Derived>::getDesiredState() const
161+
{
162+
return m_desiredState;
163+
}
164+
165+
template <class _Derived>
166+
const typename ProportionalDerivativeControllerBase<_Derived>::Vector&
167+
ProportionalDerivativeControllerBase<_Derived>::getFeedForward() const
168+
{
169+
return m_feedForward;
170+
}
171+
133172
} // namespace LieGroupControllers
134173

135174
#endif // LIE_GROUP_CONTROLLERS_IMPL_PROPORTIONAL_DERIVATIVE_CONTROLLER_CONTROLLER_BASE_H

0 commit comments

Comments
 (0)