Espruino robot simulator

Posted on
  • Hi all,

    I am working on a project of a light simulation environment for an Espruino-powered robot, inspired by the distance sensing robot.

    The simulator works in the browser, but the code of the robot is in a file called by a tiny webserver implemented using node.js. I'd like to make it fully compatible with the one running on Espruino. I created a simulation layer for things like Pins, functions like digitalWrite() and digitalRead(), etc.

    Full code and some documentation is available at GitHub, where you can also find some screenshots and a wiki.

    If interested (maybe just as beta-testers), please contact me.


  • Wow, that looks great! I love the 3D view!

    As you're serving off node.js, I guess you could actually open a port that you could point the Web IDE at (it allows you to connect over TCP/IP now) - then you could actually use the Web IDE itself to interact and upload new code!

  • Thank you for the suggestion. I'll try and check if it is possible. By now, the web server implemented in node.js creates instances of one or several virtualized robots, receives POST requests in JSON format, and calls the update() function of each robot passing the received data and getting information about what to do.
    Does the Web IDE expect a connection à-la telnet? Is there an example somewhere?

  • There's no example I'm afraid - Step 2 on this page shows you how to set up the Web IDE.

    Espruino will treat it just like a telnet connection to a JavaScript shell. You might be able to feed the characters that come in straight to a Node.js REPL, but there are obviously some security implications to just giving anyone command-access to Node.js your PC :)

  • Ok, I'll try when I am done with something which has now higher priority, like fixing the code and produce some documentation... :)


  • For those interested, I prepared a wiki page explaining how to use the code of the behaviour with a real Espruino-controlled robot:­e/wiki/EspruinoRobot
    Comments are welcome.

  • Wow, could really do with this if so students could use it to test ideas before using our real espruino robots!

  • I guess you'd be wanting to use it from the graphical editor?

    I'd be open to ideas about how this could be added to the IDE - I guess maybe an option that would appear when the 'connect' button got clicked...

  • yeh, that's right. It could appear in the connect menu 'simulator' or something similar.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Espruino robot simulator

Posted by Avatar for loris @loris