DART 6.10.1
Loading...
Searching...
No Matches
Recording.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2021, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * This code incorporates portions of Open Dynamics Engine
19 * (Copyright (c) 2001-2004, Russell L. Smith. All rights
20 * reserved.) and portions of FCL (Copyright (c) 2011, Willow
21 * Garage, Inc. All rights reserved.), which were released under
22 * the same BSD license as below
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
25 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
26 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
32 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
33 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef DART_SIMULATION_RECORDING_HPP_
40#define DART_SIMULATION_RECORDING_HPP_
41
42#include <vector>
43
44#include <Eigen/Dense>
45
47
48namespace dart {
49
50namespace dynamics {
51class Skeleton;
52} // namespace dynamics
53
54namespace simulation {
55
58{
59public:
61 explicit Recording(const std::vector<dynamics::SkeletonPtr>& _skeletons);
62
64 explicit Recording(const std::vector<int>& _skelDofs);
65
67 virtual ~Recording();
68
70 int getNumFrames() const;
71
73 int getNumSkeletons() const;
74
77 int getNumDofs(int _skelIdx) const;
78
80 int getNumContacts(int _frameIdx) const;
81
84 Eigen::VectorXd getConfig(int _frameIdx, int _skelIdx) const;
85
88 double getGenCoord(int _frameIdx, int _skelIdx, int _dofIdx) const;
89
92 Eigen::Vector3d getContactPoint(int _frameIdx, int _contactIdx) const;
93
96 Eigen::Vector3d getContactForce(int _frameIdx, int _contactIdx) const;
97
99 void clear();
100
102 void addState(const Eigen::VectorXd& _state);
103
105 void updateNumGenCoords(const std::vector<dynamics::SkeletonPtr>& _skeletons);
106
107private:
109 std::vector<Eigen::VectorXd> mBakedStates;
110
113};
114
115} // namespace simulation
116} // namespace dart
117
118#endif // DART_SIMULATION_RECORDING_HPP_
class Recording
Definition Recording.hpp:58
Eigen::Vector3d getContactForce(int _frameIdx, int _contactIdx) const
Get contact force whose index is _contactIdx at frame number _frameIdx.
Definition Recording.cpp:122
void addState(const Eigen::VectorXd &_state)
Add state.
Definition Recording.cpp:137
std::vector< int > mNumGenCoordsForSkeletons
Number of generalized coordinates for skeletons.
Definition Recording.hpp:112
double getGenCoord(int _frameIdx, int _skelIdx, int _dofIdx) const
Get _dofIdx-th single configruation of a skeleton whose index is _skelIdx at frame number _frameIdx.
Definition Recording.cpp:104
int getNumContacts(int _frameIdx) const
Get number of contacts at frame number _frameIdx.
Definition Recording.cpp:86
int getNumDofs(int _skelIdx) const
Get number of generalized coordinates of skeleton whoes index is _skelIdx.
Definition Recording.cpp:80
int getNumSkeletons() const
Get number of skeletons.
Definition Recording.cpp:74
std::vector< Eigen::VectorXd > mBakedStates
Baked states.
Definition Recording.hpp:109
int getNumFrames() const
Get number of frames.
Definition Recording.cpp:68
void clear()
Clear the saved histories.
Definition Recording.cpp:131
virtual ~Recording()
Destructor.
Definition Recording.cpp:63
Eigen::VectorXd getConfig(int _frameIdx, int _skelIdx) const
Get skeleton configurations whose index is _skelIdx at frame number _frameIdx.
Definition Recording.cpp:95
void updateNumGenCoords(const std::vector< dynamics::SkeletonPtr > &_skeletons)
Update list for number of generalized coordinates.
Definition Recording.cpp:143
Eigen::Vector3d getContactPoint(int _frameIdx, int _contactIdx) const
Get contact point whose index is _contactIdx at frame number _frameIdx.
Definition Recording.cpp:113
Definition BulletCollisionDetector.cpp:65