32 std::ofstream biorbdModelFile;
33 biorbdModelFile.open(pathToWrite.
relativePath().c_str());
36 biorbdModelFile <<
"version 3" << std::endl;
37 biorbdModelFile << std::endl;
40 biorbdModelFile << std::endl;
41 biorbdModelFile << comment <<
" General informations" << std::endl;
42 biorbdModelFile << std::endl;
45 std::vector<utils::RotoTrans> localJCS = model.
localJCS();
46 for (
size_t i = 0; i < model.
nbSegment(); ++i) {
47 biorbdModelFile << comment <<
" Informations about "
48 << model.
segment(i).
name() <<
" segment" << std::endl;
49 biorbdModelFile << sep << comment <<
" Segment" << std::endl;
50 biorbdModelFile << sep <<
"segment" << sep << model.
segment(i).
name()
52 biorbdModelFile << sep << sep <<
"parent" << sep
54 biorbdModelFile << sep << sep <<
"RTinMatrix" << sep <<
true << std::endl;
55 biorbdModelFile << sep << sep <<
"RT" << std::endl;
56 for (
size_t j = 0; j < 4; ++j) {
57 biorbdModelFile << sep << sep << sep << localJCS[i].block(j, 0, 1, 4)
61 biorbdModelFile << sep << sep <<
"translations" << sep
65 biorbdModelFile << sep << sep <<
"rotations" << sep
68 const std::vector<utils::Range>& qRanges = model.
segment(i).
QRanges();
69 if (qRanges.size() > 0) {
70 biorbdModelFile << sep << sep <<
"rangesQ" << std::endl;
71 for (
size_t j = 0; j < qRanges.size(); ++j) {
72 biorbdModelFile << sep << sep << sep << qRanges[j].min() << sep
73 << qRanges[j].max() << std::endl;
76 const std::vector<utils::Range>& qdotRanges =
78 if (qdotRanges.size() > 0) {
79 biorbdModelFile << sep << sep <<
"rangesQdot" << std::endl;
80 for (
size_t j = 0; j < qdotRanges.size(); ++j) {
81 biorbdModelFile << sep << sep << sep << qdotRanges[j].min() << sep
82 << qdotRanges[j].max() << std::endl;
85 const std::vector<utils::Range>& qddotRanges =
87 if (qddotRanges.size() > 0) {
88 biorbdModelFile << sep << sep <<
"rangesQddot" << std::endl;
89 for (
size_t j = 0; j < qddotRanges.size(); ++j) {
90 biorbdModelFile << sep << sep << sep << qddotRanges[j].min() << sep
91 << qddotRanges[j].max() << std::endl;
94 biorbdModelFile << sep << sep <<
"jointDampings" << sep;
96 biorbdModelFile << sep << damping;
98 biorbdModelFile << std::endl;
99 biorbdModelFile << sep << sep <<
"mass" << sep
101 biorbdModelFile << sep << sep <<
"inertia" << std::endl
106 << sep << sep <<
"com" << sep
112 << sep << sep <<
"meshfile" << sep
116 << sep << sep <<
"meshcolor" << sep
120 << sep << sep <<
"meshscale" << sep
124 << sep << sep <<
"meshrt" << sep
138 biorbdModelFile << sep <<
"endsegment" << sep << std::endl;
139 biorbdModelFile << std::endl;
142 std::vector<rigidbody::NodeSegment> markers(
144 if (markers.size() > 0) {
145 biorbdModelFile << sep << comment <<
" Markers" << std::endl;
146 for (
size_t j = 0; j < markers.size(); ++j) {
147 biorbdModelFile << sep <<
"marker" << sep
148 << markers[j].utils::Node::name() << std::endl;
149 biorbdModelFile << sep << sep <<
"parent" << sep << markers[j].parent()
151 biorbdModelFile << sep << sep <<
"position" << sep
152 << markers[j].transpose() << std::endl;
153 biorbdModelFile << sep << sep <<
"technical" << sep
154 << markers[j].isTechnical() << std::endl;
155 biorbdModelFile << sep << sep <<
"anatomical" << sep
156 << markers[j].isAnatomical() << std::endl;
157 if (markers[j].nbAxesToRemove() != 0) {
158 biorbdModelFile << sep << sep <<
"axestoremove" << sep
159 << markers[j].axesToRemoveAsString() << std::endl;
161 biorbdModelFile << sep <<
"endmarker" << sep << std::endl;
164 biorbdModelFile << std::endl;
167 std::vector<rigidbody::IMU> imus(model.
IMU(model.
segment(i).
name()));
168 if (imus.size() > 0) {
169 biorbdModelFile << sep << comment <<
" Inertial Magnetic Unit"
171 for (
size_t j = 0; j < imus.size(); ++j) {
172 biorbdModelFile << sep <<
"imu" << sep << imus[j].utils::Node::name()
174 biorbdModelFile << sep << sep <<
"parent" << sep << imus[j].parent()
176 biorbdModelFile << sep << sep <<
"RTinMatrix" << sep <<
true
178 biorbdModelFile << sep << sep <<
"RT" << std::endl;
179 for (
size_t k = 0; k < 4; ++k) {
180 biorbdModelFile << sep << sep << sep << imus[j].block(k, 0, 1, 4)
183 biorbdModelFile << sep << sep <<
"technical" << sep
184 << imus[j].isTechnical() << std::endl;
185 biorbdModelFile << sep << sep <<
"anatomical" << sep
186 << imus[j].isAnatomical() << std::endl;
187 biorbdModelFile << sep <<
"endimu" << sep << std::endl;
192 std::vector<utils::RotoTransNode> rts(model.
RTs(model.
segment(i).
name()));
193 if (rts.size() > 0) {
194 biorbdModelFile << sep << comment <<
" Custom RT" << std::endl;
195 for (
size_t j = 0; j < rts.size(); ++j) {
196 biorbdModelFile << sep <<
"customRT" << sep
197 << rts[j].utils::Node::name() << std::endl;
198 biorbdModelFile << sep << sep <<
"parent" << sep << rts[j].parent()
200 biorbdModelFile << sep << sep <<
"RTinMatrix" << sep <<
true
202 biorbdModelFile << sep << sep <<
"RT" << std::endl;
203 for (
size_t k = 0; k < 4; ++k) {
204 biorbdModelFile << sep << sep << sep << rts[j].block(k, 0, 1, 4)
207 biorbdModelFile << sep <<
"endcustomrt" << sep << std::endl;
210 biorbdModelFile << std::endl;
211 biorbdModelFile << std::endl;
213 biorbdModelFile << std::endl;
214 biorbdModelFile << std::endl;
215 biorbdModelFile << std::endl;
216 biorbdModelFile << std::endl;
217 biorbdModelFile << std::endl;
218 biorbdModelFile << std::endl;
220 biorbdModelFile << std::endl;
222 biorbdModelFile.close();
const std::vector< rigidbody::IMU > & IMU() const
Return all the IMU in the local reference of the segment.
std::vector< utils::RotoTrans > localJCS() const
Return all the joint coordinate system (JCS) in its parent reference frame.
std::vector< NodeSegment > markers(bool removeAxis=true) const
Return a copy of all the markers in their respective parent reference frame.
utils::Vector3d & getScale() const
Get the scaling applied to the vertex wrt to 0, 0, 0.
const std::vector< utils::RotoTransNode > & RTs() const
Return all the RTs in the local reference of the segment.
const std::vector< utils::Range > & QRanges() const
Return the ranges for all the dof, translations and rotations respectively.
const std::vector< utils::Range > & QdotRanges() const
Return the ranges for all the dof velocity, translations and rotations respectively.
const std::vector< utils::Scalar > & jointDampings() const
Return the joint damping to apply to the dynamics.
const std::vector< utils::Range > & QddotRanges() const
Return the ranges for all the dof acceleration, translations and rotations respectively.