Fix formatting of large unsigned numbers in mju_warningText.
PiperOrigin-RevId: 479902611 Change-Id: Ia7187478a246b8b068684e75d6f3851d749844c9
This commit is contained in:
committed by
Copybara-Service
parent
c2f1381f31
commit
1a393429ef
@@ -1087,7 +1087,7 @@ MJAPI const char* mju_type2Str(int type);
|
||||
MJAPI int mju_str2Type(const char* str);
|
||||
|
||||
// Construct a warning message given the warning type and info.
|
||||
MJAPI const char* mju_warningText(int warning, int info);
|
||||
MJAPI const char* mju_warningText(int warning, size_t info);
|
||||
|
||||
// Return 1 if nan or abs(x)>mjMAXVAL, 0 otherwise. Used by check functions.
|
||||
MJAPI int mju_isBad(mjtNum x);
|
||||
|
||||
@@ -6886,7 +6886,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='info',
|
||||
type=ValueType(name='int'),
|
||||
type=ValueType(name='size_t'),
|
||||
),
|
||||
),
|
||||
doc='Construct a warning message given the warning type and info.',
|
||||
|
||||
@@ -947,45 +947,45 @@ int mju_str2Type(const char* str) {
|
||||
|
||||
|
||||
// warning text
|
||||
const char* mju_warningText(int warning, int info) {
|
||||
const char* mju_warningText(int warning, size_t info) {
|
||||
static char str[1000];
|
||||
|
||||
switch (warning) {
|
||||
case mjWARN_INERTIA:
|
||||
mjSNPRINTF(str, "Inertia matrix is too close to singular at DOF %d. Check model.", info);
|
||||
mjSNPRINTF(str, "Inertia matrix is too close to singular at DOF %zu. Check model.", info);
|
||||
break;
|
||||
|
||||
case mjWARN_CONTACTFULL:
|
||||
mjSNPRINTF(str,
|
||||
"Too many contacts. Either the arena memory is full, or nconmax is specified and is "
|
||||
"exceeded. Increase arena memory allocation, or increase/remove nconmax. "
|
||||
"(ncon = %d)", info);
|
||||
"(ncon = %zu)", info);
|
||||
break;
|
||||
|
||||
case mjWARN_CNSTRFULL:
|
||||
mjSNPRINTF(str,
|
||||
"Insufficient arena memory for the number of constraints generated. "
|
||||
"Increase arena memory allocation above %d bytes.", info);
|
||||
"Increase arena memory allocation above %zu bytes.", info);
|
||||
break;
|
||||
|
||||
case mjWARN_VGEOMFULL:
|
||||
mjSNPRINTF(str, "Pre-allocated visual geom buffer is full. Increase maxgeom above %d.", info);
|
||||
mjSNPRINTF(str, "Pre-allocated visual geom buffer is full. Increase maxgeom above %zu.", info);
|
||||
break;
|
||||
|
||||
case mjWARN_BADQPOS:
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in QPOS at DOF %d. The simulation is unstable.", info);
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in QPOS at DOF %zu. The simulation is unstable.", info);
|
||||
break;
|
||||
|
||||
case mjWARN_BADQVEL:
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in QVEL at DOF %d. The simulation is unstable.", info);
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in QVEL at DOF %zu. The simulation is unstable.", info);
|
||||
break;
|
||||
|
||||
case mjWARN_BADQACC:
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in QACC at DOF %d. The simulation is unstable.", info);
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in QACC at DOF %zu. The simulation is unstable.", info);
|
||||
break;
|
||||
|
||||
case mjWARN_BADCTRL:
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in CTRL at ACTUATOR %d. The simulation is unstable.",
|
||||
mjSNPRINTF(str, "Nan, Inf or huge value in CTRL at ACTUATOR %zu. The simulation is unstable.",
|
||||
info);
|
||||
break;
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
//------------------------------ tendons and actuators ---------------------------------------------
|
||||
|
||||
// wrap tendons around spheres and cylinders
|
||||
@@ -86,7 +88,7 @@ MJAPI const char* mju_type2Str(int type);
|
||||
MJAPI int mju_str2Type(const char* str);
|
||||
|
||||
// warning text
|
||||
MJAPI const char* mju_warningText(int warning, int info);
|
||||
MJAPI const char* mju_warningText(int warning, size_t info);
|
||||
|
||||
// return 1 if nan or abs(x)>mjMAXVAL, 0 otherwise
|
||||
MJAPI int mju_isBad(mjtNum x);
|
||||
|
||||
@@ -3502,7 +3502,7 @@ public static unsafe extern int mju_str2Type([MarshalAs(UnmanagedType.LPStr)]str
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.LPStr)]
|
||||
public static unsafe extern string mju_warningText(int warning, int info);
|
||||
public static unsafe extern string mju_warningText(int warning, UIntPtr info);
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern int mju_isBad(double x);
|
||||
|
||||
Reference in New Issue
Block a user