Skip to content

fix(sim): ball mass 0.046 kg (was 46 kg) - #7

Open
taitaitai58 wants to merge 2 commits into
masterfrom
fix/ball-mass-kg
Open

fix(sim): ball mass 0.046 kg (was 46 kg)#7
taitaitai58 wants to merge 2 commits into
masterfrom
fix/ball-mass-kg

Conversation

@taitaitai58

Copy link
Copy Markdown

Summary

  • GameObjects.qmlballMass46.00.046 に修正(ゴルフボール ≈46 g = 0.046 kg)
  • ロボット mass: 2.5(kg)と同単位。修正前はボールがロボの約18倍重く、キック/衝突が不自然だった

Test plan

  • m2-Sim を再起動し、ロボがボールに当たったときにボールが弾かれ、ロボが弾かれないことを目視確認
  • キック後のボール初速が以前より明らかに大きくなることを確認
  • 転がり摩擦でボールが自然に減速・停止することを確認(摩擦モデルは同一 ballMass を参照)

Made with Cursor

taitaitai58 and others added 2 commits July 12, 2026 17:21
Replacement (robot/ball teleport) already called DynamicRigidBody.reset()
on position, but two gaps left it looking like the physics body never
really moved:

- mocSim_BallReplacement.vx/vy were parsed but silently dropped, so a
  teleported ball with a requested launch velocity just sat still.
- A robot's previously-commanded velocity (veltangent/velnormal/velangular)
  stayed latched in the Robot model after a teleport, so the very next
  tick re-applied it and the robot immediately drove off again — plus the
  QML-side pose bookkeeping (prePoses/preVelocities) still held the
  pre-teleport pose, reading the position jump itself as a brief phantom
  velocity through MotionControl's accel limiter.

Fixes:
- Robot::resetMotion() zeroes kick/spinner/tangent/normal/angular targets
  and clears the actuation-delay buffers; observer.cpp calls it for the
  replaced robot before re-emitting {blue,yellow}RobotsChanged so QML
  picks up the stop immediately instead of waiting on the next commands
  packet.
- onRobotReplacementRequested seeds prePoses/preVelocities to the
  just-placed, at-rest pose so there's no phantom one-tick velocity.
- observer.cpp now forwards ball vx/vy (m/s -> scene mm/s, same axis
  convention as position) through a widened ballReplacementRequested
  signal; GameObjects.qml's new placeBall() helper (factored out of the
  existing mouse "place ball" path, which behaves identically to before)
  applies it via setLinearVelocity() when present.

Verified headless (QT_QPA_PLATFORM=offscreen) by sending mocSim_Packet
Replacement datagrams via protoc --encode and reading back vision:
- Robot teleported mid-command (veltangent latched) now lands and stays
  within ~0.05mm over 1.3s, vs. previously coasting away at full speed.
- Ball Replacement with vx/vy now visibly travels and decelerates under
  the existing slip/roll friction model instead of sitting still.
- Ball Replacement without vx/vy (the common case) is unaffected: still
  placed at rest.
- A second robot's independent, ongoing velocity command is unaffected
  by another robot's Replacement (no cross-talk).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment said ~46 g golf ball but the PhysX mass was 46.0 while robots
use 2.5 kg, so the ball was ~18× heavier than a robot and ~1000× a real
SSL ball. Collision impulse ratio is now correct; friction impulses use
the same ballMass SSOT.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant