Prevent uninitialized memory during a copy of joints and actuators.

PiperOrigin-RevId: 653340718
Change-Id: Icc5ada05abd590504c157311a309f9b8493feac9
This commit is contained in:
Alessio Quaglino
2024-07-17 13:21:06 -07:00
committed by Copybara-Service
parent dbe18f5740
commit dd9dd295ba
+11 -9
View File
@@ -385,6 +385,12 @@ class mjCJoint_ : public mjCBase {
protected:
mjCBody* body; // joint's body
// variable used for temporarily storing the state of the joint
int qposadr_; // address of dof in data->qpos
int dofadr_; // address of dof in data->qvel
mjtNum qpos[7]; // qpos at the previous step
mjtNum qvel[6]; // qvel at the previous step
// variable-size data
std::vector<double> userdata_;
std::vector<double> spec_userdata_;
@@ -420,11 +426,6 @@ class mjCJoint : public mjCJoint_, private mjsJoint {
private:
int Compile(void); // compiler; return dofnum
void PointToLocal(void);
int qposadr_; // address of dof in data->qpos
int dofadr_; // address of dof in data->qvel
mjtNum qpos[7]; // qpos at the previous step
mjtNum qvel[6]; // qvel at the previous step
};
@@ -1362,6 +1363,11 @@ class mjCActuator_ : public mjCBase {
protected:
int trnid[2]; // id of transmission target
// variable used for temporarily storing the state of the actuator
int actadr_; // address of dof in data->act
int actnum_; // number of dofs in data->act
std::vector<mjtNum> act; // act at the previous step
// variable-size data
std::string plugin_name;
std::string plugin_instance_name;
@@ -1407,10 +1413,6 @@ class mjCActuator : public mjCActuator_, private mjsActuator {
void NameSpace(const mjCModel* m);
mjCBase* ptarget; // transmission target
int actadr_; // address of dof in data->act
int actnum_; // number of dofs in data->act
std::vector<mjtNum> act; // act at the previous step
};