Blog

Articles tagged with “events”

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
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.

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!

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.