-
Notifications
You must be signed in to change notification settings - Fork 61
Implement adjustable center of gravity [AARD-1921]
#1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to standardize our language around Center of Mass vs Center of Gravity?
if (rootNodeId) { | ||
const robotTransform = convertJoltMat44ToThreeMatrix4( | ||
World.physicsSystem.getBody(rootNodeId).GetWorldTransform() | ||
) | ||
const robotWorldPos = new THREE.Vector3() | ||
const robotWorldQuat = new THREE.Quaternion() | ||
const robotWorldScale = new THREE.Vector3() | ||
robotTransform.decompose(robotWorldPos, robotWorldQuat, robotWorldScale) | ||
|
||
const worldCoG = this._modifiedCenterOfGravity.clone() | ||
worldCoG.applyQuaternion(robotWorldQuat) | ||
worldCoG.add(robotWorldPos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code looks duplicated from earlier
} | ||
|
||
const CenterOfGravityInterface: React.FC<CenterOfGravityInterfaceProps> = ({ selectedRobot }) => { | ||
const gizmoRef = useRef<GizmoSceneObject | undefined>(undefined) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the physics of the robot should be paused while doing this so it doesn't move around while you're setting the CoM
fission/src/ui/panels/configuring/assembly-config/interfaces/CenterOfGravityInterface.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops meant to request changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like the previous review was fully addressed
Yes, I disagree with your suggestion that the physics be paused because if the user creates a try-and-repeat test scenario that involves any form of movement when pinpointing their CoG, this feature would prevent them from doing so. There are few or no cases where perpetual robot movement significantly impacts the selection. It also wasn't made clear where the code was duplicated from (hence the emoji reaction), I searched for 5 minutes and then stopped with the presumption that it didn't matter enough to spend more time on; if it's truly a concern, then I will address it I suppose. |
Task
AARD-1921
This PR adds a config for robots that allows you to move their center of gravity, and allows you to adjust the torque output consequence (the functional equivalent of scaling the weight of the robot).
Symptom
A user may wish to observe the physical output of the robot when its weight is at a pre-calculated or desired position. This is most often used for setting safety limits on move/rotation speeds.
Solution
To simulate a modified center-of-gravity, we compute the lever arm between where the gravitational force acts and where it "should" act, and gives us a rotational moment (torque). This torque is calculated, dampened (to avoid Jolt-related inaccuracies), and then distributed to each rigid body.
Verification
Place the center-of-gravity at various points and observe the effect on the robot's balance. Verifying using real values is not feasible due to limitations in Jolt.
Before merging, ensure the following criteria are met: