Skip to content

Commit 7afa307

Browse files
committed
[#1392] Fix MuJoCo message write argument order
Several MuJoCo C++ output writes passed CurrentSimNanos where the module ID belongs, and the module ID where the write time belongs. Use the C++ messaging signature order of payload, moduleID, callTime so output headers carry the correct author and simulation timestamp. Also update matching Python test helper subclasses to use the Python wrapper signature order of payload, time, moduleID.
1 parent bab836a commit 7afa307

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/simulation/mujocoDynamics/_GeneralModuleFiles/PIDController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class PIDController : public StatefulSysModel
151151

152152
auto& payload = outputOutMsg.zeroMsgPayload;
153153
writeOutput(payload, outputVal);
154-
outputOutMsg.write(&payload, CurrentSimNanos, this->moduleID);
154+
outputOutMsg.write(&payload, this->moduleID, CurrentSimNanos);
155155
}
156156

157157
public:

src/simulation/mujocoDynamics/linearTimeInvariantSystem/_UnitTest/test_linearTimeInvariantSystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def writeOutput(self, CurrentSimNanos, y):
9898
# Write y[0] to SingleActuatorMsg
9999
payload = messaging.SingleActuatorMsgPayload()
100100
payload.input = y[0][0]
101-
self.outMsg.write(payload, self.moduleID, CurrentSimNanos)
101+
self.outMsg.write(payload, CurrentSimNanos, self.moduleID)
102102

103103
system = PyFirstOrderLTI()
104104

src/simulation/mujocoDynamics/stochasticAtmDensity/_UnitTest/test_stochasticAtmDensity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def writeOutput(self, CurrentSimNanos, x):
7878
payload = messaging.AtmoPropsMsgPayload(
7979
neutralDensity = self.atmoDensInMsg().neutralDensity * (1 + x)
8080
)
81-
self.atmoDensOutMsg.write(payload, self.moduleID, CurrentSimNanos)
81+
self.atmoDensOutMsg.write(payload, CurrentSimNanos, self.moduleID)
8282

8383
stochasticAtm = PyStochasticAtmDensity()
8484

src/simulation/mujocoDynamics/stochasticAtmDensity/stochasticAtmDensity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ void StochasticAtmDensity::writeOutput(uint64_t CurrentSimNanos, double x)
2222
{
2323
AtmoPropsMsgPayload out = atmoDensInMsg();
2424
out.neutralDensity *= 1.0 + x;
25-
atmoDensOutMsg.write(&out, CurrentSimNanos, this->moduleID);
25+
atmoDensOutMsg.write(&out, this->moduleID, CurrentSimNanos);
2626
}

src/simulation/mujocoDynamics/stochasticDragCoeff/stochasticDragCoeff.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ void StochasticDragCoeff::writeOutput(uint64_t CurrentSimNanos, double x)
2222
{
2323
DragGeometryMsgPayload out = dragGeomInMsg();
2424
out.dragCoeff *= (1.0 + x);
25-
dragGeomOutMsg.write(&out, CurrentSimNanos, this->moduleID);
25+
dragGeomOutMsg.write(&out, this->moduleID, CurrentSimNanos);
2626
}

0 commit comments

Comments
 (0)