Marty the Poser - (Scratch)

This ScratchX program allows Marty to be dynamically posed.

Servos can be individually adjusted using the variable sliders or by mousing over the arrow buttons.

Poses can be stored in numbered slots (i.e. like keyframes) and played back interactively.

This will allow you to experiment with positions and sequences for dances / walk cycles etc.

WARNING - posing Marty dynamically can cause unexpected falling over (part of the fun)- so be careful and don't pose Marty near any cliff edges!



For best performance run this in Turbo Mode (select from the "Edit" drop down in the ScratchX menu).

I've also found it useful to use full screen for the stage when running the program. Enable / disable full screen by clicking on the blue box icon at the top left of the scratch stage. (this makes dragging sliders easier and reduces the risk of inadvertently dragging sprites / variables around)

Marty will flash and beep if (s)he detects sudden acceleration.

The code is commented which hopefully will help explain what is going on.

The Marty sprite deals with updating the servos and other Marty stuff.

The Gobo sprite deals with manipulating the pose data (there is lots of repetition because Scratch requires that lists (arrays) are addressed explicitly i.e. consequently lots of duplicated code for the pose01 - pose07 lists

The Arrow sprites are for mouse-over fine control of the servo positions.

The poses sprite is simply used for defining preset poses.

Alternate version

This alternative version of the ScratchX program stores all of the pose data in one long list and uses an index to jump to the right place in the list.

The alternative code is more maintainable and compact but perhaps more tricky to understand. (The original version with poses in different lists is more accessible as a teaching example).

Generating a simple walk cycle from a preset pose -

When the program starts it sets up a predefined pose in slot 1. (accessed by pressing 1).

This pose has Marty's weight on the right leg with hips slightly spread and legs twisted.

By manipulating this pose we can make Marty walk.

Marty the robot - a simple generated walk cycle

  • Firstly press 1 (to load the preset pose)
  • Then,

    This completes a cycle and Marty is now back in the initial preset pose.

    If your Marty is correctly calibrated and behaving(!) (s)he should have stepped forward twice on a path curving to the left.

    Note that because this walk cycle relies on sliding Marty's feet without lifting them, the exact behaviour of your Marty will depend on how much friction there is between Marty's feet and the floor. In the video my desk is just slippy enough!



    Leave a comment and join the discussion here

    Please Log In or Sign Up to write a comment response

    4 Responses

    kifpot has been the Europe leading online raw organic hemp flower shop since our humble beginning in 2017. We are determined to provide the best CBD Flowers, isolates, and oil. CBD flower for sale, wholesale CBD flower, Purchase Hemp flower, Cheap Hemp follower, Wholesale CBD hemp flower Europe


    19:00:26, 08th July 2020   |   Permalink   |   View Source
    19:54:17, 28th May 2020

    Very impressive stuff going on here! Great work @ddoak. I think it will be a while yet before I can master this exercise. Regards, William

    11:40:31, 14th August 2018   |   Permalink   |   View Source
    sandy STAFF

    This is amazing! Thanks so much @ddoak - your Scratch skills are way superior to mine!

    I had fun playing around with some Marty movements though ;-)

    Marty movements in Scratch

    17:08:27, 01st September 2017   |   Permalink   |   View Source