DEV Community

alphanine
alphanine

Posted on

Turing Sim: Contact Forces You Can Actually Read

Each touching pair now gets one named arrow: who pushes whom, and how hard. 每对接触的物体现在只有一个带名字的箭头:谁推谁、推多大。

Before · 改前

Contact forces on the held cube, before and after · Before · 改前

After · 改后

Contact forces on the held cube, before and after

Contact forces on the held cube, before and after · GIF

Before: one unlabelled peak reading. After: the two pads each pressing 21.2 N on the cube.

Before · 改前

Contact summary in the Robot panel, before and after · Before · 改前

After · 改后

Contact summary in the Robot panel, before and after

The panel lists named pairs and says how to see every push on a body.


Situation

Turing Sim can draw contact forces while physics runs. Before this change every contact point got its own arrow, and the only label was the strongest force. Holding a cube with a two-finger gripper produced a yellow cluster with "2.78 N" next to it. You could not tell which finger pushed, how hard each side squeezed, or whether a robot's own links touching each other were drowning out the contact you cared about.

Task

Make the overlay answer the questions people actually ask when a grasp misbehaves: who is pushing on this body, in which direction, and how hard? It also had to stay readable on a hand with many links, and work the same in the Storm and the native Metal viewports.

Action

  1. One arrow per touching pair. Contact points are grouped by the two bodies involved. Each pair draws one net-push arrow ending at the force-weighted centre of its points; small dots still mark the individual points.
  2. The selection decides what is shown. With nothing selected, the strongest pairs are labelled "left pad → Cube · 14.5 N". Select a body and every push on it is drawn, each oriented onto that body.
  3. Internal contacts are separated. Contacts between parts of one articulation (two fingers of one hand, the pieces of a puzzle cube) are hidden unless "Include self-contacts" is on, so they never crowd out the rest. MuJoCo and Genesis both report which tree each body belongs to.
  4. Details on hover, and glows. Hovering an arrow opens a card with the pressing and friction components. The native Metal view now forwards pointer motion so this works in every viewport mode. An optional glow marks each point, cool to hot with its force.

The commit was tested in isolation: 88 tests passed.

Result

The captures show the same grasp before and after. The old view had one unlabelled reading; the new one shows the right and left pads each pressing 21.2 N on the cube and a follower link touching it at 2.42 N. The Robot panel lists the same pairs and points to selection for the full picture.

This is a debugging aid, not a measurement tool: the numbers are whatever the engine reports, and the two engines still differ.


背景

Turing Sim 在物理运行时可以显示接触力。改动前每个接触点各有一个箭头,唯一的标签是最大的那个力。用两指夹爪夹住方块时,只能看到一团黄色和旁边的 "2.78 N"。看不出是哪根手指在推、两边各夹多紧,也分不清机器人自身连杆之间的接触是不是把真正关心的接触淹没了。

目标与难点

让叠加层回答抓取出问题时最常问的几个问题:谁在推这个物体、往哪个方向、推多大。同时在多连杆的手上也要看得清,并且在 Storm 和原生 Metal 视口里表现一致。

解决思路与行动

  1. 每对接触物体一个箭头。 接触点按涉及的两个物体分组。每对画一个合力箭头,终点在按力加权的接触点中心,小圆点仍标出各个接触点。
  2. 由选中对象决定显示什么。 什么都不选时,标出最强的几对,比如 "left pad → Cube · 14.5 N"。选中一个物体,就显示所有作用在它上面的推力,方向都朝向这个物体。
  3. 内部接触单独处理。 同一个关节体内部的接触(同一只手的两根手指、魔方的块)默认隐藏,勾选 "Include self-contacts" 才显示,不会挤掉其它接触。MuJoCo 和 Genesis 都会报告每个物体属于哪棵运动树。
  4. 悬停查看细节,可选发光。 鼠标悬停在箭头上会弹出卡片,显示法向力和摩擦力分量。原生 Metal 视口现在会转发鼠标移动,所以每种视口模式下都能用。可选的发光效果按力的大小由冷到热标出每个接触点。

这个 commit 单独测试:88 项通过。

结果与下一步

截图对比的是同一次抓取。旧视图只有一个没有标注的读数;新视图显示左右夹爪各以 21.2 N 压住方块,另一个随动连杆以 2.42 N 接触。Robot 面板列出同样的接触对,并提示选中物体可以看到全部推力。

这是调试辅助,不是测量工具:数值就是引擎报告的结果,两个引擎之间仍有差异。

Top comments (0)