Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Markers.h
1#ifndef BIORBD_RIGIDBODY_MARKERS_H
2#define BIORBD_RIGIDBODY_MARKERS_H
3
4#include "biorbdConfig.h"
5
6#include <memory>
7#include <vector>
8
9namespace BIORBD_NAMESPACE {
10namespace utils {
11class String;
12class Matrix;
13class Vector3d;
14} // namespace utils
15
16namespace rigidbody {
20class NodeSegment;
21class Joints;
22
26class BIORBD_API Markers {
27 public:
31 Markers();
32
37 Markers(const Markers &other);
38
42 virtual ~Markers();
43
48 Markers DeepCopy() const;
49
54 void DeepCopy(const Markers &other);
55
66 void addMarker(
67 const NodeSegment &pos,
68 const utils::String &name,
69 const utils::String &parentName,
70 bool technical,
71 bool anatomical,
72 const utils::String &axesToRemove,
73 int id = -1);
74
82 void setMarker(size_t index, const NodeSegment &pos);
83
88 std::vector<utils::String> markerNames() const;
89
94 std::vector<utils::String> technicalMarkerNames() const;
95
100 std::vector<utils::String> anatomicalMarkerNames() const;
101
107 const NodeSegment &marker(size_t idx) const;
108
115 NodeSegment markerAxesRemoved(size_t idx) const;
116
127 rigidbody::Joints &updatedModel,
128 const GeneralizedCoordinates &Q,
129 const NodeSegment &node,
130 bool removeAxis = true);
131
142 const GeneralizedCoordinates &Q,
143 const NodeSegment &node,
144 bool updateKin = true,
145 bool removeAxis = true);
146
157 rigidbody::Joints &updatedModel,
158 const GeneralizedCoordinates &Q,
159 size_t idx,
160 bool removeAxis = true);
161
172 const GeneralizedCoordinates &Q,
173 size_t idx,
174 bool updateKin = true,
175 bool removeAxis = true);
176
183 std::vector<NodeSegment> markers(bool removeAxis = true) const;
184
191 std::vector<NodeSegment> markers(
192 const utils::String &segmentName,
193 bool removeAxis = true) const;
194
202 std::vector<NodeSegment> markers(
203 rigidbody::Joints &updatedModel,
204 const GeneralizedCoordinates &Q,
205 bool removeAxis = true);
206
214 std::vector<NodeSegment> markers(
215 const GeneralizedCoordinates &Q,
216 bool updateKin = true,
217 bool removeAxis = true);
218
229 rigidbody::Joints &updatedModel,
230 const GeneralizedCoordinates &Q,
231 const GeneralizedVelocity &Qdot,
232 size_t idx,
233 bool removeAxis = true);
234
245 const GeneralizedCoordinates &Q,
246 const GeneralizedVelocity &Qdot,
247 size_t idx,
248 bool updateKin = true,
249 bool removeAxis = true);
250
261 rigidbody::Joints &updatedModel,
262 const GeneralizedCoordinates &Q,
263 const GeneralizedVelocity &Qdot,
264 size_t idx,
265 bool removeAxis = true);
266
277 const GeneralizedCoordinates &Q,
278 const GeneralizedVelocity &Qdot,
279 size_t idx,
280 bool updateKin = true,
281 bool removeAxis = true);
282
291 std::vector<NodeSegment> markersVelocity(
292 rigidbody::Joints &updatedModel,
293 const GeneralizedCoordinates &Q,
294 const GeneralizedVelocity &Qdot,
295 bool removeAxis = true);
296
305 std::vector<NodeSegment> markersVelocity(
306 const GeneralizedCoordinates &Q,
307 const GeneralizedVelocity &Qdot,
308 bool updateKin = true,
309 bool removeAxis = true);
310
319 std::vector<NodeSegment> markersAngularVelocity(
320 rigidbody::Joints &updatedModel,
321 const GeneralizedCoordinates &Q,
322 const GeneralizedVelocity &Qdot,
323 bool removeAxis = true);
324
333 std::vector<NodeSegment> markersAngularVelocity(
334 const GeneralizedCoordinates &Q,
335 const GeneralizedVelocity &Qdot,
336 bool updateKin = true,
337 bool removeAxis = true);
338
350 rigidbody::Joints &updatedModel,
351 const GeneralizedCoordinates &Q,
352 const GeneralizedVelocity &Qdot,
354 size_t idx,
355 bool removeAxis = true);
356
368 const GeneralizedCoordinates &Q,
369 const GeneralizedVelocity &Qdot,
371 size_t idx,
372 bool updateKin = true,
373 bool removeAxis = true);
374
384 std::vector<NodeSegment> markerAcceleration(
385 rigidbody::Joints &updatedModel,
386 const GeneralizedCoordinates &Q,
387 const GeneralizedVelocity &Qdot,
389 bool removeAxis = true);
390
400 std::vector<NodeSegment> markerAcceleration(
401 const GeneralizedCoordinates &Q,
402 const GeneralizedVelocity &Qdot,
404 bool updateKin = true,
405 bool removeAxis = true);
406
415 std::vector<NodeSegment> technicalMarkers(
416 rigidbody::Joints &updatedModel,
417 const GeneralizedCoordinates &Q,
418 bool removeAxis = true);
419
428 std::vector<NodeSegment> technicalMarkers(
429 const GeneralizedCoordinates &Q,
430 bool updateKin = true,
431 bool removeAxis = true);
432
439 std::vector<NodeSegment> technicalMarkers() const;
440
447 std::vector<NodeSegment> technicalMarkersAxesRemoved() const;
448
457 std::vector<NodeSegment> anatomicalMarkers(
458 rigidbody::Joints &updatedModel,
459 const GeneralizedCoordinates &Q,
460 bool removeAxis = true);
461
470 std::vector<NodeSegment> anatomicalMarkers(
471 const GeneralizedCoordinates &Q,
472 bool updateKin = true,
473 bool removeAxis = true);
474
481 std::vector<NodeSegment> anatomicalMarkers() const;
482
489 std::vector<NodeSegment> anatomicalMarkersAxesRemoved() const;
490
500 std::vector<NodeSegment> segmentMarkers(
501 rigidbody::Joints &updatedModel,
502 const GeneralizedCoordinates &Q,
503 size_t idx,
504 bool removeAxis = true);
505
515 std::vector<NodeSegment> segmentMarkers(
516 const GeneralizedCoordinates &Q,
517 size_t idx,
518 bool updateKin = true,
519 bool removeAxis = true);
520
525 size_t nbMarkers() const;
526
532 size_t nbMarkers(size_t idxSegment) const;
533
538 size_t nbTechnicalMarkers();
539
545 size_t nbTechnicalMarkers(size_t idxSegment);
546
551 size_t nbAnatomicalMarkers();
552
560 std::vector<utils::Matrix> markersJacobian(
561 rigidbody::Joints &updatedModel,
562 const GeneralizedCoordinates &Q,
563 bool removeAxis = true);
564
572 std::vector<utils::Matrix> markersJacobian(
573 const GeneralizedCoordinates &Q,
574 bool updateKin = true,
575 bool removeAxis = true);
576
584 std::vector<utils::Matrix> technicalMarkersJacobian(
585 rigidbody::Joints &updatedModel,
586 const GeneralizedCoordinates &Q,
587 bool removeAxis = true);
588
596 std::vector<utils::Matrix> technicalMarkersJacobian(
597 const GeneralizedCoordinates &Q,
598 bool updateKin = true,
599 bool removeAxis = true);
600
611 rigidbody::Joints &updatedModel,
612 const GeneralizedCoordinates &Q,
613 const utils::String &parentName,
614 const NodeSegment &p,
615 bool removeAxis = true);
616
627 const GeneralizedCoordinates &Q,
628 const utils::String &parentName,
629 const NodeSegment &p,
630 bool updateKin = true,
631 bool removeAxis = true);
632
633#ifndef BIORBD_USE_CASADI_MATH
643 const std::vector<NodeSegment> &markers,
644 const GeneralizedCoordinates &Qinit,
646 bool removeAxis = true);
647#endif
648
649 protected:
658 std::vector<utils::Matrix> markersJacobian(
659 rigidbody::Joints &updatedModel,
660 const GeneralizedCoordinates &Q,
661 bool lookForTechnical,
662 bool removeAxis);
663
664 std::shared_ptr<std::vector<NodeSegment>> m_marks;
665};
666
667} // namespace rigidbody
668} // namespace BIORBD_NAMESPACE
669
670#endif // BIORBD_RIGIDBODY_MARKERS_H
This is the core of the musculoskeletal model in biorbd.
Definition Joints.h:48
const NodeSegment & marker(size_t idx) const
Return a marker of index idx in the marker set.
Definition Markers.cpp:72
std::vector< NodeSegment > anatomicalMarkers(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, bool removeAxis=true)
Return all the anatomical markers at a given Q in the global reference frame.
Definition Markers.cpp:435
NodeSegment markerVelocity(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, const GeneralizedVelocity &Qdot, size_t idx, bool removeAxis=true)
Return the linear velocity of a marker.
Definition Markers.cpp:185
std::vector< NodeSegment > technicalMarkersAxesRemoved() const
Return the technical markers in their respective parent reference frame.
Definition Markers.cpp:426
void setMarker(size_t index, const NodeSegment &pos)
Change the values of a specific marker without changing other parameters.
Definition Markers.cpp:60
std::vector< NodeSegment > markersVelocity(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, const GeneralizedVelocity &Qdot, bool removeAxis=true)
Return the linear velocity of all the markers.
Definition Markers.cpp:253
NodeSegment markerAngularVelocity(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, const GeneralizedVelocity &Qdot, size_t idx, bool removeAxis=true)
Return the angular velocity of a marker.
Definition Markers.cpp:216
void addMarker(const NodeSegment &pos, const utils::String &name, const utils::String &parentName, bool technical, bool anatomical, const utils::String &axesToRemove, int id=-1)
Add a marker to the set.
Definition Markers.cpp:47
std::vector< utils::String > anatomicalMarkerNames() const
Return the names of all the anatomical markers.
Definition Markers.cpp:731
std::vector< NodeSegment > anatomicalMarkersAxesRemoved() const
Return the anatomical markers in their respective parent reference frame.
Definition Markers.cpp:475
Markers()
Construct a marker set.
Definition Markers.cpp:21
bool inverseKinematics(const std::vector< NodeSegment > &markers, const GeneralizedCoordinates &Qinit, GeneralizedCoordinates &Q, bool removeAxis=true)
Performs an inverse kinematics.
Definition Markers.cpp:612
std::vector< utils::String > technicalMarkerNames() const
Return the names of all the technical markers.
Definition Markers.cpp:720
std::vector< NodeSegment > technicalMarkers(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, bool removeAxis=true)
Return all the technical markers at a given Q in the global reference frame.
Definition Markers.cpp:384
std::vector< NodeSegment > markersAngularVelocity(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, const GeneralizedVelocity &Qdot, bool removeAxis=true)
Return the angular velocity of all the markers.
Definition Markers.cpp:283
std::vector< NodeSegment > markers(bool removeAxis=true) const
Return a copy of all the markers in their respective parent reference frame.
Definition Markers.cpp:133
std::vector< utils::Matrix > markersJacobian(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, bool removeAxis=true)
Return the jacobian of the markers.
Definition Markers.cpp:538
std::vector< NodeSegment > segmentMarkers(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, size_t idx, bool removeAxis=true)
Return all the markers of the segment idx at a given Q in the global reference frame.
Definition Markers.cpp:483
Markers DeepCopy() const
Deep copy of the markers.
Definition Markers.cpp:33
std::vector< utils::String > markerNames() const
Return the names of all the markers.
Definition Markers.cpp:710
size_t nbTechnicalMarkers()
Return the number of technical markers.
Definition Markers.cpp:670
size_t nbAnatomicalMarkers()
Return the number of anatomical markers.
Definition Markers.cpp:699
size_t nbMarkers() const
Return the number of markers.
Definition Markers.cpp:518
std::shared_ptr< std::vector< NodeSegment > > m_marks
The markers.
Definition Markers.h:664
NodeSegment markerAcceleration(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, const GeneralizedVelocity &Qdot, const rigidbody::GeneralizedAcceleration &Qddot, size_t idx, bool removeAxis=true)
Return the acceleration of a marker.
Definition Markers.cpp:311
std::vector< utils::Matrix > technicalMarkersJacobian(rigidbody::Joints &updatedModel, const GeneralizedCoordinates &Q, bool removeAxis=true)
Return the jacobian of the technical markers.
Definition Markers.cpp:561
NodeSegment markerAxesRemoved(size_t idx) const
Return a marker of index idx in the marker set with the axes removed.
Definition Markers.cpp:76
A point attached to a segment, generally speaking a skin marker.
Definition NodeSegment.h:20
A wrapper for the Eigen::MatrixXd.
Definition Matrix.h:18
Wrapper around the std::string class with augmented functionality.
Definition String.h:18
Wrapper around Eigen Vector3d and attach it to a parent.
Definition Vector3d.h:27