Blog

Nov
28
2014

Cylon 0.21.0 is out!

by Andrew Stewart

Just in time for RobotsConf, we've released Cylon 0.21.0!

This release focuses on stability and simplifying some long-standing architecture concerns.

As always, you can check out the compare view on GitHub.

Updates For Application Developers

  • New connections/devices syntax: - we've updated the syntax for how multiple devices or connections are specified in Cylon.js. This new object-based syntax makes it more straightforward to specify many connections or devices. The existing array syntax, as well as the single-object device/connection syntax, is deprecated, and will be removed in 1.0.0. Here's a comparison of the two:

    // previous syntax, now deprecated:
    Cylon.robot({
      connections: [
        { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
        { name: 'leap', adaptor: 'leapmotion' }
      ],
    
      devices: [
        { name: 'led', driver: 'led', pin: 13, connection: 'arduino' },
        { name: 'button', driver: 'button', pin: 9, connection: 'arduino' }
      ]
    });
    
    // new object-based syntax:
    Cylon.robot({
      connections: {
        arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' },
        leap:    { adaptor: 'leapmotion' }
      },
    
      devices: {
        led:    { driver: 'led',    pin: 13, connection: 'arduino' },
        button: { driver: 'button', pin: 9,  connection: 'arduino' }
      }
    });
    
  • Fluent syntax updates - we've updated our fluent JS syntax a bit, adding #device and #connection methods to help make it easier to set up robots. Here's a comparison:

    // declarative syntax:
    Cylon.robot({
      connections: {
        arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' }
      },
    
      devices: {
        led: { driver: 'led', pin: 13 }
      },
    
      work: function(my) {
        every((1).second(), my.led.toggle);
      }
    }).start();
    
    // fluent syntax
    Cylon
      .robot()
      .connection('arduino', { adaptor: 'firmata', port: '/dev/ttyACM0' })
      .device('led', { driver: 'led', pin: 13 })
      .on('ready', function(bot) {
        setInterval(bot.led.toggle, 1000);
      });
    
    Cylon.start();
    

Updates For Platform Developers

  • No more Connection/Device class: - Cylon's internal 'Connection' and 'Device' classes are no more. Now, when a user adds a Connection or Device to their robot, they're getting a direct instance of an Adaptor/Driver. For the most part, this shouldn't result in issues, but if you're doing manual method proxying you may have issues. These are the requisite changes to sub-modules:

    • in Adaptor subclasses, instead of referencing this.connection, just reference this.
    • in Driver subclasses, instead of referencing this.device, just reference this.
    • in Driver subclasses, this.connection is now an Adaptor instance, not a Connection instance.

Ollie Up at RobotsConf!

Every Cylon.js release adds some new hardware support, and this time we've added cylon-ollie with early support for the new Ollie robot from our friends at Orbotix. We're bringing some to RobotsConf for people to play with.

Look for our "preview" blog post about RobotsConf coming next week…

For more updates, be sure to follow us on Twitter at @CylonJS.