Asked — Edited

Stopping An Action

Hi,

This is a basic scripting question. I figured out how to do QR code tracking. It's pretty straight forward. I entered a word into the QR code generator and then created a script to speak the word in the Camera config. Then I figured out that a QR code could also trigger an action:

Format Code 1: ControlCommand("Auto Position", AutoPositionAction, "3 Legs Dance")

Works great. The question is, what scripting do I enter to get Six to stop dancing after say, a few seconds? Follow up question - where do I enter the script - Format Code 2?

Thanks-

Tom


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#1  

Hey Tom,

This code should work:

ControlCommand("Auto Position", AutoPositionAction, "3 Legs Dance")
Sleep(2000)
ControlCommand("Auto Position", AutoPositionAction, "Stop")

Basically what's happening is

  1. Start the "3 Legs Dance" action
  2. Stop the script for 2000 milliseconds (2 seconds)
  3. Start the "Stop" action which puts the robot back into the neutral position, stopping the dance.

Hope this helps!

#2  

Assuming you want it in the same script, and stop on its own after some number of seconds (I'll use 5 in my sample), your script would look like this:


ControlCommand("Auto Position", AutoPositionAction, "3 Legs Dance")
sleep(5000)
ControlCommand("Auto Position", AutoPositionStop)

The Sleep command expects milliseconds.

You could also create a "stop" AutoPositionAction which returns everything to a resting position, in which case your last line would be:


ControlCommand("Auto Position", AutoPositionAction, "Stop")

You can also have other scripts issue the stop command, so for instance, it would keep dancing until you tell it to stop, or some other event occurs rather than just a simple timer.

Alan

#4  

Works! I also used voice recognition and said "robot stop." That worked too.

Thanks again.