|
| 1 | +# MuJoCo Physics Plugin |
| 2 | + |
| 3 | +## Physics features list |
| 4 | + |
| 5 | +These are the specific physics API features implemented. |
| 6 | + |
| 7 | +### EntityManagementFeatureList |
| 8 | + |
| 9 | +```c++ |
| 10 | + |
| 11 | +struct EntityManagementFeatureList : FeatureList< |
| 12 | + GetEngineInfo, |
| 13 | + GetWorldFromEngine, |
| 14 | + GetLinkFromModel, |
| 15 | + GetModelFromWorld, |
| 16 | + GetShapeFromLink, |
| 17 | + RemoveEntities, |
| 18 | + ConstructEmptyWorldFeature |
| 19 | + // ConstructEmptyModelFeature, |
| 20 | + // ConstructEmptyLinkFeature |
| 21 | + // CollisionFilterMaskFeature, |
| 22 | + // WorldModelFeature |
| 23 | +> { }; |
| 24 | + |
| 25 | +``` |
| 26 | +
|
| 27 | +TODO: |
| 28 | +
|
| 29 | +- [ ] (S) Get entities by name |
| 30 | +- [ ] (S) Get an entities index |
| 31 | +- [ ] (M) Remove models |
| 32 | +
|
| 33 | +### FreeGroupFeatureList |
| 34 | +
|
| 35 | +```c++ |
| 36 | +struct FreeGroupFeatureList : gz::physics::FeatureList< |
| 37 | + FindFreeGroupFeature, |
| 38 | + SetFreeGroupWorldPose, |
| 39 | + SetFreeGroupWorldVelocity |
| 40 | +> { }; |
| 41 | +``` |
| 42 | + |
| 43 | +TODO: |
| 44 | + |
| 45 | +- [ ] (S) Implement checks to see if a given model has a freegroup in `FindFreeGroupFeature`. |
| 46 | +- [x] (S) Set linear and angular velocities on a freegroup. |
| 47 | +- [x] (S) Set pose on a freegroup |
| 48 | + |
| 49 | +### KinematicsFeatureList |
| 50 | + |
| 51 | +```c++ |
| 52 | +struct KinematicsFeatureList : FeatureList< |
| 53 | + LinkFrameSemantics, |
| 54 | + ShapeFrameSemantics, |
| 55 | + JointFrameSemantics, |
| 56 | + FreeGroupFrameSemantics |
| 57 | +> { }; |
| 58 | +``` |
| 59 | +
|
| 60 | +TODO: |
| 61 | +
|
| 62 | +- [ ] (S) Compute frame data for shapes |
| 63 | +- [ ] (S) Compute frame data for joints |
| 64 | + - I'm not sure if this is actually needed by gz-sim. |
| 65 | +
|
| 66 | +### SDFFeatureList |
| 67 | +
|
| 68 | +```c++ |
| 69 | +struct SDFFeatureList : FeatureList< |
| 70 | + sdf::ConstructSdfWorld, |
| 71 | + sdf::ConstructSdfModel |
| 72 | +> { }; |
| 73 | +``` |
| 74 | + |
| 75 | +TODO: |
| 76 | + |
| 77 | +- [ ] (S) Resolve SDFormat frames before instead of using raw poses |
| 78 | +- [ ] (S) Apply poses of collisions |
| 79 | +- [ ] (M) Support nested models |
| 80 | +- [ ] (M) Support joints |
| 81 | +- [ ] (S) ConstructSdfCollisions |
| 82 | + |
| 83 | +### SimulationFeatureList |
| 84 | + |
| 85 | +```c++ |
| 86 | +struct SimulationFeatureList : gz::physics::FeatureList< |
| 87 | + ForwardStep |
| 88 | +> { }; |
| 89 | +``` |
| 90 | +
|
| 91 | +TODO: |
| 92 | +
|
| 93 | +- [ ] Report only links with changed poses instead of all the links. |
| 94 | +
|
| 95 | +## Features to Implement for a fully viable engine, but with some missing features |
| 96 | +
|
| 97 | +```c++ |
| 98 | +
|
| 99 | +struct JointFeatureList : FeatureList< |
| 100 | + GetBasicJointState, |
| 101 | + SetBasicJointState, |
| 102 | + GetBasicJointProperties, |
| 103 | +
|
| 104 | + SetJointVelocityCommandFeature, |
| 105 | + SetJointPositionLimitsFeature, |
| 106 | + SetJointVelocityLimitsFeature, |
| 107 | + SetJointEffortLimitsFeature, |
| 108 | +
|
| 109 | + SetJointTransformFromParentFeature, |
| 110 | + AttachFixedJointFeature, |
| 111 | + DetachJointFeature, |
| 112 | +
|
| 113 | + GetRevoluteJointProperties, |
| 114 | + GetPrismaticJointProperties, |
| 115 | + FixedJointCast, |
| 116 | + GetJointTransmittedWrench, |
| 117 | +> { }; |
| 118 | +``` |
| 119 | + |
| 120 | +```c++ |
| 121 | +struct KinematicLinkFeatureList : FeatureList< |
| 122 | + KinematicLink |
| 123 | +> { }; |
| 124 | +``` |
| 125 | +
|
| 126 | +```c++ |
| 127 | +struct LinkFeatureList : FeatureList< |
| 128 | + AddLinkExternalForceTorque |
| 129 | +> { }; |
| 130 | +``` |
| 131 | + |
| 132 | + |
| 133 | +```c++ |
| 134 | + |
| 135 | +struct SimulationFeatureList : gz::physics::FeatureList< |
| 136 | + ForwardStep, |
| 137 | + GetContactsFromLastStepFeature |
| 138 | +> { }; |
| 139 | +``` |
| 140 | +
|
| 141 | +- The GetContactsFromLastStepFeature feature is missing |
| 142 | +
|
| 143 | +``` |
| 144 | + |
| 145 | +struct WorldFeatureList : FeatureList< |
| 146 | + Gravity, |
| 147 | +> { }; |
| 148 | +``` |
| 149 | +
|
| 150 | +
|
| 151 | +
|
| 152 | +## Notes |
| 153 | +
|
| 154 | +The Physics system in Gazebo requires the following features at a minimum: |
| 155 | +
|
| 156 | +```c++ |
| 157 | + /// \brief This is the minimum set of features that any physics engine must |
| 158 | + /// implement to be supported by this system. |
| 159 | + /// New features can't be added to this list in minor / patch releases, in |
| 160 | + /// order to maintain backwards compatibility with downstream physics plugins. |
| 161 | + public: struct MinimumFeatureList : physics::FeatureList< |
| 162 | + physics::FindFreeGroupFeature, |
| 163 | + physics::SetFreeGroupWorldPose, |
| 164 | + physics::FreeGroupFrameSemantics, |
| 165 | + physics::LinkFrameSemantics, |
| 166 | + physics::ForwardStep, |
| 167 | + physics::RemoveModelFromWorld, |
| 168 | + physics::sdf::ConstructSdfModel, |
| 169 | + physics::sdf::ConstructSdfWorld, |
| 170 | + physics::GetLinkFromModel, |
| 171 | + physics::GetShapeFromLink |
| 172 | + >{}; |
| 173 | +``` |
| 174 | + |
| 175 | +In addition to these, the following is a minimal list of features should be |
| 176 | +implemented to evaluate MuJoCo in gz-sim. |
| 177 | + |
| 178 | +```c++ |
| 179 | + /// Feature list to handle joints. |
| 180 | + struct JointFeatureList : physics::FeatureList< |
| 181 | + MinimumFeatureList, |
| 182 | + physics::GetJointFromModel, |
| 183 | + physics::GetBasicJointProperties, |
| 184 | + physics::GetBasicJointState, |
| 185 | + physics::SetBasicJointState>{}; |
| 186 | +``` |
| 187 | +
|
| 188 | +```c++ |
| 189 | +
|
| 190 | + // Joint transmitted wrench |
| 191 | + /// \brief Feature list for getting joint transmitted wrenches. |
| 192 | + public: struct JointGetTransmittedWrenchFeatureList : physics::FeatureList< |
| 193 | + physics::GetJointTransmittedWrench>{}; |
| 194 | +``` |
| 195 | + |
| 196 | +```c++ |
| 197 | + // Joint velocity command |
| 198 | + /// \brief Feature list for set joint velocity command. |
| 199 | + public: struct JointVelocityCommandFeatureList : physics::FeatureList< |
| 200 | + physics::SetJointVelocityCommandFeature>{}; |
| 201 | +``` |
| 202 | +
|
| 203 | +Not sure if this is needed for meshes. |
| 204 | +
|
| 205 | +```c++ |
| 206 | + /// \brief Feature list to handle collisions. |
| 207 | + public: struct CollisionFeatureList : physics::FeatureList< |
| 208 | + MinimumFeatureList, |
| 209 | + physics::sdf::ConstructSdfCollision>{}; |
| 210 | + // Meshes |
| 211 | + /// \brief Feature list for meshes. |
| 212 | + /// Include MinimumFeatureList so created collision can be automatically |
| 213 | + /// up-cast. |
| 214 | + public: struct MeshFeatureList : physics::FeatureList< |
| 215 | + CollisionFeatureList, |
| 216 | + physics::mesh::AttachMeshShapeFeature>{}; |
| 217 | +``` |
| 218 | + |
| 219 | +```c++ |
| 220 | + // Nested Models |
| 221 | + /// \brief Feature list to construct nested models |
| 222 | + public: struct NestedModelFeatureList : physics::FeatureList< |
| 223 | + MinimumFeatureList, |
| 224 | + physics::sdf::ConstructSdfNestedModel>{}; |
| 225 | +``` |
| 226 | +
|
| 227 | +1. Critical gz-sim Requirements (Highest Priority) |
| 228 | + - Set Model Pose: The `SetFreeGroupWorldPose` function is not implemented. |
| 229 | + - Remove Models: The `RemoveModelFromWorld` function is not implemented. |
| 230 | +
|
| 231 | +2. Major Missing Features |
| 232 | + - Joints: The entire `JointFeatureList` is missing, which prevents all joint functionality (creation, state access, commanding, feedback). |
| 233 | + - Contact Reporting: `GetContactsFromLastStepFeature` is not implemented, so contact sensor data is unavailable. |
| 234 | + - External Forces: `AddLinkExternalForceTorque` is not implemented. |
| 235 | + - World Properties: The `WorldFeatureList` (including Gravity) is not implemented. |
| 236 | +
|
| 237 | +3. Incomplete Features & Specific Runtime Construction Limitations |
| 238 | + - Whole Model Runtime Construction: This is supported. New, complete models can be added to the world after startup. |
| 239 | + - Piecemeal Runtime Construction: The ability to add individual components to existing models at runtime is missing. This includes: |
| 240 | + - `AttachMeshShapeFeature` (adding a mesh to an existing link). |
| 241 | + - `ConstructSdfCollision` (adding a collision to an existing link). |
| 242 | + - SDF & Model Loading Details: |
| 243 | + - SDF frames are not fully resolved (uses `RawPose`). |
| 244 | + - Support for nested models is incomplete. |
| 245 | + - Heightmap and Polyline geometries are not supported. |
| 246 | + - Entity Management: Functions to find entities by name or get their index are stubbed. |
| 247 | + - Kinematics: Calculating frame data for shapes and joints is a TODO. |
| 248 | + - Simulation Step: Pose updates are inefficient (all links are reported as changed). |
0 commit comments