Category Archives: robotics

Calico Myro Robot Simulation: faster than real-time

A few Myro users have wondered what it would take to make the Calico Myro simulator run faster than real time. This is possible in the current Myro (Calico version 2.4.4 and earlier). In addition, Calico 3.0.0 has a new method, called simulate:

Myro.Simulator.simulate(duration, stepTime)

This method will move the robot for duration (given in seconds), stepping stepTime units at a time, and then update the Simulation window.

Below you will find an example of using the simulator decoupled from real time. The following uses the new ICalico notebook interface.

In [1]:
import Myro
In [2]:
Myro.init("sim")
robot = Myro.getRobot()
You are using:
   Simulated Fluke, version 1.0.0
   Simulated Scribbler 2, version 1.0.0
Hello, my name is 'Scribby'!
In [4]:
robot.setOption("show-sensors", True)
In [5]:
Myro.getSimulation()
Out[5]:
In [6]:
Myro.getSimulation().stop() # stop the simulation loop
In [7]:
robot.forward(1) # queues request to move
In [8]:
robot.update() # fires waiting requests
In [9]:
robot.setPose(100, 250, 0) # manually position robot
In [10]:
Myro.getSimulation().simulate(.1) # simulate some time
In [11]:
Myro.robot._getLocation() # normal robot.getLocation() would fire in robot.update()
Out[11]:
[151.19999694824219, 250.0]
In [12]:
Myro.getSimulation()
Out[12]:
In []: