Throw an error if multiple orientation specifiers are used in the same element.

- Applies to [orientation specifiers](https://mujoco.readthedocs.io/en/latest/modeling.html#frame-orientations) in `body`, `inertial`, `geom`, `site`, `camera`.
- Before this change the check was done only for multiple *alternative* specifiers, but not for `quat` and an alternative specifier.
- Moved the check from the compiler to the parser.
- Added tests.

PiperOrigin-RevId: 453201981
Change-Id: I20907361f211dae904e734cd083e9df0efe4f654
This commit is contained in:
Alessio Quaglino
2022-06-06 08:12:32 -07:00
committed by Copybara-Service
parent 652bab3eec
commit 16baac9353
4 changed files with 52 additions and 16 deletions
-10
View File
@@ -120,16 +120,6 @@ mjCAlternative::mjCAlternative() {
// used for geom, site, body and camera frames
const char* mjCAlternative::Set(double* quat, double* inertia,
bool degree, const char* sequence) {
// check for multiple defitions
int ndef = (int)mjuu_defined(axisangle[0]) +
(int)mjuu_defined(xyaxes[0]) +
(int)mjuu_defined(zaxis[0]) +
(int)mjuu_defined(euler[0]) +
(int)mjuu_defined(fullinertia[0]);
if (ndef>1) {
return "too many alternative definitions";
}
// set quat using axisangle
if (mjuu_defined(axisangle[0])) {
// convert to radians if necessary, normalize axis