fix(sim): ball mass 0.046 kg (was 46 kg) - #7
Open
taitaitai58 wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GameObjects.qmlのballMassを46.0→0.046に修正(ゴルフボール ≈46 g = 0.046 kg)mass: 2.5(kg)と同単位。修正前はボールがロボの約18倍重く、キック/衝突が不自然だったTest plan
m2-Simを再起動し、ロボがボールに当たったときにボールが弾かれ、ロボが弾かれないことを目視確認ballMassを参照)Made with Cursor