ubi-agni / mujoco_ros_pkgs

Wrappers, tools and additional API's for using ROS with MuJoCo
54 stars 11 forks source link

Expand macro mjENABLED #2

Closed balandbal closed 2 years ago

balandbal commented 2 years ago

The macro mjENABLED defined in line 47 of mujoco.h was apparently not included and was breaking the build. The macro is adapted and expanded to fit the naming scheme.

DavidPL1 commented 2 years ago

As far as I understand, the problem is not, that the macro is not included, but it relies on a static mjModel called m. I like the enable and disable macros because they enhance readability, but I am trying to move away from functions using the static context and instead taking the variables as arguments. I think redefining the macros in my own headers as

#define mjENABLED_ros(model, x) (model->opt.enableflags & (x))
#define mjDISABLED_ros(model, x) (model->opt.disableflags & (x))

would be more elegant. What do you think?

balandbal commented 2 years ago

I agree; it makes more sense to me, too. Shall I add the definitions in mujoco_sim.h?