Robot Engage Blog Buy Now
Blog

Misty Community Forum

HeadandArm Movement Tutorial Code Not Working

When I run it Misty will change her LED and play the audio but she fails to move her head or arms.

Object
skillrunner.js:1125 Running skill 'HelloWorld_HeadArms'. Open the web console to see misty.Debug() messages and other skill data.
skillrunner.js:511 "'HelloWorld_HeadArms' Debug => " "2020-01-27T18:51:33.2994932Z"
skillrunner.js:518 starting skill HelloWorld_HeadArms
skillrunner.js:511 "Calling command 'AddPropertyTest'" "2020-01-27T18:51:33.2994932Z"
skillrunner.js:518 Object
skillrunner.js:511 "Calling command 'AddPropertyTest'" "2020-01-27T18:51:33.2994932Z"
skillrunner.js:518 Object
skillrunner.js:511 "Calling command 'RegisterEvent'" "2020-01-27T18:51:33.3151413Z"
skillrunner.js:518 Object
skillrunner.js:511 "Calling command 'Debug'" "2020-01-27T18:51:33.4091137Z"
skillrunner.js:518 Object
skillrunner.js:511 "'HelloWorld_HeadArms' Debug => " "2020-01-27T18:51:33.4247687Z"
skillrunner.js:518 [object Object]
skillrunner.js:511 "Calling command 'ChangeLED'" "2020-01-27T18:51:33.4247687Z"
skillrunner.js:518 Object
skillrunner.js:511 "Calling command 'PlayAudioClip'" "2020-01-27T18:51:33.4247687Z"
skillrunner.js:518 Object

First off, welcome! We’re glad you’ve joined the Misty community. It is possible something has changes with this sample code

https://docs.mistyrobotics.com/misty-ii/javascript-sdk/tutorials/#head-amp-arm-movement

Adding @johnathan so he can verify.

Thank you! Just copied and pasted it again. Still not working.

Hi @scole,

@Ben is right, it looks like we missed a documentation update for a recent API change for the movement commands. The argument after velocity in the head and arm movement commands is actually duration, and it should be null instead of 0 (Velocity and Duration are mutually exclusive). Thanks for catching this and calling it to our attention!

Try replacing lines 31 - 50 in your code with the following (adjusted velocity for a bit quicker movements):

 // pitch
    misty.MoveHeadDegrees(-40, 0, 0, 90, null, 0, 1500); // pitch up
    misty.MoveHeadDegrees(26, 0, 0, 90, null, 0, 1500); // pitch down
    misty.MoveHeadDegrees(0, 0, 0, 90, null, 0, 1500); // pitch center

    misty.ChangeLED(255, 0, 255); // magenta
    misty.PlayAudio("s_Awe2.wav");

    // yaw
    misty.MoveHeadDegrees(0, 0, -81, 90, null, 0, 1500); // yaw left
    misty.MoveHeadDegrees(0, 0, 81, 90, null, 0, 1500); // yaw right
    misty.MoveHeadDegrees(0, 0, 0, 90, null, 0, 1500); // yaw center

    misty.ChangeLED(255, 255, 0); // yellow
    misty.PlayAudio("s_Awe3.wav");

    // roll
    misty.MoveHeadDegrees(0, -40, 0, 90, null, 0, 1500); // roll left
    misty.MoveHeadDegrees(0, 40, 0, 90, null, 0, 1500); // roll right
    misty.MoveHeadDegrees(0, 0, 0, 90, null, 0, 1500); // roll center

Then, replace lines 66 - 74 with this:

    // left
    misty.MoveArmDegrees("left", -29, 60, null, 0, 1500); // up
    misty.MoveArmDegrees("left", 90, 60, null, 0, 1500); // down

    misty.ChangeLED(128, 0, 0) // maroon
    misty.PlayAudio("s_Joy2.wav");

    // right
    misty.MoveArmDegrees("right", -29, 60, null, 0, 1500); // up
    misty.MoveArmDegrees("right", 90, 60, null, 0, 1500); // down

You can trigger the head movements by waving your hand in front of Misty’s front, center time-of-flight sensor, and when they complete you can trigger the arm movements by waving your hand in front of the rear-facing time-of-flight sensor. We’ll get those docs and the sample code updated on GitHub here shortly!

Worked! Thanks guys!

1 Like

Great. That sample code on GitHub is fixed now, too :slight_smile: Thanks again for taking the time to let us know about the bug!

1 Like