We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 644b42b commit e8c67caCopy full SHA for e8c67ca
doc/XMLreference.rst
@@ -3003,8 +3003,13 @@ cable, which produces an inextensible chain of bodies connected with ball joints
3003
.. _body-composite-offset:
3004
3005
:at:`offset`: :at-val:`real(3), "0 0 0"`
3006
- It specifies a 3D offset from the center of the parent body to the center of the grid of elements. The offset is
3007
- expressed in the local coordinate frame of the parent body.
+ It specifies a 3D offset from the center of the parent body to the center of the first body of the cable. The offset
+ is expressed in the local coordinate frame of the parent body.
3008
+
3009
+.. _body-composite-quat:
3010
3011
+:at:`quat`: :at-val:`real(4), "1 0 0 0"`
3012
+ It specifies a quaternion that rotates the first body frame. The quaternion is expressed in the parent body frame.
3013
3014
.. _body-composite-vertex:
3015
doc/XMLschema.rst
@@ -344,6 +344,8 @@
344
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
345
| | | | :ref:`vertex<body-composite-vertex>` | :ref:`initial<body-composite-initial>` | :ref:`curve<body-composite-curve>` | :ref:`size<body-composite-size>` | |
346
347
+| | | | :ref:`quat<body-composite-quat>` | | | | |
348
+| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
349
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
350
| |_2| composite |br| |_2| |L| | | .. table:: |
351
| :ref:`joint | \* | :class: mjcf-attributes |
doc/changelog.rst
@@ -11,6 +11,11 @@ Upcoming version (not yet released)
11
- The default value of the flag for toggling :ref:`internal flex contacts<flex-contact-internal>` was changed from
12
"true" to "false". This feature has proven to be counterintuitive for users.
13
14
+General
15
+^^^^^^^
16
+- Add :ref:`orientation<body-composite-quat>` parameter to :ref:`composite<body-composite>`. Moreover, allow the
17
+ composite to be the direct child of a frame.
18
19
Bug fixes
20
^^^^^^^^^
21
- :ref:`mj_jacDot` was missing a term that accounts for the motion of the point with respect to
src/user/user_composite.cc
@@ -52,6 +52,7 @@ mjCComposite::mjCComposite(void) {
52
type = mjCOMPTYPE_PARTICLE;
53
count[0] = count[1] = count[2] = 1;
54
mjuu_setvec(offset, 0, 0, 0);
55
+ mjuu_setvec(quat, 1, 0, 0, 0);
56
frame = nullptr;
57
58
// plugin variables
@@ -260,26 +261,29 @@ bool mjCComposite::MakeCable(mjCModel* model, mjsBody* body, char* error, int er
260
261
// populate uservert if not specified
262
if (uservert.empty()) {
263
for (int ix=0; ix < count[0]; ix++) {
264
+ double v[3];
265
for (int k=0; k < 3; k++) {
266
switch (curve[k]) {
267
case mjCOMPSHAPE_LINE:
- uservert.push_back(ix*size[0]/(count[0]-1));
268
+ v[k] = ix*size[0]/(count[0]-1);
269
break;
270
case mjCOMPSHAPE_COS:
- uservert.push_back(size[1]*cos(mjPI*ix*size[2]/(count[0]-1)));
271
+ v[k] = size[1]*cos(mjPI*ix*size[2]/(count[0]-1));
272
273
case mjCOMPSHAPE_SIN:
- uservert.push_back(size[1]*sin(mjPI*ix*size[2]/(count[0]-1)));
274
+ v[k] = size[1]*sin(mjPI*ix*size[2]/(count[0]-1));
275
276
case mjCOMPSHAPE_ZERO:
- uservert.push_back(0);
277
+ v[k] = 0;
278
279
default:
280
// SHOULD NOT OCCUR
281
mju_error("Invalid composite shape: %d", curve[k]);
282
283
}
284
285
+ mjuu_rotVecQuat(v, v, quat);
286
+ uservert.insert(uservert.end(), v, v+3);
287
288
289
src/user/user_composite.h
@@ -73,7 +73,8 @@ class mjCComposite {
73
std::string prefix; // name prefix
74
mjtCompType type; // composite type
75
int count[3]; // geom count in each dimension
76
- double offset[3]; // position offset for particle and grid
+ double offset[3]; // position offset
77
+ double quat[4]; // quaternion offset
78
79
// currently used only for cable
80
std::string initial; // root boundary type
src/xml/xml_native_reader.cc
@@ -287,8 +287,8 @@ const char* MJCF[nMJCF][mjXATTRNUM] = {
{"<"},
{"config", "*", "2", "key", "value"},
{">"},
290
- {"composite", "*", "8", "prefix", "type", "count", "offset",
291
- "vertex", "initial", "curve", "size"},
+ {"composite", "*", "9", "prefix", "type", "count", "offset",
+ "vertex", "initial", "curve", "size", "quat"},
292
293
{"joint", "*", "17", "kind", "group", "stiffness", "damping", "armature",
294
"solreffix", "solimpfix", "type", "axis",
@@ -2402,6 +2402,7 @@ void mjXReader::OneComposite(XMLElement* elem, mjsBody* body, mjsFrame* frame, c
2402
2403
ReadAttr(elem, "count", 3, comp.count, text, false, false);
2404
ReadAttr(elem, "offset", 3, comp.offset, text);
2405
+ ReadAttr(elem, "quat", 4, comp.quat, text);
2406
comp.frame = frame;
2407
2408
// plugin
0 commit comments