Cosmetic improvements to public headers.

PiperOrigin-RevId: 521415262
Change-Id: Iee5d6baec78242f5a033c8b5cdd285af4a0895fa
This commit is contained in:
Yuval Tassa
2023-04-03 03:48:41 -07:00
committed by Copybara-Service
parent 5f132af625
commit 64229c089a
7 changed files with 64 additions and 69 deletions
+18 -20
View File
@@ -509,12 +509,12 @@ typedef enum mjtConstraint_ { // type of constraint
mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone
mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone
} mjtConstraint; } mjtConstraint;
typedef enum mjtConstraintState_ { // constraint state typedef enum mjtConstraintState_ { // constraint state
mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact)
mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact)
mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction)
mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction)
mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact)
} mjtConstraintState; } mjtConstraintState;
typedef enum mjtSensor_ { // type of sensor typedef enum mjtSensor_ { // type of sensor
// common robotic sensors, attached to a site // common robotic sensors, attached to a site
@@ -1234,11 +1234,11 @@ typedef enum mjtGridPos_ { // grid position for overlay
mjGRID_BOTTOMLEFT, // bottom left mjGRID_BOTTOMLEFT, // bottom left
mjGRID_BOTTOMRIGHT // bottom right mjGRID_BOTTOMRIGHT // bottom right
} mjtGridPos; } mjtGridPos;
typedef enum mjtFramebuffer_ { // OpenGL framebuffer option typedef enum mjtFramebuffer_ { // OpenGL framebuffer option
mjFB_WINDOW = 0, // default/window buffer mjFB_WINDOW = 0, // default/window buffer
mjFB_OFFSCREEN // offscreen buffer mjFB_OFFSCREEN // offscreen buffer
} mjtFramebuffer; } mjtFramebuffer;
typedef enum mjtFontScale_ { // font scale, used at context creation typedef enum mjtFontScale_ { // font scale, used at context creation
mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering
mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling
mjFONTSCALE_150 = 150, // 150% scale mjFONTSCALE_150 = 150, // 150% scale
@@ -1467,9 +1467,9 @@ struct mjuiItemSingle_ { // check and button-related
}; };
struct mjuiItemMulti_ { // static, radio and select-related struct mjuiItemMulti_ { // static, radio and select-related
int nelem; // number of elements in group int nelem; // number of elements in group
char name[mjMAXUIMULTI][mjMAXUINAME]; // element names char name[mjMAXUIMULTI][mjMAXUINAME]; // element names
}; };
@@ -1496,10 +1496,10 @@ struct mjuiItem_ { // UI item
// type-specific properties // type-specific properties
union { union {
struct mjuiItemSingle_ single; // check and button struct mjuiItemSingle_ single; // check and button
struct mjuiItemMulti_ multi; // static, radio and select struct mjuiItemMulti_ multi; // static, radio and select
struct mjuiItemSlider_ slider; // slider struct mjuiItemSlider_ slider; // slider
struct mjuiItemEdit_ edit; // edit struct mjuiItemEdit_ edit; // edit
}; };
// internal // internal
@@ -1825,7 +1825,7 @@ struct mjvFigure_ { // abstract 2D figure passed to OpenGL rendere
// text labels // text labels
char title[1000]; // figure title; subplots separated with 2+ spaces char title[1000]; // figure title; subplots separated with 2+ spaces
char xlabel[100]; // x-axis label char xlabel[100]; // x-axis label
char linename[mjMAXLINE][100]; // line names for legend char linename[mjMAXLINE][100]; // line names for legend
// dynamic settings // dynamic settings
int legendoffset; // number of lines to offset legend int legendoffset; // number of lines to offset legend
@@ -1853,10 +1853,8 @@ int mj_makeEmptyFileVFS(mjVFS* vfs, const char* filename, int filesize);
int mj_findFileVFS(const mjVFS* vfs, const char* filename); int mj_findFileVFS(const mjVFS* vfs, const char* filename);
int mj_deleteFileVFS(mjVFS* vfs, const char* filename); int mj_deleteFileVFS(mjVFS* vfs, const char* filename);
void mj_deleteVFS(mjVFS* vfs); void mj_deleteVFS(mjVFS* vfs);
mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
char* error, int error_sz); int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int error_sz);
int mj_saveLastXML(const char* filename, const mjModel* m,
char* error, int error_sz);
void mj_freeLastXML(void); void mj_freeLastXML(void);
int mj_printSchema(const char* filename, char* buffer, int buffer_sz, int mj_printSchema(const char* filename, char* buffer, int buffer_sz,
int flg_html, int flg_pad); int flg_html, int flg_pad);
+6 -6
View File
@@ -255,12 +255,12 @@ typedef enum mjtConstraint_ { // type of constraint
} mjtConstraint; } mjtConstraint;
typedef enum mjtConstraintState_ { // constraint state typedef enum mjtConstraintState_ { // constraint state
mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact)
mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact)
mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction)
mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction)
mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact)
} mjtConstraintState; } mjtConstraintState;
+25 -25
View File
@@ -66,36 +66,36 @@ typedef struct mjpPlugin_ mjpPlugin;
#if defined(__has_attribute) #if defined(__has_attribute)
#if __has_attribute(constructor) #if __has_attribute(constructor)
#define mjPLUGIN_DYNAMIC_LIBRARY_INIT \ #define mjPLUGIN_DYNAMIC_LIBRARY_INIT \
__attribute__((constructor)) static void _mjplugin_init(void) __attribute__((constructor)) static void _mjplugin_init(void)
#endif #endif // __has_attribute(constructor)
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#ifndef mjDLLMAIN #ifndef mjDLLMAIN
#define mjDLLMAIN DllMain #define mjDLLMAIN DllMain
#endif #endif
#if !defined(mjEXTERNC) #if !defined(mjEXTERNC)
#if defined(__cplusplus) #if defined(__cplusplus)
#define mjEXTERNC extern "C" #define mjEXTERNC extern "C"
#else #else
#define mjEXTERNC #define mjEXTERNC
#endif // defined(__cplusplus) #endif // defined(__cplusplus)
#endif // !defined(mjEXTERNC) #endif // !defined(mjEXTERNC)
// NOLINTBEGIN(runtime/int) // NOLINTBEGIN(runtime/int)
#define mjPLUGIN_DYNAMIC_LIBRARY_INIT \ #define mjPLUGIN_DYNAMIC_LIBRARY_INIT \
static void _mjplugin_dllmain(void); \ static void _mjplugin_dllmain(void); \
mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \ mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \
if (reason == 1) { \ if (reason == 1) { \
_mjplugin_dllmain(); \ _mjplugin_dllmain(); \
} \ } \
return 1; \ return 1; \
} \ } \
static void _mjplugin_dllmain(void) static void _mjplugin_dllmain(void)
// NOLINTEND(runtime/int) // NOLINTEND(runtime/int)
#endif // defined(_MSC_VER) #endif // defined(_MSC_VER)
+2 -3
View File
@@ -15,7 +15,6 @@
#ifndef MUJOCO_MJRENDER_H_ #ifndef MUJOCO_MJRENDER_H_
#define MUJOCO_MJRENDER_H_ #define MUJOCO_MJRENDER_H_
#include <mujoco/mjmodel.h>
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
@@ -35,13 +34,13 @@ typedef enum mjtGridPos_ { // grid position for overlay
} mjtGridPos; } mjtGridPos;
typedef enum mjtFramebuffer_ { // OpenGL framebuffer option typedef enum mjtFramebuffer_ { // OpenGL framebuffer option
mjFB_WINDOW = 0, // default/window buffer mjFB_WINDOW = 0, // default/window buffer
mjFB_OFFSCREEN // offscreen buffer mjFB_OFFSCREEN // offscreen buffer
} mjtFramebuffer; } mjtFramebuffer;
typedef enum mjtFontScale_ { // font scale, used at context creation typedef enum mjtFontScale_ { // font scale, used at context creation
mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering
mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling
mjFONTSCALE_150 = 150, // 150% scale mjFONTSCALE_150 = 150, // 150% scale
+7 -7
View File
@@ -207,9 +207,9 @@ struct mjuiItemSingle_ { // check and button-related
}; };
struct mjuiItemMulti_ { // static, radio and select-related struct mjuiItemMulti_ { // static, radio and select-related
int nelem; // number of elements in group int nelem; // number of elements in group
char name[mjMAXUIMULTI][mjMAXUINAME]; // element names char name[mjMAXUIMULTI][mjMAXUINAME]; // element names
}; };
@@ -236,10 +236,10 @@ struct mjuiItem_ { // UI item
// type-specific properties // type-specific properties
union { union {
struct mjuiItemSingle_ single; // check and button struct mjuiItemSingle_ single; // check and button
struct mjuiItemMulti_ multi; // static, radio and select struct mjuiItemMulti_ multi; // static, radio and select
struct mjuiItemSlider_ slider; // slider struct mjuiItemSlider_ slider; // slider
struct mjuiItemEdit_ edit; // edit struct mjuiItemEdit_ edit; // edit
}; };
// internal // internal
+2 -2
View File
@@ -16,7 +16,7 @@
#define MUJOCO_MJVISUALIZE_H_ #define MUJOCO_MJVISUALIZE_H_
#include <mujoco/mjtnum.h> #include <mujoco/mjtnum.h>
#include <mujoco/mjmodel.h>
#define mjNGROUP 6 // number of geom, site, joint, skin groups with visflags #define mjNGROUP 6 // number of geom, site, joint, skin groups with visflags
#define mjMAXLIGHT 100 // maximum number of lights in a scene #define mjMAXLIGHT 100 // maximum number of lights in a scene
@@ -339,7 +339,7 @@ struct mjvFigure_ { // abstract 2D figure passed to OpenGL rendere
// text labels // text labels
char title[1000]; // figure title; subplots separated with 2+ spaces char title[1000]; // figure title; subplots separated with 2+ spaces
char xlabel[100]; // x-axis label char xlabel[100]; // x-axis label
char linename[mjMAXLINE][100]; // line names for legend char linename[mjMAXLINE][100]; // line names for legend
// dynamic settings // dynamic settings
int legendoffset; // number of lines to offset legend int legendoffset; // number of lines to offset legend
+4 -6
View File
@@ -114,13 +114,11 @@ MJAPI void mj_deleteVFS(mjVFS* vfs);
// Parse XML file in MJCF or URDF format, compile it, return low-level model. // Parse XML file in MJCF or URDF format, compile it, return low-level model.
// If vfs is not NULL, look up files in vfs before reading from disk. // If vfs is not NULL, look up files in vfs before reading from disk.
// If error is not NULL, it must have size error_sz. // If error is not NULL, it must have size error_sz.
MJAPI mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, MJAPI mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
char* error, int error_sz);
// Update XML data structures with info from low-level model, save as MJCF. // Update XML data structures with info from low-level model, save as MJCF.
// If error is not NULL, it must have size error_sz. // If error is not NULL, it must have size error_sz.
MJAPI int mj_saveLastXML(const char* filename, const mjModel* m, MJAPI int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int error_sz);
char* error, int error_sz);
// Free last XML model if loaded. Called internally at each load. // Free last XML model if loaded. Called internally at each load.
MJAPI void mj_freeLastXML(void); MJAPI void mj_freeLastXML(void);
@@ -786,8 +784,8 @@ MJAPI void mj_deactivate(void);
//---------------------------------- Standard math ------------------------------------------------- //---------------------------------- Standard math -------------------------------------------------
#define mjMAX(a,b) (((a) > (b)) ? (a) : (b)) #define mjMAX(a, b) (((a) > (b)) ? (a) : (b))
#define mjMIN(a,b) (((a) < (b)) ? (a) : (b)) #define mjMIN(a, b) (((a) < (b)) ? (a) : (b))
#ifdef mjUSEDOUBLE #ifdef mjUSEDOUBLE
#define mju_sqrt sqrt #define mju_sqrt sqrt