Remove arbitrary limit of a 1000 elements from certain attributes. Fixes #2166.
PiperOrigin-RevId: 689343609 Change-Id: I7cbf5007884433807c76c6c309cb4a858479d34d
This commit is contained in:
committed by
Copybara-Service
parent
ca348632a9
commit
1043633cc3
@@ -4258,8 +4258,6 @@ void mjXReader::Sensor(XMLElement* section) {
|
|||||||
// keyframe section parser
|
// keyframe section parser
|
||||||
void mjXReader::Keyframe(XMLElement* section) {
|
void mjXReader::Keyframe(XMLElement* section) {
|
||||||
XMLElement* elem;
|
XMLElement* elem;
|
||||||
int n;
|
|
||||||
double data[1000];
|
|
||||||
|
|
||||||
// iterate over child elements
|
// iterate over child elements
|
||||||
elem = FirstChildElement(section);
|
elem = FirstChildElement(section);
|
||||||
@@ -4275,39 +4273,39 @@ void mjXReader::Keyframe(XMLElement* section) {
|
|||||||
ReadAttr(elem, "time", 1, &key->time, text);
|
ReadAttr(elem, "time", 1, &key->time, text);
|
||||||
|
|
||||||
// read qpos
|
// read qpos
|
||||||
n = ReadAttr(elem, "qpos", 1000, data, text, false, false);
|
auto maybe_data = ReadAttrVec<double>(elem, "qpos", false);
|
||||||
if (n) {
|
if (maybe_data.has_value()) {
|
||||||
mjs_setDouble(key->qpos, data, n);
|
mjs_setDouble(key->qpos, maybe_data->data(), maybe_data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// read qvel
|
// read qvel
|
||||||
n = ReadAttr(elem, "qvel", 1000, data, text, false, false);
|
maybe_data = ReadAttrVec<double>(elem, "qvel", false);
|
||||||
if (n) {
|
if (maybe_data.has_value()) {
|
||||||
mjs_setDouble(key->qvel, data, n);
|
mjs_setDouble(key->qvel, maybe_data->data(), maybe_data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// read act
|
// read act
|
||||||
n = ReadAttr(elem, "act", 1000, data, text, false, false);
|
maybe_data = ReadAttrVec<double>(elem, "act", false);
|
||||||
if (n) {
|
if (maybe_data.has_value()) {
|
||||||
mjs_setDouble(key->act, data, n);
|
mjs_setDouble(key->act, maybe_data->data(), maybe_data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// read mpos
|
// read mpos
|
||||||
n = ReadAttr(elem, "mpos", 1000, data, text, false, false);
|
maybe_data = ReadAttrVec<double>(elem, "mpos", false);
|
||||||
if (n) {
|
if (maybe_data.has_value()) {
|
||||||
mjs_setDouble(key->mpos, data, n);
|
mjs_setDouble(key->mpos, maybe_data->data(), maybe_data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// read mquat
|
// read mquat
|
||||||
n = ReadAttr(elem, "mquat", 1000, data, text, false, false);
|
maybe_data = ReadAttrVec<double>(elem, "mquat", false);
|
||||||
if (n) {
|
if (maybe_data.has_value()) {
|
||||||
mjs_setDouble(key->mquat, data, n);
|
mjs_setDouble(key->mquat, maybe_data->data(), maybe_data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// read ctrl
|
// read ctrl
|
||||||
n = ReadAttr(elem, "ctrl", 1000, data, text, false, false);
|
maybe_data = ReadAttrVec<double>(elem, "ctrl", false);
|
||||||
if (n) {
|
if (maybe_data.has_value()) {
|
||||||
mjs_setDouble(key->ctrl, data, n);
|
mjs_setDouble(key->ctrl, maybe_data->data(), maybe_data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// advance to next element
|
// advance to next element
|
||||||
|
|||||||
Reference in New Issue
Block a user