This repository was archived by the owner on Nov 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
include/sot/dynamic-pinocchio Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1717/* STD */
1818#include < string>
1919#include < map>
20+ #include < memory>
2021
2122/* SOT */
2223#include < pinocchio/fwd.hpp>
2930#include < sot/core/matrix-geometry.hh>
3031/* Matrix */
3132#include < dynamic-graph/linear-algebra.h>
33+ #include < sot/dynamic-pinocchio/deprecated.hh>
3234
3335/* PINOCCHIO */
3436#include < pinocchio/macros.hpp>
@@ -80,7 +82,7 @@ class SOTDYNAMIC_EXPORT DynamicPinocchio : public dg::Entity {
8082
8183 /* --- MODEL ATRIBUTES --- */
8284 pinocchio::Model* m_model;
83- pinocchio::Data* m_data;
85+ std::unique_ptr< pinocchio::Data> m_data;
8486
8587 /* --- MODEL ATRIBUTES --- */
8688
@@ -164,11 +166,15 @@ class SOTDYNAMIC_EXPORT DynamicPinocchio : public dg::Entity {
164166
165167 void setModel (pinocchio::Model*);
166168
167- void setData (pinocchio::Data*);
169+ void createData ();
170+
171+ // / \deprecated this function does nothing. This class has its own
172+ // / pinocchio::Data object, which can be access with \ref getData.
173+ void setData (pinocchio::Data*) SOT_DYNAMIC_PINOCCHIO_DEPRECATED;
168174
169175 pinocchio::Model* getModel () { return m_model; };
170176
171- pinocchio::Data* getData () { return m_data; };
177+ pinocchio::Data* getData () { return m_data. get () ; };
172178
173179 /* --- GETTERS --- */
174180
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ BOOST_PYTHON_MODULE(wrap)
2020 bp::make_function (&dgs::DynamicPinocchio::getData, reference_existing_object ()),
2121 bp::make_function (&dgs::DynamicPinocchio::setData))
2222 .def (" setModel" , &dgs::DynamicPinocchio::setModel)
23+ .def (" createData" , &dgs::DynamicPinocchio::createData)
2324 .def (" setData" , &dgs::DynamicPinocchio::setData)
2425 ;
2526}
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ const std::string dg::sot::DynamicPinocchio::CLASS_NAME = "DynamicPinocchio";
3535DynamicPinocchio::DynamicPinocchio (const std::string& name)
3636 : Entity(name),
3737 m_model(NULL ),
38- m_data(NULL )
38+ m_data()
3939
4040 ,
4141 jointPositionSIN(NULL , " sotDynamicPinocchio(" + name + " )::input(vector)::position" ),
@@ -241,9 +241,15 @@ void DynamicPinocchio::setModel(pinocchio::Model* modelPtr) {
241241 if (pinocchio::nq (this ->m_model ->joints [i]) == 4 ) // Spherical Joint Only
242242 sphericalJoints.push_back (pinocchio::idx_v (this ->m_model ->joints [i]));
243243 }
244+
245+ createData ();
244246}
245247
246- void DynamicPinocchio::setData (pinocchio::Data* dataPtr) { this ->m_data = dataPtr; }
248+ void DynamicPinocchio::setData (pinocchio::Data*) {}
249+
250+ void DynamicPinocchio::createData () {
251+ m_data.reset (new pinocchio::Data (*m_model));
252+ }
247253
248254/* --------------------------------GETTERS-------------------------------------------*/
249255
You can’t perform that action at this time.
0 commit comments