Current/Force Sensing

Every one of Marty's motors is a Smart Servo, which provides feedback about its position and the electrical current flowing through it. A motor generally draws more current when it works harder, so the current reading gives an indication of the load on a joint. It is not a direct measurement of force.

In Blocks

  1. Open Blocks and connect to Marty.
  2. Select your Marty device, open Code, and choose Sensing.
  3. Find Current at [joint] joint (in mA) and select a joint from its dropdown. The example below uses right arm.
  4. Tick the checkbox beside the block to display its current reading in milliamps (mA).

Current at right arm selected in Sensing, with the current monitor displayed

Try asking Marty to move and watch how the reading changes. Make sure the joint selected in the Current block is the one you want to monitor.

Reacting to force

We can use motor current to make Marty react to a change in load. This example raises Marty's right arm, holds it in position, and then dances when the current rises above a threshold as you gently press the arm:

Program to raise the right arm and dance when the right arm motor current exceeds 50 mA

  1. Move the right arm to 90 degrees in 1 second.
  2. Wait 0.5 seconds for the movement to settle.
  3. Repeat Hold this position for 0.5 s until Current at right arm joint (in mA) > 50.
  4. Run Dance! when the condition becomes true.

Use right arm in both the Move and Current blocks. 50 mA is an example threshold: watch the current while the arm is holding still, then choose a value above that normal reading. If Marty dances immediately or does not respond to a gentle press, adjust the threshold.

The Hold this position block matters because Marty is normally poseable when not moving. Without it, Marty may simply let you move the arm instead of resisting and drawing more current.

Task Runner