Stage 12 · Lesson 07/16

Robot Simulation & Digital Twin · Lesson 07

Mass, Gravity & Inertia

Est. 55–70 min

Why

Why this lesson matters

Lesson 6 showed how a physics engine steps the world forward. The numbers it uses for every step come from your model: mass (how heavy each link is), centre of mass (where that weight sits) and inertia (how hard it is to start or stop the link turning). Gravity pulls on the mass; the motors must fight both gravity and inertia.

Wrong numbers here do not cause error messages. The simulation just quietly gives you a robot that is stronger, faster or more stable than the real one. In this lesson you will compute honest inertial values from shapes, catch four common mistakes with a script, find the gravity torque on a shoulder, and measure the inertia of a real link by timing how it swings.

Concept

Mass, gravity and inertia in a robot model

1. Mass and weight

Mass (kg) is how much stuff a link has. Weight is the force gravity puts on it: F = m·g, with g ≈ 9.81 m/s² near Earth’s surface (standard gravity is defined as 9.80665 m/s²). A 50 g gripper weighs 0.050 × 9.81 ≈ 0.49 N. In URDF and SDF, mass is always in kilograms — typing 50 for 50 g makes it a 50 kg gripper.

An old white kitchen weighing scale with a round dial and a flat pan on top
A kitchen scale is the first tool of robot modelling: weigh each link, servo and gripper. Then convert grams to kilograms before typing it into the model.Photo: Epec 2000 · CC BY-SA 4.0 · Source: Wikimedia Commons · resized, converted to WebP

2. Gravity torque: the shoulder’s real job

A servo at the shoulder does not feel “weight” — it feels torque: weight × horizontal distance from the joint. τ = m·g·r·cos θ, where r is the distance to that part’s centre of mass and θ is the arm’s angle above horizontal. Straight out (θ = 0) is the worst case; pointing straight up the gravity torque is zero. Add up every part beyond the joint: links, servos, gripper and the payload at the very end.

3. Inertia: how hard it is to spin

Mass resists being pushed in a straight line. Moment of inertia I (kg·m²) resists being turned. It depends on mass *and* how far that mass is from the axis: Newton’s law for turning is τ = I·α. A long arm with a heavy gripper at the end has a big I, so the same motor accelerates it slowly. A figure skater pulls her arms in to spin faster for the same reason.

Standard formulas (Wikipedia “List of moments of inertia”). The Gazebo tutorial’s wheel numbers are a good self-test for your code.
Shape (solid, about its centre)FormulaExample
Box x × y × z, mass mixx = m(y² + z²)/12, iyy = m(x² + z²)/12, izz = m(x² + y²)/1260 g, 12 × 2.5 × 2.5 cm link: iyy ≈ 7.5 × 10⁻⁵ kg·m²
Cylinder radius r, length h (axis z)ixx = iyy = m(3r² + h²)/12, izz = m r²/2Gazebo’s 1 kg wheel, r 0.4, h 0.2: ixx 0.043333, izz 0.08
Thin rod length L about one endI = m L²/350 g, 12 cm rod: 2.4 × 10⁻⁴ kg·m²
Point mass at distance rI = m r²quick estimate for a gripper at the end of an arm

4. Inertia in a URDF

The ROS 2 URDF tutorial says every simulated link needs an <inertial> tag: <mass value> in kilograms and <inertia ixx ixy ixz iyy iyz izz> — six numbers, because the 3×3 inertia matrix is symmetric. An <origin> inside <inertial> places the centre of mass. For a simple symmetric shape centred on its frame, ixy, ixz and iyz are 0.

5. Parallel axis theorem

URDF wants inertia about the link’s centre of mass. A swing test gives it about the pivot. They are linked by I_pivot = I_cm + m·d², where d is the distance between the pivot and the centre of mass. You will use this on the bench.

Visual

Visualise it: mass, gravity and inertia sliders

Mass, gravity and inertia sliders on a toy falling body and spinning link. (Educational approximation, not Gazebo, Isaac or MuJoCo.)

Interactive · Physics parameter lab · Educational approximation

Educational physics simulation loopMass gravity inertia teaching model
floor (toy bounce)mIα ≈ τ/I (toy)

Weight mg

14.7

Toy α

0.75

Height px

120

Angle°

0

Browser educational physics — not Gazebo, not Isaac Sim, not MuJoCo, not a production integrator. Heavier m / larger I → slower toy response; higher g → faster fall.

Code lab

Code lab: honest inertial numbers for a desk arm

inertia_lab.py computes inertia from shapes (and checks itself against the Gazebo tutorial wheel), prints ready-to-paste URDF lines, runs sanity checks, works out the shoulder’s gravity torque with 0, 50 and 100 g payloads, and finally moves the shoulder with the same torque-limited motor for three different models. All masses and sizes are examples — weigh and measure your own arm. Run python3 inertia_lab.py.

inertia_lab.py · Python
"""inertia_lab.py - mass, gravity and inertia numbers for a small desk arm.

  1. Inertia of simple shapes -> URDF <inertial> lines (checked against Gazebo's wheel)
  2. Sanity checks that catch wrong inertial data
  3. Gravity torque on the shoulder: when does the servo struggle?
  4. Same motor, different inertia: correct, grams-typed-as-kg, and 'tiny placeholder'
Plain Python 3. Link sizes and masses are EXAMPLES - weigh and measure your own arm.
"""
import math

G = 9.81


def box(m, x, y, z):
    """Solid box about its centre: (ixx, iyy, izz)."""
    return (m / 12 * (y * y + z * z), m / 12 * (x * x + z * z), m / 12 * (x * x + y * y))


def cylinder(m, r, h):
    """Solid cylinder about its centre, axis along z."""
    side = m / 12 * (3 * r * r + h * h)
    return (side, side, 0.5 * m * r * r)


def check(name, m, I):
    ixx, iyy, izz = I
    problems = []
    if m <= 0:
        problems.append("mass must be > 0")
    if m > 20:
        problems.append(f"{m} kg for a desk-arm part? grams typed as kg?")
    if min(I) <= 0:
        problems.append("every diagonal inertia must be > 0")
    if ixx + iyy < izz or ixx + izz < iyy or iyy + izz < ixx:
        problems.append("triangle rule broken (ixx+iyy>=izz etc.) - no real object has this")
    return problems


# ---------- 1. shapes -> URDF ---------------------------------------------
print("=== 1. Inertia of simple shapes ===")
w = cylinder(1.0, 0.4, 0.2)
print(f"hand-check, Gazebo tutorial wheel (1 kg, r 0.4 m, length 0.2 m): "
      f"ixx {w[0]:.6f}  izz {w[2]:.6f}   (tutorial: 0.043333, 0.08)")

links = {   # name: (mass kg, shape, dims m)  - EXAMPLE desk arm
    "base":      (0.180, "cyl", (0.045, 0.040)),
    "upper_arm": (0.060, "box", (0.120, 0.025, 0.025)),
    "forearm":   (0.050, "box", (0.120, 0.025, 0.025)),
    "gripper":   (0.040, "box", (0.050, 0.040, 0.030)),
}
inertia = {}
for name, (m, shape, d) in links.items():
    I = cylinder(m, *d) if shape == "cyl" else box(m, *d)
    inertia[name] = I
    print(f'{name:>10}: <mass value="{m}"/> <inertia ixx="{I[0]:.3e}" iyy="{I[1]:.3e}" '
          f'izz="{I[2]:.3e}" ixy="0" ixz="0" iyz="0"/>')
print("-> tiny numbers (1e-5 kg*m^2) are normal for a desk arm. Units: kg and kg*m^2.\n")

# ---------- 2. sanity checks ----------------------------------------------
print("=== 2. Sanity checks ===")
tests = {
    "upper_arm (correct)":            (0.060, inertia["upper_arm"]),
    "upper_arm, grams typed as kg":   (60.0, tuple(v * 1000 for v in inertia["upper_arm"])),
    "copy-paste izz too big":         (0.060, (1e-5, 1e-5, 5e-5)),
    "zero inertia":                   (0.060, (0.0, 0.0, 0.0)),
}
for name, (m, I) in tests.items():
    p = check(name, m, I)
    print(f"{name:>30}: {'OK' if not p else 'FAIL - ' + '; '.join(p)}")
# The ROS 2 URDF tutorial's simple example: 10 kg cylinder r 0.2 h 0.6 with all 1e-3
real = cylinder(10, 0.2, 0.6)
print(f"ROS 2 tutorial placeholder (10 kg, all 1e-3) vs a solid cylinder that size: "
      f"ixx {real[0]:.3f}, izz {real[2]:.3f} -> placeholder is {real[0] / 1e-3:.0f}x too small")
print("-> checks pass, but numbers can still be fake. Compute from shape and mass.\n")

# ---------- 3. gravity torque on the shoulder -------------------------------
print("=== 3. Gravity torque on the shoulder (arm straight out) ===")
# centre of each part measured from the shoulder axis when the arm is horizontal
parts = [("upper_arm", 0.060, 0.060), ("elbow servo", 0.010, 0.120),
         ("forearm", 0.050, 0.180), ("gripper", 0.040, 0.265)]
SERVO_LIMIT = 0.25   # N*m - EXAMPLE budget; read YOUR servo's datasheet and keep a margin
for payload in (0.0, 0.050, 0.100):
    allp = parts + [("payload", payload, 0.29)]
    tau_h = sum(m * G * r for _, m, r in allp)
    print(f"payload {payload * 1000:>3.0f} g: horizontal tau = {tau_h:.3f} N*m  "
          f"({100 * tau_h / SERVO_LIMIT:.0f}% of a {SERVO_LIMIT} N*m budget)  "
          f"at 45 deg: {tau_h * math.cos(math.radians(45)):.3f}  straight up: 0.000")
print("-> gravity torque = m*g*r*cos(angle): worst when the arm is straight out.\n")

# ---------- 4. same motor, different inertia --------------------------------
print("=== 4. Move the shoulder 0 -> 60 deg with a torque-limited PD motor ===")
m_arm = sum(m for _, m, _ in parts)
r_cm = sum(m * r for _, m, r in parts) / m_arm
I_true = sum(m * r * r for _, m, r in parts)       # point-mass estimate about the shoulder
print(f"arm mass {m_arm:.3f} kg, centre of mass {r_cm * 100:.1f} cm out, "
      f"I about shoulder ~ {I_true:.2e} kg*m^2")


def move(I, mass, kp=6.0, kd=0.15, tmax=0.6, dt=0.001, seconds=3.0):
    th, w, target = 0.0, 0.0, math.radians(60)
    settle, wmax = None, 0.0
    for k in range(int(seconds / dt)):
        tau = max(-tmax, min(tmax, kp * (target - th) - kd * w))
        tau -= mass * G * r_cm * math.cos(th)
        w += tau / I * dt
        th += w * dt
        wmax = max(wmax, abs(w))
        if abs(th) > 1e3 or math.isnan(th):
            return "EXPLODED", None, wmax
        if abs(th - target) < math.radians(2) and settle is None:
            settle = (k + 1) * dt
        elif abs(th - target) >= math.radians(2):
            settle = None
    return f"{math.degrees(th):6.1f} deg", settle, wmax


for label, I, mass in (("correct model", I_true, m_arm),
                       ("grams typed as kg (x1000)", I_true * 1000, m_arm * 1000),
                       ("inertia 1e-7 placeholder", 1e-7, m_arm)):
    end, s, wmax = move(I, mass)
    print(f"{label:>27}: after 3 s {end}, settled within 2 deg: {f'{s:.2f} s' if s else 'never':>6},"
          f" top speed {wmax:8.0f} rad/s")
print("-> heavy model: the motor cannot even hold it up - the arm falls. Tiny inertia:")
print("   the 1 ms step is no longer small enough, the joint chatters at impossible")
print("   speeds and never settles. Inertia must be honest.")

Output (run with python3 inertia_lab.py)

=== 1. Inertia of simple shapes ===
hand-check, Gazebo tutorial wheel (1 kg, r 0.4 m, length 0.2 m): ixx 0.043333  izz 0.080000   (tutorial: 0.043333, 0.08)
      base: <mass value="0.18"/> <inertia ixx="1.151e-04" iyy="1.151e-04" izz="1.822e-04" ixy="0" ixz="0" iyz="0"/>
 upper_arm: <mass value="0.06"/> <inertia ixx="6.250e-06" iyy="7.512e-05" izz="7.512e-05" ixy="0" ixz="0" iyz="0"/>
   forearm: <mass value="0.05"/> <inertia ixx="5.208e-06" iyy="6.260e-05" izz="6.260e-05" ixy="0" ixz="0" iyz="0"/>
   gripper: <mass value="0.04"/> <inertia ixx="8.333e-06" iyy="1.133e-05" izz="1.367e-05" ixy="0" ixz="0" iyz="0"/>
-> tiny numbers (1e-5 kg*m^2) are normal for a desk arm. Units: kg and kg*m^2.

=== 2. Sanity checks ===
           upper_arm (correct): OK
  upper_arm, grams typed as kg: FAIL - 60.0 kg for a desk-arm part? grams typed as kg?
        copy-paste izz too big: FAIL - triangle rule broken (ixx+iyy>=izz etc.) - no real object has this
                  zero inertia: FAIL - every diagonal inertia must be > 0
ROS 2 tutorial placeholder (10 kg, all 1e-3) vs a solid cylinder that size: ixx 0.400, izz 0.200 -> placeholder is 400x too small
-> checks pass, but numbers can still be fake. Compute from shape and mass.

=== 3. Gravity torque on the shoulder (arm straight out) ===
payload   0 g: horizontal tau = 0.239 N*m  (96% of a 0.25 N*m budget)  at 45 deg: 0.169  straight up: 0.000
payload  50 g: horizontal tau = 0.382 N*m  (153% of a 0.25 N*m budget)  at 45 deg: 0.270  straight up: 0.000
payload 100 g: horizontal tau = 0.524 N*m  (210% of a 0.25 N*m budget)  at 45 deg: 0.370  straight up: 0.000
-> gravity torque = m*g*r*cos(angle): worst when the arm is straight out.

=== 4. Move the shoulder 0 -> 60 deg with a torque-limited PD motor ===
arm mass 0.160 kg, centre of mass 15.2 cm out, I about shoulder ~ 4.79e-03 kg*m^2
              correct model: after 3 s   58.8 deg, settled within 2 deg: 0.36 s, top speed       11 rad/s
  grams typed as kg (x1000): after 3 s  -29.2 deg, settled within 2 deg:  never, top speed       10 rad/s
   inertia 1e-7 placeholder: after 3 s  376.8 deg, settled within 2 deg:  never, top speed     9290 rad/s
-> heavy model: the motor cannot even hold it up - the arm falls. Tiny inertia:
   the 1 ms step is no longer small enough, the joint chatters at impossible
   speeds and never settles. Inertia must be honest.

Try it: raise mass, then gravity, then inertia, and press Drop again each time. Watch the weight m·g and the angular acceleration τ/I readouts change. (Educational toy physics, not Gazebo, Isaac or MuJoCo.)

Interactive · Physics parameter lab · Educational approximation

Educational physics simulation loopMass gravity inertia teaching model
floor (toy bounce)mIα ≈ τ/I (toy)

Weight mg

14.7

Toy α

0.75

Height px

120

Angle°

0

Browser educational physics — not Gazebo, not Isaac Sim, not MuJoCo, not a production integrator. Heavier m / larger I → slower toy response; higher g → faster fall.

Bench build: measure a real link’s inertia with a swing

Formulas assume a perfect box. Your real link has holes, screws and a servo horn. The best check is to measure. Hang the link from the shaft of a smooth potentiometer so it swings like a pendulum. swing_inertia.ino times five full swings and uses the compound (physical) pendulum formula T = 2π√(I_pivot / (m·g·d)), then the parallel axis theorem to get I about the centre of mass — the number URDF wants.

  1. Weigh it

    kitchen scale → grams → kilograms in M_KG

  2. Find the centre of mass

    balance the link on a pencil; measure pivot hole → balance point in metres → D_M

  3. Hang it

    fix the link to the pot shaft (hot glue or a servo horn) so it hangs straight down and swings freely

  4. Measure

    press D2 while it hangs still, pull it about 15° aside and let go

No motors are powered in this build. If you test a link with its servo still attached, leave the servo unpowered — and when you power servos later, use a separate 5–6 V supply with a common ground, never a GPIO pin.
PartConnectionNote
10 kΩ potentiometer (smooth, low friction)outer legs 5V and GND, wiper A0its shaft is the pivot; a stiff pot stops the swing too fast
Push buttonD2 to GNDINPUT_PULLUP; saves “straight down” and starts timing
The link under testglued or screwed to the pot shaftremove the servo from the link, or include it and say so in your report
swing_inertia.ino · Arduino C++
// swing_inertia.ino - measure a real arm link's moment of inertia by timing its swing.
// Hang the link (e.g. a 3D-printed or cardboard forearm) from the shaft of a
// smooth 10 kOhm pot so it swings freely. The pot reads the angle; the sketch
// times full swings and uses the physical-pendulum formula:
//     T = 2*pi*sqrt(I_pivot / (m*g*d))  ->  I_pivot = m*g*d*T^2 / (4*pi^2)
//     I_cm = I_pivot - m*d^2            (parallel axis theorem)
// Enter YOUR link's mass (kitchen scale) and pivot-to-centre-of-mass distance
// (balance the link on a pencil to find its centre of mass).
//
// Wiring (no motors): pot outer legs 5V and GND, wiper A0. Button D2 to GND = start.

const float M_KG = 0.050;     // link mass in kg  (50 g = 0.050!)
const float D_M  = 0.060;     // pivot to centre of mass, metres
const float G = 9.81;
const float DEG_PER_COUNT = 270.0 / 1023.0;   // typical 270-degree pot; check yours

int restCounts = 512;
const int SWINGS = 5;

float angleDeg() { return (analogRead(A0) - restCounts) * DEG_PER_COUNT; }

void setup() {
  Serial.begin(115200);
  pinMode(2, INPUT_PULLUP);
  Serial.println(F("Let the link hang still, then press the button."));
}

void loop() {
  if (digitalRead(2) != LOW) return;
  delay(300);
  long sum = 0;                                  // calibrate 'straight down'
  for (int i = 0; i < 64; i++) { sum += analogRead(A0); delay(2); }
  restCounts = sum / 64;
  Serial.println(F("Rest angle saved. Pull the link about 15 deg to one side and let go."));

  // wait for the release (angle beyond 8 deg, then back through zero)
  while (fabs(angleDeg()) < 8.0) {}
  float prev = angleDeg();
  unsigned long crossings[2 * SWINGS + 1];
  int n = 0;
  unsigned long start = millis();
  while (n < 2 * SWINGS + 1 && millis() - start < 20000) {
    float a = angleDeg();
    if ((prev < 0 && a >= 0) || (prev > 0 && a <= 0)) {   // passed straight down
      crossings[n++] = micros();
      delay(40);                                         // ignore noise right at zero
    }
    prev = a;
  }
  if (n < 2 * SWINGS + 1) {
    Serial.println(F("Swing died out too fast - too much friction in the pot? Time it by hand instead."));
    return;
  }
  // one full period = two zero crossings
  float T = (crossings[2 * SWINGS] - crossings[0]) / 1e6 / SWINGS;
  float Ipivot = M_KG * G * D_M * T * T / (4 * PI * PI);
  float Icm = Ipivot - M_KG * D_M * D_M;
  Serial.print(F("period T = ")); Serial.print(T, 3); Serial.println(F(" s"));
  Serial.print(F("I about pivot = ")); Serial.print(Ipivot * 1e6, 1); Serial.println(F(" x 1e-6 kg*m^2"));
  Serial.print(F("I about centre of mass = ")); Serial.print(Icm * 1e6, 1); Serial.println(F(" x 1e-6 kg*m^2"));
  if (Icm <= 0) Serial.println(F("I_cm <= 0: check M_KG and D_M (grams vs kg? cm vs m?)"));
  Serial.println(F("Press the button to measure again."));
}

Debugging

SymptomLikely causeFix
Simulated arm lifts loads the real one cannotmasses too small or placeholder inertiasWeigh every part; compute inertia from shape; add servos and screws
Arm in simulation falls or sinks slowlygrams typed as kilogramsMass in kg: 60 g → 0.060
Joint vibrates or explodes at restinertia zero or tiny compared with the controller gainsUse real inertia values; check against the step size
Simulator warns or refuses the modeltriangle rule broken or negative valuesRecompute; ixx + iyy ≥ izz for every pair
Swing test gives I_cm ≤ 0mass in grams or distance in cmUse kg and metres in M_KG and D_M
Swing period changes run to runlarge release angle or frictionRelease from about 10–15°, use a smoother pivot

Real world

Mass and inertia in the real world

  • Motor sizing: engineers compute worst-case gravity torque (arm straight out, full payload) before choosing gearboxes and motors.
  • Robot datasheets: industrial arms list a payload together with how far from the wrist it may be, because the same mass further out means more torque and inertia.
  • Controller tuning in simulation: PID gains tuned on a model with wrong inertia will be too soft or too aggressive on the real robot.
  • Flywheels and balance: big inertia smooths speed (flywheels); a long pole helps a tightrope walker because it is hard to rotate quickly.
A huge cast-iron flywheel with spokes inside an old engine house
A steam engine flywheel. Most of its mass is in the heavy rim, far from the axle, so its inertia is large and it keeps turning smoothly.Photo: Tim Sheerman-Chase · CC BY 2.0 · Source: Wikimedia Commons · resized, converted to WebP
A figure skater spinning upright on one skate with arms pulled tight to his body
A skater spins faster with arms pulled in: the same mass closer to the axis means smaller inertia.Photo: Caroline Paré · CC BY-SA 3.0 · Source: Wikimedia Commons · resized, converted to WebP
A circus performer walking on a high wire holding a long balancing pole
A tightrope walker’s long pole has large inertia about the wire, so the walker’s body tips more slowly and there is time to correct.Photo: David E. Lucas · Public domain · Source: Wikimedia Commons · resized, converted to WebP

Think

Think about it

Think

Two grippers both weigh 80 g. Gripper A is compact; gripper B has long fingers, so its centre of mass is 4 cm further from the wrist. For the shoulder motor, which is harder to hold still and which is harder to swing quickly? Why?

Experiment

Try it in the lab

About 60 minutes. The Python part needs only Python 3. The bench part needs an Arduino UNO, a smooth 10 kΩ potentiometer, a push button, a kitchen scale and a ruler.

Experiment

From kitchen scale to URDF

You will need

  • `inertia_lab.py` (Python 3, no libraries)
  • Physics parameter lab (in your browser)
  • Arduino UNO, smooth 10 kΩ pot, push button, jumper wires
  • Kitchen scale, ruler, pencil, a plain 12 cm strip, one real arm link

Steps

  1. Run `inertia_lab.py`. Copy the four URDF `<inertial>` lines into a notebook.
  2. Change the forearm to your real forearm’s size and mass. Re-run and note the new shoulder torque.
  3. Find the payload at which the shoulder needs 100 % of the example budget. Then look up your own servo’s stall torque in its datasheet and repeat.
  4. In the physics parameter lab, double inertia and press Drop again. Does the link spin up faster or slower? Does the falling body change?
  5. Bench: test the plain 12 cm strip first and compare with the theory (T ≈ 0.57 s, I_cm ≈ 6 × 10⁻⁵).
  6. Bench: measure your real link, and compare I_cm with the box formula from the script.

Interactive · Physics parameter lab · Educational approximation

Educational physics simulation loopMass gravity inertia teaching model
floor (toy bounce)mIα ≈ τ/I (toy)

Weight mg

14.7

Toy α

0.75

Height px

120

Angle°

0

Browser educational physics — not Gazebo, not Isaac Sim, not MuJoCo, not a production integrator. Heavier m / larger I → slower toy response; higher g → faster fall.

The box formula and the swing test rarely agree exactly — real links are not solid boxes. The swing test is the truth; the formula is a good first guess. Both are far better than a copied placeholder.

Knowledge check

Check your understanding

Knowledge check

1. In a URDF `<mass value="…"/>`, a 60 g link should be written as…

2. Gravity torque on a shoulder is largest when the arm is…

3. Moment of inertia depends on…

4. Which set of diagonal inertias is impossible for a real object?

5. Why does the URDF inertia tag have only six numbers for a 3×3 matrix?

6. A swing test gives I about the pivot. To get I about the centre of mass, you…

7. A model with tiny placeholder inertias will most likely…

Mini assignment

Hands-on assignment

Mini assignment

The inertial sheet for your desk arm

Build a measured mass and inertia table for every moving part of your arm, and use it to choose (or check) your shoulder servo.

Deliverables

  • A table: part, mass (g and kg), centre-of-mass distance, inertia from formula, inertia from swing test (for at least one link).
  • The `<inertial>` blocks for your URDF from Lesson 3, with the `<origin>` at each centre of mass.
  • The shoulder gravity torque at 0°, 45° and 90° with no payload and with your target payload.
  • A one-paragraph decision: does your shoulder servo have at least a 2× margin? If not, what will you change (lighter gripper, shorter arm, counterweight, stronger servo)?

Do this, step by step

  1. Weigh each part in grams and convert to kg.
  2. Find each centre-of-mass distance by balancing the link on a pencil.
  3. Work out the inertia with the formulas in inertia_lab.py, then do one swing test with swing_inertia.ino.
  4. Write the <inertial> blocks for your Lesson 3 URDF.
  5. Work out the shoulder torque at 0°, 45° and 90°, with and without payload, and check for a 2× margin.

Stuck? Hints, one at a time

NoteTry the task first. Read one hint, try again, and only then read the next one.
  1. Gravity torque is m × g × d × cos(angle from horizontal). It is biggest when the arm is straight out.
  2. SERVO_LIMIT is only an example. Use your own servo’s datasheet stall torque, converted to N·m.
  3. If the swing-test inertia is far from the formula, check that you measured the pivot-to-centre-of-mass distance, not the link length.

Challenges (pick by level)

  • 🟢 Beginner: Hold a full water bottle with your arm straight out, then with your elbow bent. Explain the difference using τ = m·g·r.
  • 🟡 Intermediate: Add a counterweight behind the shoulder in inertia_lab.py. How much mass at 5 cm behind the joint halves the horizontal torque? What does it do to inertia?
  • 🟠 Advanced: Extend the script to read your Lesson 3 URDF, compute total mass and centre of mass, and warn about missing <inertial> tags.
  • 🔴 Expert: Add the elbow joint: compute gravity torque at the elbow and the shoulder for a grid of poses, and print the worst pose for each joint.
  • ⚫ Research: Look up how MuJoCo and Gazebo can compute inertia automatically from a mesh, and what assumption (uniform density) that makes. When would it be wrong for a real 3D-printed link?

Next step

Your links now have honest mass and inertia. In Lesson 8 — Collision & Contact you will see what happens when they touch something: how a simulator finds collisions, pushes objects apart, and why collision shapes are kept simpler than the visual model.

Look back: Lesson 6: Physics Simulation. Next: Lesson 8: Collision & Contact. Related: Stage 9 — Trajectory Planning.

Sources

Self-attested for now — keep artifacts in your lab notebook.

Complete

Today's goal

0 of 1 done today

0-day streak
Daily goal:lessons, quizzes or assignments a day

Mark this lesson complete when you have worked the experiment, knowledge check, and assignment (even roughly).

Watch on Quark Lab · GATE RA + PH

EP06: Newton's Laws of Motion

Why do you jerk forward when an auto brakes suddenly? The first law (inertia: no net force, constant velocity), the second law F_net = dp/dt = m a for constant mass, the third law (equal and opposite forces on two different bodies), a GATE-style solved problem on the scale reading in an accelerating lift (N = m(g + a) = 708 N), and the common trap that weight and normal force are not a third-law pair.

All Quark Lab episodes →

Stuck somewhere?

Ask a doubt about this lesson

Saved with this lesson's id and your email so we can reply. Privacy · or email contact@aihubstation.in