Skip to content

docs: Add comprehensive friction parameters tutorial (fixes #258)#886

Open
strangerwhoisharborofdoom wants to merge 1 commit intogazebosim:gz-physics9from
strangerwhoisharborofdoom:strangerwhoisharborofdoom-patch-1
Open

docs: Add comprehensive friction parameters tutorial (fixes #258)#886
strangerwhoisharborofdoom wants to merge 1 commit intogazebosim:gz-physics9from
strangerwhoisharborofdoom:strangerwhoisharborofdoom-patch-1

Conversation

@strangerwhoisharborofdoom

Summary

This PR addresses issue #258 by adding a comprehensive tutorial (Tutorial 10) documenting friction parameters for Gazebo Physics engines.

Changes

  • Added tutorials/10_friction_parameters.md with detailed documentation on:
    • mu and mu2: Primary and secondary friction coefficients
    • slip1 and slip2: Longitudinal and lateral slip parameters
    • fdir1: Custom friction direction vector
    • expressed_in: Frame specification for DART engine

Tutorial Contents

The tutorial includes:

  • Detailed explanations of each friction parameter
  • SDF configuration examples for each parameter
  • Physics engine comparison table (DART, Bullet, TPE)
  • Practical robotics use cases (wheeled robots, legged robots, grippers)
  • Troubleshooting guide for common friction-related issues
  • Complete working SDF examples

Engine Support Documentation

Parameter DART Bullet TPE
mu ✓ Full ✓ Full ✓ Full
mu2 ✓ Full ✓ Full ⚠ Approx
slip1 ✓ Full ✓ Full ⚠ Limited
slip2 ✓ Full ✓ Full ⚠ Limited
fdir1 ✓ Full ⚠ Partial ✗ None
expressed_in ✓ Full ✗ None ✗ None

Related Issue

Fixes #258

Checklist

  • Signed all commits for DCO
  • Added tutorial following existing format
  • Referenced related issue
  • Included practical examples and use cases
  • Documented engine-specific differences

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Tutorial 10 intended to document SDF friction parameters and how they map to the Gazebo Physics engine plugins, addressing issue #258 by providing a single reference for friction tuning and engine differences.

Changes:

  • Added tutorials/10_friction_parameters.md friction-parameters tutorial with explanations, SDF snippets, and troubleshooting guidance.
  • Included an engine support comparison table (DART / Bullet / TPE) and a “complete” example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +209 to +213
| mu | ✓ Full | ✓ Full | ✓ Full |
| mu2 | ✓ Full | ✓ Full | ⚠ Approx |
| slip1 | ✓ Full | ✓ Full | ⚠ Limited |
| slip2 | ✓ Full | ✓ Full | ⚠ Limited |
| fdir1 | ✓ Full | ⚠ Partial | ✗ None |
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engine support claims for friction parameters appear incorrect vs the plugins in this repo. The Bullet plugin currently only supports mu / mu2 (see comment in bullet/src/SDFFeatures.cc), and TPE doesn’t appear to parse <surface><friction> at all, so marking slip1, slip2, and fdir1 as supported by Bullet/TPE is misleading. Please align the per-parameter “Engine Support” sections and the comparison table with what the DART/Bullet/TPE implementations actually read from SDF.

Suggested change
| mu | ✓ Full | ✓ Full | ✓ Full |
| mu2 | ✓ Full | ✓ Full | ⚠ Approx |
| slip1 | ✓ Full | ✓ Full | ⚠ Limited |
| slip2 | ✓ Full | ✓ Full | ⚠ Limited |
| fdir1 | ✓ Full | ⚠ Partial | ✗ None |
| mu | ✓ Full | ✓ Full | ✗ None |
| mu2 | ✓ Full | ✓ Full | ✗ None |
| slip1 | ✓ Full | ✗ None | ✗ None |
| slip2 | ✓ Full | ✗ None | ✗ None |
| fdir1 | ✓ Full | ✗ None | ✗ None |

Copilot uses AI. Check for mistakes.

### mu2 (Secondary Friction Coefficient)

The `mu2` parameter defines friction in the second friction direction (typically the y-axis of the contact surface). When `mu2` is 0, it defaults to the value of `mu`.
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is likely incorrect: setting mu2 to 0 will be treated as an explicit 0 secondary friction, not “default to mu”. In the DART plugin, mu2 is only applied when the element exists; if present (even 0), it’s used as-is. Recommend rewording to clarify that the defaulting behavior (if any) is about the element being omitted, not its value being 0.

Suggested change
The `mu2` parameter defines friction in the second friction direction (typically the y-axis of the contact surface). When `mu2` is 0, it defaults to the value of `mu`.
The `mu2` parameter defines friction in the second friction direction (typically the y-axis of the contact surface). If the `<mu2>` element is omitted, some engines may fall back to using the `mu` value; if `<mu2>` is present, its value (including `0`) is treated as the explicit secondary friction coefficient.

Copilot uses AI. Check for mistakes.
Comment on lines +162 to +166
**Common Frame Values:**
- `__model__`: Model frame
- `__world__`: World frame
- Link name: Specific link frame

Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Common Frame Values” list (__model__, __world__) doesn’t appear to be supported by the current DART parsing logic, which looks up a BodyNode by the attribute value. To avoid users copying non-working examples, consider changing this section to state that the value must match a link/body node name in the model (and document what happens if it can’t be found).

Copilot uses AI. Check for mistakes.
Comment on lines +89 to +97
**Engine Support:**
- DART: ✓ Fully supported
- Bullet: ✓ Supported
- TPE: ⚠ Limited support

### slip2 (Lateral Slip)

The `slip2` parameter defines slip in the secondary friction direction.

Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DART’s support for mu2 / slip1 / slip2 / fdir1 is guarded by DART_VERSION_AT_LEAST(6, 10, 0) in dartsim/src/SDFFeatures.cc. The tutorial currently presents these as unconditionally available in DART; please document the minimum DART version requirement (or note the fallback behavior for older DART versions) so readers don’t assume these parameters will work everywhere.

Copilot uses AI. Check for mistakes.
Comment on lines +269 to +280
- [SDF Specification - Surface](https://sdformat.org/spec)
- [DART Physics Engine Documentation](https://dartsim.github.io/)
- [Bullet Physics Documentation](https://pybullet.org/)
- [Gazebo Physics Tutorial 04: Physics Engines](04_physics_engines.md)

## Contributing

If you find discrepancies in friction behavior across engines, please report them as issues in the [gz-physics repository](https://github.com/gazebosim/gz-physics/issues).

---

*This tutorial is part of the Gazebo Physics tutorial series. For installation instructions, see [Tutorial 02](02_installation.md).*
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The references at the end use direct relative markdown links to other tutorials. In this repo, tutorials are usually cross-linked with Doxygen \ref / \subpage ids (e.g. \ref physicsengine), which makes links stable even if filenames change. Consider switching these links to the corresponding \ref ids to match the rest of the tutorial set.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +13
# Tutorial 10: Friction Parameters for Physics Engines

This tutorial provides comprehensive documentation on friction parameters supported by Gazebo Physics engines. Understanding these parameters is crucial for creating realistic robot simulations with accurate contact behavior.

## Overview

Friction modeling in physics simulation is essential for realistic robot behavior, especially for:
- Wheeled and legged locomotion
- Manipulation and grasping
- Surface interactions
- Stability analysis

Gazebo Physics supports multiple physics engines (DART, Bullet, TPE), each with slightly different friction parameter implementations.
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tutorial doesn’t follow the repository’s Doxygen tutorial format (e.g., \page <id> <title> at the top), so it likely won’t be picked up / cross-referenced consistently with the rest of the tutorial set. Consider converting the header to a \page with a stable id (and using \ref / \subpage style links), and add it to tutorials.md.in’s Contents list so it appears in the generated docs navigation.

Copilot uses AI. Check for mistakes.
Comment on lines +145 to +160
**Note:** In DART, `fdir1` can be expressed in different frames using the `expressed_in` attribute (see below).

### expressed_in (Frame Specification)

The `expressed_in` attribute (DART-specific) specifies the reference frame in which `fdir1` is expressed.

**SDF Example:**
```xml
<surface>
<friction>
<dart>
<fdir1 expressed_in="__model__">1 0 0</fdir1>
</dart>
</friction>
</surface>
```
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DART expressed_in documentation/examples here don’t match the implementation in this repo. In dartsim/src/SDFFeatures.cc, the attribute checked is gz:expressed_in (namespaced) on the <ode><fdir1 ...> element, and the value is treated as a skeleton BodyNode name (typically a link name), not __model__ / __world__ or a separate <dart> block. Please update the text and XML examples to reflect the actual supported syntax and values.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

Document friction parameters for each physics engine

3 participants