Blog

May
31
2018

Gobot - Release 1.11

Thanks to our wonderful contributors, we've just released version 1.11 of Gobot. The newest Gobot updates to the newest go-sdl2 package, and also adds 2 new kinds of controllers: the XBox 360 "Rock Band" drum controller, and also the T-Flight Hotas X flight controller. We also have added lots more features to the DJI Tello, including PalmLand() which in fact thanks to the Intel Movidius chip in the drone does in fact land on the palm of your hand. Neat!

Check out this code sample:

  package main

  import (
      "time"

      "gobot.io/x/gobot"
      "gobot.io/x/gobot/platforms/dji/tello"
  )

  func main() {
      drone := tello.NewDriver("8888")

      work := func() {
          drone.TakeOff()

          gobot.After(10*time.Second, func() {
              drone.PalmLand()
          })
      }

      robot := gobot.NewRobot("tello",
          []gobot.Connection{},
          []gobot.Device{drone},
          work,
      )

      robot.Start()
  }

This new release also updates to the newest GoCV which adds the new default auto-configuration allowing you usually to just install OpenCV and "go run" code without needing all of the extra environment setup that previous versions had required. We like less!

Full Changelog

There's even more in the new release, so if you want the full details, check out the release info at https://github.com/hybridgroup/gobot/releases/tag/1.11.0.

Keep Informed

Keep informed with the latest project updates by following us on Twitter at @gobotio. Thank you!

Apr
20
2018

Hello, Tello - Hacking Drones With Go

The DJI Tello is a new quadcopter which combines powerful technology from DJI and Intel into a very tiny package. We recently got our hands on a couple of these new drones, and we now have support for Gobot, so you can control the drone using the Go programming language.

For only around $99 US, it is amazing how many features are included. Like many more expensive models, the Tello connects to the ground controller via WiFi, and includes an onboard 5 megapixel HD camera along with various other sensors.

However, what really sets the Tello apart is the 14-core processor from Intel that includes an onboard Movidius Myriad 2 VPU (Video Processing Unit) for advanced imaging and vision processing.

Despite all this cool hardware, the official Tello SDK only offers a very limited set of the drone's overall capabilities. Luckily, there is a much better API hiding under the surface for those who know how to look. This undocumented API is the one used by the official Tello Android and iOS applications.

An active community has quickly formed around hacking the ground station and video protocols used by the Tello. Thanks to tools like Wireshark, and the generous nature of open source, we've collectively already deciphered much of the protocol used by the Tello.

We have used this knowledge to create a new driver for Gobot that lets you explore the drone's functionality, and combine it with the other capabilities of the Gobot framework, such as controlling the Tello drone with a Playstation Dualshock3 joystick.

Obtaining a drone

The initial shipments of this interesting new drone have already sold out very quickly in many places. You can purchase online via Amazon.com, or you can also order directly from the DJI store.

Ready for takeoff

In the Gobot implementatation, we have tried to expose the Tello API in a way that is mostly compatible with other drones that are already supported in Gobot.

Here is an example that just takes off, and 5 seconds later, lands:

  package main

  import (
      "time"

      "gobot.io/x/gobot"
      "gobot.io/x/gobot/platforms/dji/tello"
  )

  func main() {
      drone := tello.NewDriver("8888")

      work := func() {
          drone.TakeOff()

          gobot.After(5*time.Second, func() {
              drone.Land()
          })
      }

      robot := gobot.NewRobot("tello",
          []gobot.Connection{},
          []gobot.Device{drone},
          work,
      )

      robot.Start()
  }

Controlling your flight

The Tello is pretty manueverable, and there are a number of different axes on which you can control the drone. Like most fly by wire devices, the control system closely parallels those used by radio control helicopters and airplanes.

However, one big advantage of most multicopters is their stability while in-flight. This allows you to simply send flight motion commands to the drone, like "go right", and then have the drone respond relative to its original position. This is a lot easier to control then the traditional control stick of an R/C helicopter, especially if your intention is to avoid crashes while coding your drone.

For example, instead of worrying about "yaw" or "pitch", you can just tell the drone to fly "forward" or "right" like this:

  package main

  import (
      "time"

      "gobot.io/x/gobot"
      "gobot.io/x/gobot/platforms/dji/tello"
  )

  func main() {
      drone := tello.NewDriver("8888")

      work := func() {
          drone.TakeOff()

          gobot.After(3*time.Second, func() {
              drone.Forward(10)
          })

          gobot.After(6*time.Second, func() {
              drone.Backward(10)
          })

          gobot.After(9*time.Second, func() {
              drone.Land()
          })
      }

      robot := gobot.NewRobot("tello",
          []gobot.Connection{},
          []gobot.Device{drone},
          work,
      )

      robot.Start()
  }

Want to do tricks? No problem, the Tello can perform flips. Here is a short example:

  package main

  import (
      "time"

      "gobot.io/x/gobot"
      "gobot.io/x/gobot/platforms/dji/tello"
  )

  func main() {
      drone := tello.NewDriver("8888")

      work := func() {
          drone.TakeOff()

          gobot.After(5*time.Second, func() {
              drone.FrontFlip()
          })

          gobot.After(10*time.Second, func() {
              drone.BackFlip()
          })

          gobot.After(15*time.Second, func() {
              drone.Land()
          })
      }

      robot := gobot.NewRobot("tello",
          []gobot.Connection{},
          []gobot.Device{drone},
          work,
      )

      robot.Start()
  }

Getting the messages

The Tello sends a number of different telemetry messages back down to the ground station. For example, the current battery level and the drone's height. Take a look at the tello.FlightDataEvent for more information.

Streaming video

You can also view streaming video being sent from the drone to the ground station. Here is a sample that obtains the video stream from the Tello, and then displays it using the excellent open source MPlayer (https://mplayerhq.hu)

  package main

  import (
      "fmt"
      "os/exec"
      "time"

      "gobot.io/x/gobot"
      "gobot.io/x/gobot/platforms/dji/tello"
  )

  func main() {
      drone := tello.NewDriver("8890")

      work := func() {
          mplayer := exec.Command("mplayer", "-fps", "25", "-")
          mplayerIn, _ := mplayer.StdinPipe()
          if err := mplayer.Start(); err != nil {
              fmt.Println(err)
              return
          }

          drone.On(tello.ConnectedEvent, func(data interface{}) {
              fmt.Println("Connected")
              drone.StartVideo()
              drone.SetVideoEncoderRate(4)
              gobot.Every(100*time.Millisecond, func() {
                  drone.StartVideo()
              })
          })

          drone.On(tello.VideoFrameEvent, func(data interface{}) {
              pkt := data.([]byte)
              if _, err := mplayerIn.Write(pkt); err != nil {
                  fmt.Println(err)
              }
          })
      }

      robot := gobot.NewRobot("tello",
          []gobot.Connection{},
          []gobot.Device{drone},
          work,
      )

      robot.Start()
  }

You can also use computer vision software such as GoCV (https://gocv.io/), our Go language wrapper around OpenCV to perform face tracking and other interesting applications.

How it works

The ground station connects to the Tello drone using WiFi. The protocol to send commands to the drone uses UDP packets in a specific binary format. The responses from the drone back to the ground station likewise use UDP packets.

Control messages

The packet format for the control messages, and the responses from the drone, both use the same basic format.

Position Usage
0 0xcc indicates the start of a packet
1-2 Packet size, 13 bit encoded ([2] << 8) | ([1] >> 3)
3 CRC8 of bytes 0-2
4 Packet type ID
5-6 Command ID, little endian
7-8 Sequence number of the packet, little endian
9-(n-2) Data (if any)
(n-1)-n CRC16 of bytes 0 to n-2

So for example, the takeoff command packet looks like this:

0xcc 0x58 0x00 0x7c 0x68 0x54 0x00 0xe4 0x01 0xc2 0x16

Value Usage
0xcc start of packet
0x58 0x00 Packet size of 11
0x7c CRC8 of bytes 0-2
0x68 Packet type ID
0x54 0x00 "Takeoff" command ID, little endian
0xe4 0x01 Sequence number of the packet, little endian
0xc2 0x16 CRC16 of bytes 0 to 8

Video packets

The streaming video is also sent to the ground station on a different UDP port. Unfortunately the Tello does not just use one of the existing standards for streaming video such as RTSP. Instead, the raw video packets are sent via UDP and need to be reassembled and decoded before they can be viewed.

Since the size of a single video frame is larger than the size of a single UDP packet, the Tello breaks apart each frame, and sends the packets with header of 2 bytes to indicate how they need to be reassembled.

Position Usage
0 Sequence number
1 Sub-sequence number
2-n Video data

The video data itself is just H264 encoded YUV420p. Using this information, it is possible to decode the video using standard tools such as ffmpeg, once you remove the header bytes.

Thank you to the community

As mentioned in the beginning of this post, the Gobot driver for the DJI Tello could not exist without the many contributions and investigation of the awesome community on the unofficial Tello forum.

Special thanks to @Kragrathea who figured out a LOT of the packets and code as implemented in C#: https://github.com/Kragrathea/TelloPC

Also thanks to @microlinux with the Python library which served as the first example for the Tello community: https://github.com/microlinux/tello

And bluejune's incredible work on the https://bitbucket.org/PingguSoft/pytello repo, especially the Wireshark Lua dissector for Tello which has proven indispensable.

Last but not least, thank you @maruel for helping figure out various Go-related video decoding questions.

Keep In Touch

Want to know about the latest Gobot news? Follow us on Twitter at @gobotio. Thank you!

Oct
23
2017

Gobot 1.7 - Eyes Of The World

It has been a few months since our last release, and the new Gobot v1.7 has lots of good things onboard.

We have added support for OpenCV 3, by way of the brand new GoCV computer vision package.

Also, thanks to the wonderful humans at the Gophercon hardware hackday, we have also added support for the very aptly named GoPiGo3 robot from Dexter Industries. We also have experimental support for the Holystone HS-200 drone.

For the full changelog, here is a link to the Gobot 1.7 release:

https://github.com/hybridgroup/gobot/releases/tag/v1.7.0

Here are some highlights of what we've added for this new release.

OpenCV 3 Using GoCV

We've had support for OpenCV for quite some time, but have been stuck on older versions (2.x) from a couple of years ago, due to the challenges involved in wrapping the OpenCV C++ code in Go.

Thanks to a new project from our team called GoCV (https://gocv.io), we now can use the latest version of OpenCV 3.3. We even have it running on Linux, OS X, and Windows too!

Because of this very significant development, Gobot can make use of the very latest work in open source computer vision. Watch this space for more soon.

GoPiGo3 Robot

Thanks to the efforts of an entire team of contributors at Gophercon, especially @ulisesflynn we have support for the GoPiGo3 robot from Dexter Industries..

The GoPiGo3 is a rolling robotic platform based on the Raspberry Pi, intended for people who want to learn about robotics. In addition to the built-in motor controller, you can also connect Grove GPIO, Analog (AIO), and I2C devices very easily. You can use any of the Gobot GPIO, AIO, or I2C drivers with the GoPiGo3.

Check out this example that blinks the LEDs on the GoPiGo's built-in "eyes":

package main

import (
    "fmt"
    "time"

    "gobot.io/x/gobot"
    "gobot.io/x/gobot/platforms/dexter/gopigo3"
    "gobot.io/x/gobot/platforms/raspi"
)

func main() {
    raspiAdaptor := raspi.NewAdaptor()
    gpg3 := gopigo3.NewDriver(raspiAdaptor)

    work := func() {
        on := uint8(0xFF)
        gobot.Every(1000*time.Millisecond, func() {
            err := gpg3.SetLED(gopigo3.LED_EYE_RIGHT, 0x00, 0x00, on)
            if err != nil {
                fmt.Println(err)
            }
            err = gpg3.SetLED(gopigo3.LED_EYE_LEFT, ^on, 0x00, 0x00)
            if err != nil {
                fmt.Println(err)
            }
            on = ^on
        })
    }

  robot := gobot.NewRobot("gopigo3eyeleds",
      []gobot.Connection{raspiAdaptor},
      []gobot.Device{gpg3},
      work,
  )

  robot.Start()
}

SPI

In order to implement the above-mentioned GoPiGo3 support, our intrepid Gophercon contributors have also added Serial Peripheral Interface (SPI) support to Gobot.

SPI is a standard high-speed communication interface used for embedded devices. Making use of the fine work done by Golang expert @rakyll on defining a SPI interface for Go we are now able to connect SPI devices to the rest of the Gobot ecosystem.

The first platform supporting the SPI interface is an adaptor for the Raspberry Pi, but we will be adding all of the Linux systems that support SPIDEV.

Need to add a SPI device to your Gobot solution? Now you can! Let us know what devices you want, we're happy to help.

Holystone HS-200 Drone

The other major platform contribution to come out of Gophercon was experimental support for the Holystone HS-200 WiFi controlled drone. We did not know much about this quadcopter but thanks to the efforts of contributor @GuySirton we have been able to fly.

There's More

We have more goodness in this release, so do please checkout the changelog for the complete story.

https://github.com/hybridgroup/gobot/releases/tag/v1.7.0

Keep In Touch

Want to know about the latest Gobot news? Follow us on Twitter at @gobotio. Thank you!

May
10
2017

Gobot 1.5 - On Pins And Boards

This month's Gobot 1.5 release focuses on big things in very small packages.

We now have support for a couple different Analog to Digital Converter (ADC) devices such as the ADS1015. This lets you add analog input to digital-only boards such the Raspberry Pi, with a single line of code.

There is also a new subsystem & interface for Pulse Width Modulation (PWM) pins. The Raspberry Pi, Intel Joule, Beaglebone Black, and all of Gobot's other single-board Linux Adaptors now all support the new PWMPinner interface.

Our support for the BBC Microbit has been expanded. We've also added new board support for the new ASUS Tinker Board, along with the C.H.I.P. Pro.

For the full changelog, here is a link to the Gobot 1.5 release:

https://github.com/hybridgroup/gobot/releases/tag/v1.5.0

Or read on, for the rundown of what we've done for the new release.

The Analog Experience

Thanks to our awesome contributor @bezineb5 we now have support for the ADS1015 and ADS1115, both ADC devices with an I2C hardware interface:

Since both of these drivers also implement the Gobot AnalogReader interface, it lets you connect any of the Gobot aio sensors with 1 line of code.

Here is an example that uses an ADS1015 with a Raspberry Pi and an analog rotary dial:

package main

import (
        "fmt"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/drivers/aio"
        "gobot.io/x/gobot/drivers/i2c"
        "gobot.io/x/gobot/platforms/raspi"
)

func main() {
        board := raspi.NewAdaptor()
        ads1015 := i2c.NewADS1015Driver(board)
        sensor := aio.NewGroveRotaryDriver(ads1015, "0")

        work := func() {
                sensor.On(aio.Data, func(data interface{}) {
                        fmt.Println("sensor", data)
                })
        }

        robot := gobot.NewRobot("sensorBot",
                []gobot.Connection{board},
                []gobot.Device{ads1015, sensor},
                work,
        )

        robot.Start()
}

We've connected the ADS1015 driver to use the Raspberry Pi as its adaptor, and then the Grove Rotary driver to use the ADS1015 driver as its adaptor.

This is a good example of how interfaces in Golang can be used as part of Gobot.

With 1 import, and 1 line of code, you can add analog capabilities to a Raspberry Pi or an Intel Joule.

Big PWMPin

We have added a new shared interface for using Pulse Width Modulation (PWM) pins.

Every adaptor that provides a PWM capability now implements a PWMPin() method, to satisfy the new PWMPinner interface.

PWMPin allows for more granular control of PWM period, duty cycle, and polarity. This lets you control high-resolution servos and other applications that require low level PWM control.

Of course the current PWMWrite() and ServoWrite() methods now use PWMPin.

Improved Support for Intel Joule and Edison

Speaking of the Joule, we've improved our support for the Intel Joule and Intel Edison boards.

Both boards now support the full range of GPIO, PWM, and I2C capabilities of their respective hardware, with updated pin mappings.

The pin naming on the Intel Joule now properly matches the labels on the breakout board, to make it much easier to code for.

ASUS Tinker Board

We've added support for the new single-board Linux computer from ASUS called the Tinker Board.

The Tinker Board is a single board SoC computer based on the Rockchip RK3288 processor. It has built-in GPIO, PWM, SPI, and I2C interfaces.

Featuring a quad-core Rockchip RK3288 ARM-based processor, you can achieve some pretty serious performance using Golang.

You can find out more at: https://gobot.io/documentation/platforms/tinkerboard.

C.H.I.P. Pro

We've also added support for the C.H.I.P. Pro, the new professional board from Next Thing Co.

The C.H.I.P. Pro is based on the GR8, Next Thing Co's own ARMv7-A processor.

Like the C.H.I.P., it has built-in WiFi and Bluetooth 4.x interfaces, along with GPIO, PWM, I2C, and even a single ADC.

More info is at: https://gobot.io/documentation/platforms/tinkerboard.

More Fun With Microbit

In Gobot v1.3, we added support for the BBC Microbit. Now we've added a new driver for it called 'IOPinDriver'.

The IOPinDriver supports the standard Gobot DigitalReader, DigitalWriter, and AnalogReader interfaces.

This means you can use your Microbit with any of the normal gpio or aio drivers.

Here is an example that uses a Microbit along with the gpio Button and LED drivers:

package main

import (
        "os"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/drivers/gpio"
        "gobot.io/x/gobot/platforms/ble"
        "gobot.io/x/gobot/platforms/microbit"
)

func main() {
        bleAdaptor := ble.NewClientAdaptor(os.Args[1])

        ubit := microbit.NewIOPinDriver(bleAdaptor)
        button := gpio.NewButtonDriver(ubit, "0")
        led := gpio.NewLedDriver(ubit, "1")

        work := func() {
                button.On(gpio.ButtonPush, func(data interface{}) {
                        led.On()
                })
                button.On(gpio.ButtonRelease, func(data interface{}) {
                        led.Off()
                })
        }

        robot := gobot.NewRobot("buttonBot",
                []gobot.Connection{bleAdaptor},
                []gobot.Device{ubit, button, led},
                work,
        )

        robot.Start()
}

The BBC Microbit is a cool little board for learning that is seemingly full of surprises.

Once again, the elegance of using Golang interfaces pays off with a lot of flexibility.

More info about the Microbit IOPinDriver is at:

https://gobot.io/documentation/drivers/microbit-iopin.

A Release Of Some Substance

This has been one of our more substantial releases. This post has been all about the new capabilities, but there are also a number of important bug fixes in this release. Not to mention that our overall test coverage has increased to over 85%. Thank you so much to all of the contributors and collaborators that make Gobot happen.

Stay Informed

Stay informed about the latest Gobot project developments by following us on Twitter at @gobotio. Thank you!

Apr
13
2017

Gobot - 1.4 Spring Cleaning

This week is National Robotics Week, along with last night being Yuri's Night, we decided it was the perfect time to release the next Gobot update.

In that spirit, we released Gobot 1.4:

https://github.com/hybridgroup/gobot/releases/tag/v1.4.0

Thank you to the largest number of first-time contributors ever in a single Gobot release!

We're Getting It Covered

SCaLE15x kids

This is a big release for stability and test coverage. We've reached some important testing milestones, such as over 90% test coverage for Gobot core, sysfs, and drivers.

Overall, the entire codebase now has over 80%+ test coverage.

Check out the latest stats at https://codecov.io/gh/hybridgroup/gobot

The Race Is Run

Thanks to ongoing contributor @maruel, we discovered that the race detection in our Travis builds were not triggering the errors they should have been.

Our team then set out to find and fix every race condition detected by the new, improved test suite. We succeeded, and all those fixes are a part of this new release.

More I2C Devices

Thanks to contributors we have added support for a few new I2C devices:

We have also done refactoring and fixes to all of the various I2C sensors, now numbering 20 in total.

Keep In Touch

Keep in touch with the latest activity on the project by following us on Twitter at @gobotio. Thank you!

Mar
22
2017

Gobot - 1.3 Is Here

Hello, dear friends. We present to you today release v1.3 of Gobot, our Golang framework for programming devices in the real world.

We've been very busy at conferences like SCaLE 15x over the last month since the big Golang birthday bash, but thanks to our hard-working team and contributors we're so very happy to present to you our latest and greatest.

BBC Microbit support

Inspired by lots of activity around the BBC Microbit in the kids programming world, we now have support for this friendly Bluetooth LE connected microcontroller.

Here is an example that uses the built-in LEDs to display "Hello" then a smile:

package main

import (
        "os"
        "time"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/platforms/ble"
        "gobot.io/x/gobot/platforms/microbit"
)

func main() {
        bleAdaptor := ble.NewClientAdaptor(os.Args[1])
        ubit := microbit.NewLEDDriver(bleAdaptor)

        work := func() {
                ubit.Blank()
                gobot.After(1*time.Second, func() {
                        ubit.WriteText("Hello")
                })
                gobot.After(7*time.Second, func() {
                        ubit.Smile()
                })
        }

        robot := gobot.NewRobot("blinkBot",
                []gobot.Connection{bleAdaptor},
                []gobot.Device{ubit},
                work,
        )

        robot.Start()
}

The Gobot interface uses the cool Microbit firmware created by @sandeepmistry we are able to use the Microbit's BLE interface to access some of the built-in capabilities.

DragonBoard

Thanks to contributor @thetooth we now have support for the DragonBoard using the GPIO and I2C interfaces. Thank you!

More I2C Devices

Thanks to contributor @erkkah we have more work on the the Gobot I2C implementations, alongside a couple of new I2C devices:

  • DRV2605L Haptic Controller
  • TSL2561 Luminosity Sensor

New Gort Release

We've also released Gort v0.8.0 to support the Microbit, along with a couple other updates.

Code Coverage

We've switched our code coverage to an awesome new free service codecov.io and worked on upping our coverage based on the more realistic numbers.

The code coverage dashboard for Gobot is located at https://codecov.io/gh/hybridgroup/gobot

First, the good news:

  • Gobot core is at an excellent level of code coverage, with only a handful of lines lacking tests.
  • Gobot API is also at over 96% coverage.

Now, the areas where we need work:

  • Gobot sysfs around 65% coverage.
  • Gobot drivers around 75% coverage.
  • Gobot platforms only around 57% coverage. Ouch!

So, if you ever wanted to help out, dear reader, that would be a greatly appreciated place to pitch in.

Full Changelog

There are many fixes and features in this new release, please take a look at the release info at https://github.com/hybridgroup/gobot/releases/tag/v1.3.0.

Keep On Moving

Stay in touch with the project by following us on Twitter at @gobotio. Thank you!

Mar
12
2017

All About The Next Generation At SCaLE15x

Last weekend, we took the robot world tour back to L.A. for SCaLE15x. Back for its 15th year, the community-organized Southern California Linux Expo is one of our favorite conferences because of all the young programmers (read: kids) that participate.

SCaLE15x kids

We brought out the latest version of our robotic "lasertag" game running the newest Gobot with all the trimmings, and the youthful crowd nearly went, dare we say it, "Berzerk"*.

As flashy as the LEDs in our demo are, however, they are only one attraction for the kids of "SCaLE: The Next Generation". SCaLE: TNG is an entire day with a parallel track of presentations by kids, for kids, that takes place colocated with the main conference. How awesome is that!

Kids, parents, and teachers from all over attend sessions, learn from each other, and even occasionally from a few of us so-called grownups. And most importantly, play with robots and spark their excitement about learning and sharing.

Of course, the main SCaLE conference is well attended by many members of the open source community, with many technical sessions and workshops. But it is SCaLE: THG that really helps make it special.

Thank you to everyone who makes this fantastic annual event happen, we are so very happy to be a part of it!

Please follow us on Twitter at @gobotio for the latest project information as we continue our adventures in programming the physical world using Golang.

* Yes, that was an 80s videogame reference.

Feb
16
2017

Gobot - 1.2 Released

Happy release day! In coordination with the Golang 1.8 release party for what has become known as "the best Golang yet", we are also releasing Gobot 1.2 today.

If you have seen the recent FOSDEM 2017 talk, you already know that the real-time capabilities of Gobot have been substantially improved just by virtue of being written in the Go programming language.

That said, we've also been really busy working on improving Gobot itself to better take advantage of all of the fantastic work being done in the broader community.

Our wonderful contributors and project advisors have done a lot, here are some highlights from the new release:

New improved BLE support

We've switched to the Currant Labs ble package for all Bluetooth Low Energy communication.

As a result, you can now use all supported BLE peripherals such as the Sphero BB-8 on both OSX and Linux.

Check out a short code sample:

package main

import (
        "fmt"
        "os"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/platforms/ble"
        "gobot.io/x/gobot/platforms/sphero/bb8"
)

func main() {
        bleAdaptor := ble.NewClientAdaptor(os.Args[1])
        bb := bb8.NewDriver(bleAdaptor)

        work := func() {
                bb.On("collision", func(data interface{}) {
                        fmt.Printf("collision detected = %+v \n", data)
                        bb.SetRGB(255, 0, 0)
                })

                bb.SetRGB(0, 255, 0)
                bb.Roll(80, 0)
        }

        robot := gobot.NewRobot("bb8",
                []gobot.Connection{bleAdaptor},
                []gobot.Device{bb},
                work,
        )

        robot.Start()
}

This also shows off the new collision detection support added by contributor @durgeshm. Too cool!

Bluetooth LE connection to Arduino 101

We now offer BLE support to connect to Arduino 101/Genuino 101 Bluetooth-enabled microcontrollers that are running BLEFirmata.

Here is a code sample:

package main

import (
        "os"
        "time"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/drivers/gpio"
        "gobot.io/x/gobot/platforms/firmata"
)

func main() {
        firmataAdaptor := firmata.NewBLEAdaptor(os.Args[1])
        led := gpio.NewLedDriver(firmataAdaptor, "13")

        work := func() {
                gobot.Every(1*time.Second, func() {
                        led.Toggle()
                })
        }

        robot := gobot.NewRobot("bot",
                []gobot.Connection{firmataAdaptor},
                []gobot.Device{led},
                work,
        )

        robot.Start()
}

Looks just like any of the other Firmata types like the original serial Firmata or TCPFirmata because it is!

You can also use the new firmata.BLEAdaptor with other BLE-connected microcontrollers running BLEFirmata.

This support was inspired by some cool work originally done in JavaScript by @monteslu.

Big I2C Refactor

Thanks to contributor @erkkah and ace Golang trainer/code coach Bill Kennedy we have done a major refactoring of the Gobot i2c package.

You can optionally override the defaults to control which I2C bus you are using, and also use multiple I2C buses at the same time by putting different I2C devices on separate buses. Maximum performance and flexibility!

For example:

// connect to device on default bus at default address
blinkm := i2c.NewBlinkMDriver(e)

// connect to device on I2C bus 1 at default address for this device
bmp180 := i2c.NewBMP180MDriver(e, i2c.WithBus(1))

// connect to device on I2C bus 0 at address 0x09
mcp := i2c.NewMCP23017Driver(e, i2c.WithBus(0), i2c.WithAddress(0x09))

We've also upped our test coverage, and made it a lot easier to write new Drivers for I2C devices.

MQTT Improvements

We have a number of key improvements and bugfixes for our MQTT support, including adding a new Driver for more easily representing "virtual devices" as well as full support for TLS/SSL.

NATS, Natch

We also added a new NATS Driver so you can use "virtual devices" with the NATS messaging server.

UPDATE: also added TLS/SSL thanks to a last-minute PR from dnishimura thank you!

Full Changelog

There are lot of fixes and features in this new release, check out the release info at https://github.com/hybridgroup/gobot/releases/tag/v1.2.0.

Stay In Touch

Stay in touch with the project by following us on Twitter at @gobotio. Thank you!

Feb
09
2017

Gobot At FOSDEM 2017

Last week we took the robot world tour to Brussels, Belgium for FOSDEM 2017. Founded in 2000, FOSDEM is unarguably one of Europe's most fun and important open source conferences, and we were excited to share our work in open source robotics & IoT using Golang.

Lots of enthusiasm energized the conference, and the Golang room was so packed that they literally stopped people from coming in. Crazy! The live video feed was excellent, however, and the entire talk was recorded. You can watch the video online here. Slides and code are located here.

Thanks to all of you who came out to see us! We had a great time showing our upcoming Gobot 1.2 release, that will be coming out just in time for the Golang 1.8 release party next week!

Please follow us on Twitter at @gobotio for the latest project information as we continue our journey.

Jan
09
2017

Gobot - The 1.1 Release

It was just a few weeks ago since the release of version 1.0 of Gobot.

Thanks to the enthusiasm and work of our community, we've just had our 1.1 release already.

We are now up to 1500 commits from 56 contributors, and we're going strong.

Here are a few highlights from this new release:

ESP8266 and wireless Arduino

We now offer support for the ESP8266 wireless microcontroller.

Check out a short code sample:

package main

import (
  "time"

  "gobot.io/x/gobot"
  "gobot.io/x/gobot/drivers/gpio"
  "gobot.io/x/gobot/platforms/firmata"
)

func main() {
  firmataAdaptor := firmata.NewTCPAdaptor("192.168.1.27:3030")
  led := gpio.NewLedDriver(firmataAdaptor, "13")

  work := func() {
    gobot.Every(1*time.Second, func() {
      led.Toggle()
    })
  }

  robot := gobot.NewRobot("bot",
    []gobot.Connection{firmataAdaptor},
    []gobot.Device{led},
    work,
  )

  robot.Start()
}

You can also use the new firmata.TCPAdaptor() with a WiFi-connected Arduino.

New I2C Drivers

Thanks to contributors @elopio and @schmidtw we now have support for the following new I2C devices:

  • BMP180 barometer/temperature sensor
  • L3GD20H gyroscope
  • SHT3X temperature/humidity sensor

Parrot Bebop

We have several improvements and bugfixes for the Parrot Bebop and Bebop 2, including support for the latest firmware and RTP video streaming.

Full Changelog

There is lots more in this new release, check out the release info at https://github.com/hybridgroup/gobot/releases/tag/v1.1.0.

Keep Up To Date

Keep up to date with the project by following us on Twitter at @gobotio. Thank you!

Dec
21
2016

Gobot - The Big One Oh!

It's been a long time coming, and version 1.0 of Gobot is finally here!

We're really excited to share this big news with all of you.

If you want a "media-friendly" version of the story, here is our press release about it: http://gobot.io/news/gobot-1.0-release/

However, if you want the serious technical details, then read on!

You can now use "Classic Gobot" to write the fewest possible lines of Golang code that can control physical devices.

Or you can use "Metal Gobot", and use the low-level Gobot adaptors and drivers directly.

Lastly, you can use "Master Gobot", to include the entire Gobot API and control swarms of devices.

These are just some of the major changes we've made for the 1.0 release.

Classic Gobot

We've reduced the amount of Golang code to control physical devices down as simple as possible, but no simpler.

Here is the "Hello, World of Things" aka a program that blinks an LED. In this case the platform is an Arduino microcontroller.

package main

import (
        "time"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/drivers/gpio"
        "gobot.io/x/gobot/platforms/firmata"
)

func main() {
        firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
        led := gpio.NewLedDriver(firmataAdaptor, "13")

        work := func() {
                gobot.Every(1*time.Second, func() {
                        led.Toggle()
                })
        }

        robot := gobot.NewRobot("bot",
                []gobot.Connection{firmataAdaptor},
                []gobot.Device{led},
                work,
        )

        robot.Start()
}

Metal Gobot

Metal Gobot gives the developer the lowest-level control over the hardware interfaces themselves. If you want discrete control over exactly how your application handles concurrency, failover, and everything else, then Metal Gobot is looking pretty shiny.

This is a program that blinks an LED using "Metal Gobot" style. The platform is an Intel Edison single-board Linux computer.

package main

import (
        "time"

        "gobot.io/x/gobot/drivers/gpio"
        "gobot.io/x/gobot/platforms/intel-iot/edison"
)

func main() {
        e := edison.NewAdaptor()
        e.Connect()

        led := gpio.NewLedDriver(e, "13")
        led.Start()

        for {
                led.Toggle()
                time.Sleep(1000 * time.Millisecond)
        }
}

Master Gobot

Master Gobot adds the built-in RESTful APIs, along other internal structures you need to control groups of robots.

This program controls a swarm of four Sphero robots:

package main

import (
        "fmt"
        "time"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/api"
        "gobot.io/x/gobot/platforms/sphero"
)

func NewSwarmBot(port string) *gobot.Robot {
        spheroAdaptor := sphero.NewAdaptor(port)
        spheroDriver := sphero.NewSpheroDriver(spheroAdaptor)
        spheroDriver.SetName("Sphero" + port)

        work := func() {
                spheroDriver.Stop()

                spheroDriver.On(sphero.Collision, func(data interface{}) {
                        fmt.Println("Collision Detected!")
                })

                gobot.Every(1*time.Second, func() {
                        spheroDriver.Roll(100, uint16(gobot.Rand(360)))
                })
                gobot.Every(3*time.Second, func() {
                        spheroDriver.SetRGB(uint8(gobot.Rand(255)),
                                uint8(gobot.Rand(255)),
                                uint8(gobot.Rand(255)),
                        )
                })
        }

        robot := gobot.NewRobot("sphero",
                []gobot.Connection{spheroAdaptor},
                []gobot.Device{spheroDriver},
                work,
        )

        return robot
}

func main() {
        master := gobot.NewMaster()
        api.NewAPI(master).Start()

        spheros := []string{
                "/dev/rfcomm0",
                "/dev/rfcomm1",
                "/dev/rfcomm2",
                "/dev/rfcomm3",
        }

        for _, port := range spheros {
                master.AddRobot(NewSwarmBot(port))
        }

        master.Start()
}

Other Major Changes

Here is a list of some of our other major changes. If you want the complete CHANGELOG, we've got that as well.

  • Refactor events to use channels all the way down. Allows 'metal' development using Gobot libs
  • No longer return slices of errors, instead use hashicorp/go-multierror
  • Use canonical import domain of gobot.io for all code
  • Add golang 1.7 & 1.8 to build matrix for TravisCI
  • Reduce Travis builds to golang 1.4+ since it is late 2016 already
  • Complete move of test interfaces into the test files where they belong
  • Add missing godocs for everything

We've also added support for the NATS open source messaging server.

Also, many updates to our hardware support, such as:

  • I2C
  • GPIO
  • Beaglebone
  • Bluetooth LE
  • Intel Edison
  • Intel Joule
  • Arduino
  • C.H.I.P.
  • Sphero BB-8

We Had To Change The Interface

This is a big release, and makes breaking changes to a number of APIs. Normally this is frowned upon in the Golang programming world.

However, we recognized that we could greatly simplify how code could be written, in particular by removing things that were redundant or repetitive.

We're sorry about any inconvenience this may bring.

Now the interfaces are stable, and we don't anticipate any more breaking changes in the near future.

Thanks To The Contributors

We'd really like to extend a massive thanks to the many contributors who've helped get Gobot to this 1.0 release milestone.

We couldn't have done this without you. Thank you.

Keep Up To Date

To keep up with the project, please follow us on Twitter at @gobotio, as our team and many contributors work together to make Gobot the best it can be.

Feb
17
2016

Gobot - This One Goes To 0.11

Forgive us, dear friends, that it has been a couple of months since our last update, but we wanted to release our newest version as part of the Golang 1.6 release party.

So, without further ado, say hello to version 0.11 of Gobot, our open source robotics and Internet of Things (IoT) framework written in the Go programming language.

Welcome, C.H.I.P.

Once of the most exciting parts of the new 0.11 release, is adding support for C.H.I.P the $9 computer. Yes, you read that correctly. Thanks to awesome contributor Hrishikesh Tapaswi, we now have support for one of the most exciting pieces of hardware we've seen for a while. Check it out in action:

The code is as you would expect, just classic Gobot:

package main

import (
        "time"

        "github.com/hybridgroup/gobot"
        "github.com/hybridgroup/gobot/platforms/i2c"
        "github.com/hybridgroup/gobot/platforms/chip"
)

func main() {
        gbot := gobot.NewGobot()

        board := chip.NewChipAdaptor("chip")
        screen := i2c.NewGroveLcdDriver(board, "screen")

        work := func() {
                screen.Write("hello")

                screen.SetRGB(255, 0, 0)

                gobot.After(5*time.Second, func() {
                        screen.Clear()
                        screen.Home()
                        screen.SetRGB(0, 255, 0)
                        // set a custom character in the first position
                        screen.SetCustomChar(0, i2c.CustomLCDChars["smiley"])
                        // add the custom character at the end of the string
                        screen.Write("goodbye\nhave a nice day " + string(byte(0)))
                        gobot.Every(500*time.Millisecond, func() {
                                screen.Scroll(false)
                        })
                })

                screen.Home()
                <-time.After(1 * time.Second)
                screen.SetRGB(0, 0, 255)
        }

        robot := gobot.NewRobot("screenBot",
                []gobot.Connection{board},
                []gobot.Device{screen},
                work,
        )

        gbot.AddRobot(robot)

        gbot.Start()
}

Imagine what kinds of new applications and devices you will be able to create using Gobot on C.H.I.P. Imagine, and now create them!

Changelog

You can find the changelog here, but if you want to see every detail, as always you can take a look at the compare view on GitHub.

  • Support for Golang 1.6
  • Determine I2C adaptor capabilities dynamically to avoid use of block I/O when unavailable
  • chip
    • Add support for GPIO & I2C interfaces on C.H.I.P. $9 computer
  • leap motion
    • Add support additional "hand" and "gesture" events
  • mqtt
    • Support latest update to Eclipse Paho MQTT client library
  • raspberry pi
    • Proper release of Pi Blaster for PWM pins
  • bebop
    • Prevent event race conditions on takeoff/landing
  • i2c
    • Support added for new i2c device:
      • MCP23017 Port Expander
    • Bugfixes:
      • Correct init and data parsing for MPU-6050
      • Correct handling of errors and buffering for Wiichuk
  • gort
    • Update bluetooth commands for more logical order
    • Update arduino to support many more board types
  • docs
    • Many corrections and updates for docs, primarily contributed by the awesome community.

Need To Report Issues?

When you find any issues with Gobot, please let us know by entering a GitHub issue and we'll take a look as soon as possible. We're also frequently around on IRC (#gobotio on freenode).

Keep Up To Date

To keep up with the project, please follow us on Twitter at @gobotio, as our team and many contributors work together to make Gobot the best it can be.

Oct
27
2015

Gobot 0.10 - Less Is More

We've just released the new 0.10 version of Gobot, our open source robotics and Internet of Things (IoT) framework written in the Go programming language. This new version incorporates many changes and community contributions to make Gobot much faster, leaner. And of course, add lots more hardware support.

We've got a list of the new changes below, but if you want to see the gory details, please check out the compare view on GitHub.

What Happened To The 0.9 Release?

There were so many important changes, especially ones worked on by the amazing participants at the "sold-out" Gophercon hardware hackday, that we decided to hold off on that version, and instead go right on to this new 0.10 release.

Changelog

  • Refactor core to cleanup robot initialization and shutdown
  • Remove unnecessary goroutines spawned by NewEvent
  • api
    • Update Robeaux to v0.5.0
  • bebop
    • Add support for the Parrot Bebop drone
  • keyboard
    • Add support for keyboard control
  • gpio
    • Support added for 10 new Grove GPIO devices:
      • Grove Touch Sensor
      • Grove Sound Sensor
      • Grove Button
      • Grove Buzzer
      • Grove Led
      • Grove Light Sensor
      • Grove Vibration Sensor
      • Grove Rotary
      • Grove Relay
      • Grove Temperature Sensor
  • i2c
    • Support added for 2 new Grove i2c devices:
      • Grove Accelerometer
      • Grove LCD with RGB backlit display
  • gort
    • Update bluetooth Linux support for BlueZ 5.x
    • Bugfixes
  • docs
    • Many useful fixes and updates for docs, mostly contributed by our wonderful community.

Contributors

So many people helped with this release, both formally via code or documentation contributions, as well as helpful feedback, comments, and hallway chats. Gobot could not be what it is without all of us in this community working together. We really appreciate it!

Issues

As always, if you find any issues with the new Gobot release, please let us know by entering a GitHub issue and we'll get back to you as soon as possible. We're also around on IRC (#gobotio on freenode) as much as we can be.

Keep Informed

To stay informed on our progress, please follow us on Twitter at @gobotio, as our team and contributors continue our work together.

Sep
14
2015

Gobot in Vice

Just recently, a wonderful interview was published in Vice with The Hybrid Group's Ringleader Ron Evans about the "Internet of Toys", open source, and how The Hybrid Group is bringing programming of the physical world to the masses. Read the full article titled "Opening Up the World of Robotics: 'The Internet Of Toys'" here.

Sep
01
2015

Gobot mentioned in SD Times

Gobot was mentioned in the recent interview with The Hybrid Group Ringleader Ron Evans in the venerable SD Times about the Internet of Things (IoT) and future implications of a connected world.

Evans describes his real-world experiences, open source IoT, security & privacy, and why he thinks the Intel Edison is so interesting. Read the full post titled "Internet of Things: Closing the gap between customers, business" here.

Apr
13
2015

Gobot featured in Wired

The Hybrid Group's own Ringleader Ron Evans got to speak with Wired about the Internet of Things (IoT) and open source robotics. The interview covers our robotics frameworks Cylon.js, Artoo, and Gobot, as well as what direction we see them moving towards in the future.

Evans also went into detail about his experiences working on Apple's program Hypercard, and how that open source mentality went on to influence The Hybrid Group's other projects such as KidsRuby later on. Read the full article titled "Internet of Anything: Simple Tools Make It Possible for Anyone to Hack Robots" here.

Dec
24
2014

Gobot 0.8 - The Happy Holiday Release

This release brings a number of very large and necessary changes to Gobot. Over time our interfaces have grown out of hand and are becoming unmanagable and largely unecessary. With the Gobot 0.8 release, we have completely changed the core interfaces as well as our gpio and i2c driver interfaces.

In addition to this, we are finally correctly passing errors throughout the system and have removed all panics! Altough this is very exciting, this also means that there are many breaking api changes, especially if you have written your own drivers and adaptors.

If you're not ready to update to the new interfaces or errors handling, then you're in luck! We create a tag with every new Gobot release, so rolling back to the previous release is as easy as:

$ go get -d -u github.com/hybridgroup/gobot/...
$ cd $GOPATH/src/github.com/hybridgroup/gobot
$ git checkout 0.7.1
$ go build -a github.com/hybridgroup/gobot

You really should update to the latest release however, it's much better!

Here's a overview of the changes, but if you want to see more check out the compare view on GitHub.

Changelog

This release includes a number of breaking api changes!

  • Refactor core, gpio, and i2c interfaces
  • Correctly pass errors throughout packages and remove all panics
  • Numerous bug fixes and performance improvement
  • api
    • Update robeaux to v0.3.0
  • firmata
    • Add optional io.ReadWriteCloser parameter to FirmataAdaptor
    • Fix thread exhaustion error
  • cli
    • generator
      • Update generator for new adaptor and driver interfaces
      • Add driver, adaptor and project generators
      • Add optional package name parameter

Contributors

A special thanks to everyone who made this release possible. You've been very nice!

Documentation

We are now generating our platforms pages directly from our README files for easier editing and collaboration, thanks zankavrogin! You can find the latest documentation on the docs page.

Issues

If you find any issues with Gobot, please let us know. We try to be on IRC (#gobotio on freenode) as much as possible, but if we're not around leave us a GitHub issue and we'll get back to you as soon as possible.

Stay In Touch

Please follow us on Twitter at @gobotio for the latest updates, as we continue to work on this amazing platform.

Nov
11
2014

Gobot 0.7 - The Big Release

We've been quietly (and not so quietly) working these last couple of months, and we've just released Gobot 0.7! This is a very big release, that adds a lot of new capabilities, adds a lot of test coverage, refactors code, and adds support for a whole bunch of new hardware platforms too.

Here's a overview of the changes, but if you want to see more check out the compare view on GitHub.

Changelog

  • Dramatically increased test coverage and documentation
  • api
    • Conform to the cppp.io spec
    • Add support for basic middleware
    • Add support for custom routes
    • Add SSE support
  • ardrone
    • Add optional parameter to specify the drones network address
  • core
    • Add Once Event function
    • Rename Expect to Assert and add Refute test helper function
  • i2c
    • Add support for MPL115A2
    • Add support for MPU6050
  • mavlink
    • Add support for common mavlink messages
  • mqtt
    • Add support for mqtt
  • raspi
    • Add support for the Raspberry Pi
  • sphero
    • Enable stop on sphero disconnect
    • Add Collision data struct
  • sysfs
    • Add generic linux filesystem gpio implementation

Contributors

A very special thanks to strongh, tangsoft, derailed, trevrosen, nathany, zmichaelh, and everyone else who made this release possible.

Documentation

We are now generating proper godoc docs from our code. In addition, we're constantly updating the Gobot docs site with additional info to keep them up-to-date. You can find the latest info on the docs page.

Issues

If you find any issues with Gobot, please let us know! We try to be on IRC (#gobotio on freenode) as much as possible, but if we're not around leave us a GitHub issue and we'll get back to you as soon as possible.

Stay In Touch

Please follow us on Twitter at @gobotio for the latest updates, as we continue to work on this amazing platform.

Sep
24
2014

Run Golang On The Intel Edison With Gobot

The Gobot team was in attendance at the recent Intel Developer Forum in San Francisco, and we were able to get one of the new Intel Edison single board computers. Our mission: get Golang running on the Edison, so we can use it with Gobot for robotics or connected devices.

The Edison is a very small System-on-Chip (SoC) single board Linux computer. Its dual-core Atom processor, 1GB of RAM, and built-in WiFi/Bluetooth LE all make it a very powerful machine in a very tiny package. The base Edison itself requires that at least one of the Edison's breakout boards, known as "blocks", be connected via the 70-pin Hirose connector. This is rather different from most other single-board computers. This extreme modularity is a very interesting design approach, and Sparkfun has an entire line of blocks that will be coming out in the coming weeks.

We had previously tried running Golang code on the Intel Galileo when we first got our Gen1 board a few months ago, but were unable to run anything compiled in Golang on it at all, due to the Galileo not supporting the MMX instruction set.

Once we got ahold of the Edison, we immediately retired to a corner of the conference, and set to work putting the new board through its paces. The results were successful! The Edison is able to run Go code.

Of course, for us running Golang was just the beginning. We wanted to use the Edison's many bult-in GPIO & i2c pins, so we can communicate with many devices.

So we rolled up our sleeves, and got to work. In many cases, we made good progress from reading the code helpfully provided by the Intel IoT team's MRAA library. In others, we were simply blazing a trail of code.

With that, we now present to you gobot-intel-iot, our support in Gobot for the Edison board's wonderful capabilities.

Here is a short video using Gobot to control the Edison's GPIO for reading analog input, and then using PWM output to turn on the LED:

Here is the code we used to run the above sample:

import (
  "fmt"

  "github.com/hybridgroup/gobot"
  "github.com/hybridgroup/gobot/platforms/gpio"
  "github.com/hybridgroup/gobot/platforms/intel-iot/edison"
)

func main() {
  gbot := gobot.NewGobot()

  edisonAdaptor := edison.NewEdisonAdaptor("edison")
  sensor := gpio.NewAnalogSensorDriver(edisonAdaptor, "sensor", "0")
  led := gpio.NewLedDriver(edisonAdaptor, "led", "3")

  work := func() {
    gobot.On(sensor.Event("data"), func(data interface{}) {
      brightness := uint8(
              gobot.ToScale(gobot.FromScale(float64(data.(int)), 0, 4096), 0, 255),
      )
      fmt.Println("sensor", data)
      fmt.Println("brightness", brightness)
      led.Brightness(brightness)
    })
  }

  robot := gobot.NewRobot("sensorBot",
    []gobot.Connection{edisonAdaptor},
    []gobot.Device{sensor, led},
    work,
  )

  gbot.AddRobot(robot)

  gbot.Start()
}

We also have implemented i2c support. In the following video, we are showing an Edison, running Gobot, reading analog input, and then communicating via i2c with a BlinkM.

Here is the code:

package main

import (
  "fmt"

  "github.com/hybridgroup/gobot"
  "github.com/hybridgroup/gobot/platforms/intel-iot/edison"
  "github.com/hybridgroup/gobot/platforms/gpio"
  "github.com/hybridgroup/gobot/platforms/i2c"
)

func main() {
  gbot := gobot.NewGobot()

  edisonAdaptor := edison.NewEdisonAdaptor("edison")
  blinkm := i2c.NewBlinkMDriver(edisonAdaptor, "blinkm")
  sensor := gpio.NewAnalogSensorDriver(edisonAdaptor, "sensor", "0")

  work := func() {
    gobot.On(sensor.Event("data"), func(data interface{}) {
      brightness := uint8(
        gobot.ToScale(gobot.FromScale(float64(data.(int)), 0, 4096), 0, 255),
      )
      fmt.Println("sensor", data)
      fmt.Println("brightness", brightness)
      blinkm.Rgb(0, brightness, 0)
    })
  }

  robot := gobot.NewRobot("sensorBot",
    []gobot.Connection{edisonAdaptor},
    []gobot.Device{blinkm, sensor},
    work,
  )

  gbot.AddRobot(robot)

  gbot.Start()
}

Here is how we got it "go"-ing, if you will. You must first configure your local Go environment for 386 linux cross compiling:

$ cd $GOROOT/src
$ GOOS=linux GOARCH=386 ./make.bash --no-clean

Then compile your Go program, like this:

$ GOARCH=386 GOOS=linux go build edison_blink.go

Then you can simply upload your program over the network from your host computer to the Edison

$ scp edison_blink root@192.168.1.xxx:/home/root/

and execute it on your Edison itself, by SSHing in, and running it

$ ./edison_blink

We are very excited about the possibilities of this new board from Intel, now that we can run Golang and Gobot on it!

Please follow us on Twitter at @gobotio to keep up to date on the latest news and information about Golang powered robotics using Gobot.

Aug
08
2014

Flying Iris At Distill 2014

Team Gobot was speaking at the Distill 2014 conference in San Francisco this week. Held at the Palace of Fine Arts, we were very lucky to fly a 3DRobotics Iris around using a pre-release of our new support of the Mavlink protocol for Unmanned Aerial Vehicles (UAVs).

During a group photo that took place the day after our talk about "The 10 Rules of RobotOps", we had a golden opportunity to fly around a little inside the facility, and captured some rather unique footage, as you can see above.

We will be releasing our code for the Golang MAVLINK generator, along with gobot-mavlink itself, very soon. Here is a little taste of what we can do:

package main

import (
  "fmt"
  "net/http"
  "strings"

  "github.com/hybridgroup/gobot"
  "github.com/hybridgroup/gobot/api"
  "github.com/hybridgroup/gobot/platforms/mavlink"
  common "github.com/hybridgroup/gobot/platforms/mavlink/common"
)

type telemetry struct {
  Status    string
  Roll      float32
  Yaw       float32
  Pitch     float32
  Latitude  float32
  Longitude float32
  Altitude  int32
  Heading   float32
}

func main() {
  if gobot.Version() != "0.7.dev" {
    panic("this requires the dev branch!")
  }

  summary := &telemetry{Status: "STANDBY"}
  gbot := gobot.NewGobot()

  a := api.NewAPI(gbot)

  a.Get("/mavlink/:a", func(res http.ResponseWriter, req *http.Request) {
    path := req.URL.Path
    t := strings.Split(path, "/")
    buf, err := Asset("assets/" + t[2])
    if err != nil {
      http.Error(res, err.Error(), http.StatusNotFound)
      return
    }
    t = strings.Split(path, ".")
    if t[len(t)-1] == "js" {
      res.Header().Set("Content-Type", "text/javascript; charset=utf-8")
    } else if t[len(t)-1] == "css" {
      res.Header().Set("Content-Type", "text/css; charset=utf-8")
    }
    res.Write(buf)
  })

  adaptor := mavlink.NewMavlinkAdaptor("iris", "/dev/ttyACM0")
  iris := mavlink.NewMavlinkDriver(adaptor, "iris")

  work := func() {

    iris.AddEvent("telemetry")

    gobot.Once(iris.Event("packet"), func(data interface{}) {
      fmt.Println(data)
      packet := data.(*common.MAVLinkPacket)

      dataStream := common.NewRequestDataStream(10,
        packet.SystemID,
        packet.ComponentID,
        0,
        1,
      )
      iris.SendPacket(common.CraftMAVLinkPacket(packet.SystemID,
        packet.ComponentID,
        dataStream,
      ))
    })

    gobot.On(iris.Event("message"), func(data interface{}) {

      fmt.Println("message: ", data.(common.MAVLinkMessage).Id())
      if data.(common.MAVLinkMessage).Id() == 0 {
        statusCodes := map[uint8]string{
          1: "BOOT",
          2: "CALIBRATING",
          3: "STANDBY",
          4: "ACTIVE",
          5: "CRITICAL",
          6: "EMERGENCY",
          7: "POWEROFF",
          8: "ENUM_END",
        }
        summary.Status = statusCodes[data.(*common.Heartbeat).SYSTEM_STATUS]
        if summary.Status != "" {
          gobot.Publish(iris.Event("telemetry"), summary)
        }
      }

      if data.(common.MAVLinkMessage).Id() == 30 {
        roll := data.(*common.Attitude).ROLL
        pitch := data.(*common.Attitude).PITCH
        yaw := data.(*common.Attitude).YAW

        if roll < 4 || roll > -4 {
          summary.Roll = (roll * 180 / 3.14)
        }
        if yaw < 4 || roll > -4 {
          summary.Yaw = (yaw * 180 / 3.14)
        }
        if pitch < 4 || roll > -4 {
          summary.Pitch = (pitch * 180 / 3.14)
        }
        gobot.Publish(iris.Event("telemetry"), summary)
      }

      if data.(common.MAVLinkMessage).Id() == 33 {
        summary.Latitude = float32(data.(*common.GlobalPositionInt).LAT) / 10000000.0
        summary.Longitude = float32(data.(*common.GlobalPositionInt).LON) / 10000000.0
        summary.Altitude = data.(*common.GlobalPositionInt).ALT
        summary.Heading = float32(data.(*common.GlobalPositionInt).HDG) / 100
        gobot.Publish(iris.Event("telemetry"), summary)
      }
    })
  }

  gbot.AddRobot(gobot.NewRobot("irisBot",
    []gobot.Connection{adaptor},
    []gobot.Device{iris},
    work,
  ))

  a.Start()
  gbot.Start()
}

Want to keep up to date on the latest news and information about Gobot? Please follow us on Twitter at @gobotio!

Jul
11
2014

Gobot 0.6 is out!

Here's a overview of the changes, but if you want to see more check out the compare view on GitHub.

Changelog

  • api
    • Robeaux support: Robeaux is now included with the api package thanks to go-bindata. For more information check out the README
  • core
    • Refactor Connection and Device:
      • Connections are now a collection of Adaptors
      • Devices are now a collection of Drivers
    • events:
      • Add Event(string) function instead of Events[string] for retrieving Driver event
      • Add AddEvent(string) function to register an event on a Driver
  • firmata
    • Fix slice bounds out of range error
  • sphero
    • Fix issue where the driver would not halt correctly on OSX

Contributors

A huge thanks to our contributors who made this release possible.

Documentation

We're constantly updating the Gobot docs to keep them up-to-date. You can find the latest info on the docs page.

Issues

If you find any issues with Gobot, please let us know! We try to be on IRC (#gobotio on freenode) as much as possible, but if we're not around leave us a GitHub issue and we'll get back to you as soon as possible.

Jun
18
2014

Gobot 0.5 is out!

We're happy to announce the release of Gobot 0.5! This release is the culmination of lessons learned at GopherCon and many weeks of hard work.

Here's a overview of the changes, but if you want to see more check out the compare view on GitHub.

Changelog

  • Idomatic clean up: All files and tests have been refactored and ran through golint

  • Removed reflections throughout packages: We used reflection in a few situations to retrieve elements from structs and execute functions. Those reflections have been removed in favor in better interface design

  • All officially supported platforms are now in ./platforms: Instead of each platform being in a seperate repo, they are all now included in the main Gobot repo.

  • API is now a new package ./api: The RESTful API is now in a seperate api package and must be explicitely imported for use in your Gobot program.

  • All platforms examples are in ./examples: All examples has now been moved into a shared examples folder.

  • Replaced martini with net/http: We no longer use Martini as our API server, and now use the standard net/http package with pat as our pattern muxer.

  • Replaced ginkgo/gomega with system testing package: We now use the system testing package for testing

  • Refactor gobot/robot/device commands: User defined API commands have been completely refactored and now have an easier definition. You may now attach a command to your robot like this

  • Added Event type: Added a new type for registering and responding to device events

  • Replaced Master type with Gobot type: The Master type is now known as Gobot

  • Every and After now accept time.Duration

  • Removed reflection helper methods: We had a few helper methods for retrieveing fields from structs and executing functions on structs. Those have been removed.

  • And many more small changes throughout the system

Contributors

A huge thanks to our contributors who made this release possible. And a special thanks to Matt Aimonettit and Jeremy Saenz!

Documentation

We're constantly updating the Gobot docs to keep them up-to-date. You can find the latest info on the docs page.

Issues

If you find any issues with Gobot, please let us know! We try to be on IRC (#gobotio on freenode) as much as possible, but if we're not around leave us a GitHub issue and we'll get back to you as soon as possible.

Apr
29
2014

Taking The Stage At GopherCon

We just left the amazing GopherCon in Denver, the first conference dedicated to the Go programming language. A remarkable array of speakers and attendees were present, including Rob Pike and many members of the Golang core team.

It was a great honor for Team Gobot to be invited to speak to such an illustrious crowd, and we worked hard to prepare some demos worthy of the event. When you do live coding of flying objects, there is of course, always some element of aerial risk. However, the talk went off without a hitch! We will post a link once the video is online.

One new demo we've added, is running Gobot on the ARDrone's own internal board in parallel to their firmware, while controlling it using a different Gobot running on a separate computer controlling the drone. How meta!

The next day was the open hack day, and we brought lots of Sphero robots to play with. It was especially fun and exciting to pair up with the master himself. When Rob Pike sat down to play, and to help us improve our code, we were giddy to say the least. Thanks, Rob!

Thank you to the conference organizers, staff, the other presenters, and especially the attendees for making it a great experience. We really enjoyed showing our robotics road show to so many of the best and brightest in the Golang community.

Please follow us on Twitter at @gobotio to keep up to date on the latest news and information, as the community continues to work together on Golang powered robotics using Gobot.

Apr
10
2014

National Robotics Week at Boston Golang

Continuing our robot road show in recognition of National Robotics Week, we brought Gobot (http://gobot.io) our Golang robotics framework, to Boston to speak to BostonGolang. Boston has a thriving technology community, and we were happy to present our work to one of the most quickly growing meetup groups focusing on the Go programming language.

Held at the Akamai offices in Cambridge, we had just introduced our new "10 Rules Of Robot Ops" site earlier in the day, so we used that as the theme for the talk. We had also just finished support for the Neurosky Mindwave Mobile EEG, and it was neat to incorporate Brain-Computer Interfaces (BCI). We also demoed our Golang powered version of Conway's Game of Life using Sphero robots.

Thanks to all of you who came out to see us, we had a great time sharing our latest work with Boston's Golang community of enthsuiasts!

Please follow us on Twitter at @gobotio for the latest news and information, as we continue to work on this exciting platform.

Oct
21
2013

Go, Gobot, Go! Golang Powered Robotics

We are very excited to introduce Gobot (http://gobot.io), a new and powerful open source robotics platform written using the Go programming language. Go has remarkable abilities when it comes to massive concurrency with only modest use of system resources. In addition, the expressive nature of the programming language makes it really nice code to work with.

Our team will post here with all our exciting developments, as well as anything else of interest to the robot community. We've got a lot of plans in store for all of you, our dear users, so please follow us on Twitter at @gobotio to follow our progress.