Code Monkey home page Code Monkey logo

gobot's Introduction

Gobot

GoDoc CircleCI Build status Appveyor Build status codecov Go Report Card License

Gobot (https://gobot.io/) is a framework using the Go programming language (https://golang.org/) for robotics, physical computing, and the Internet of Things.

It provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the same time.

Want to run Go directly on microcontrollers? Check out our sister project TinyGo (https://tinygo.org/)

Getting Started

Get in touch

Get the Gobot source code by running this commands:

git clone https://github.com/hybridgroup/gobot.git
git checkout release

Afterwards have a look at the examples directory. You need to find an example matching your platform for your first test (e.g. "raspi_blink.go"). Than build the binary (cross compile), transfer it to your target and run it.

env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink examples/raspi_blink.go

Building the code on your local machine with the example code above will create a binary for ARMv5. This is probably not what you need for your specific target platform. Please read also the platform specific documentation in the platform subfolders.

Create your first project

Create a new folder and a new Go module project.

mkdir ~/my_gobot_example
cd ~/my_gobot_example
go mod init my.gobot.example.com

Copy your example file besides the go.mod file, import the requirements and build.

cp /<path to gobot folder>/examples/raspi_blink.go ~/my_gobot_example/
go mod tidy
env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink raspi_blink.go

Now you are ready to modify the example and test your changes. Start by removing the build directives at the beginning of the file.

Examples

Gobot with Arduino

package main

import (
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/drivers/gpio"
  "gobot.io/x/gobot/v2/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()
}

Gobot with Sphero

package main

import (
  "fmt"
  "time"

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

func main() {
  adaptor := sphero.NewAdaptor("/dev/rfcomm0")
  driver := sphero.NewSpheroDriver(adaptor)

  work := func() {
    gobot.Every(3*time.Second, func() {
      driver.Roll(30, uint16(gobot.Rand(360)))
    })
  }

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

  robot.Start()
}

"Metal" Gobot

You can use the entire Gobot framework as shown in the examples above ("Classic" Gobot), or you can pick and choose from the various Gobot packages to control hardware with nothing but pure idiomatic Golang code ("Metal" Gobot). For example:

package main

import (
  "gobot.io/x/gobot/v2/drivers/gpio"
  "gobot.io/x/gobot/v2/platforms/intel-iot/edison"
  "time"
)

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

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

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

"Master" Gobot

You can also use the full capabilities of the framework aka "Master Gobot" to control swarms of robots or other features such as the built-in API server. For example:

package main

import (
  "fmt"
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/api"
  "gobot.io/x/gobot/v2/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()
}

Hardware Support

Gobot has a extensible system for connecting to hardware devices. The following robotics and physical computing platforms are currently supported:

Support for many devices that use General Purpose Input/Output (GPIO) have a shared set of drivers provided using the gobot/drivers/gpio package:

  • GPIO <=> Drivers
    • AIP1640 LED Dot Matrix/7 Segment Controller
    • Button
    • Buzzer
    • Direct Pin
    • EasyDriver
    • Grove Button (by using driver for Button)
    • Grove Buzzer (by using driver for Buzzer)
    • Grove LED (by using driver for LED)
    • Grove Magnetic Switch (by using driver for Button)
    • Grove Relay (by using driver for Relay)
    • Grove Touch Sensor (by using driver for Button)
    • HC-SR04 Ultrasonic Ranging Module
    • HD44780 LCD controller
    • LED
    • Makey Button (by using driver for Button)
    • MAX7219 LED Dot Matrix
    • Motor
    • Proximity Infra Red (PIR) Motion Sensor
    • Relay
    • RGB LED
    • Servo
    • Stepper Motor
    • TM1638 LED Controller

Support for many devices that use Analog Input/Output (AIO) have a shared set of drivers provided using the gobot/drivers/aio package:

  • AIO <=> Drivers
    • Analog Actuator
    • Analog Sensor
    • Grove Light Sensor
    • Grove Piezo Vibration Sensor
    • Grove Rotary Dial
    • Grove Sound Sensor
    • Grove Temperature Sensor
    • Temperature Sensor (supports linear and NTC thermistor in normal and inverse mode)
    • Thermal Zone Temperature Sensor

Support for devices that use Inter-Integrated Circuit (I2C) have a shared set of drivers provided using the gobot/drivers/i2c package:

  • I2C <=> Drivers
    • Adafruit 1109 2x16 RGB-LCD with 5 keys
    • Adafruit 2327 16-Channel PWM/Servo HAT Hat
    • Adafruit 2348 DC and Stepper Motor Hat
    • ADS1015 Analog to Digital Converter
    • ADS1115 Analog to Digital Converter
    • ADXL345 Digital Accelerometer
    • BH1750 Digital Luminosity/Lux/Light Sensor
    • BlinkM LED
    • BME280 Barometric Pressure/Temperature/Altitude/Humidity Sensor
    • BMP180 Barometric Pressure/Temperature/Altitude Sensor
    • BMP280 Barometric Pressure/Temperature/Altitude Sensor
    • BMP388 Barometric Pressure/Temperature/Altitude Sensor
    • DRV2605L Haptic Controller
    • Generic driver for read and write values to/from register address
    • Grove Digital Accelerometer
    • GrovePi Expansion Board
    • Grove RGB LCD
    • HMC6352 Compass
    • HMC5883L 3-Axis Digital Compass
    • INA3221 Voltage Monitor
    • JHD1313M1 LCD Display w/RGB Backlight
    • L3GD20H 3-Axis Gyroscope
    • LIDAR-Lite
    • MCP23017 Port Expander
    • MMA7660 3-Axis Accelerometer
    • MPL115A2 Barometric Pressure/Temperature
    • MPU6050 Accelerometer/Gyroscope
    • PCA9501 8-bit I/O port with interrupt, 2-kbit EEPROM
    • PCA953x LED Dimmer for PCA9530 (2-bit), PCA9533 (4-bit), PCA9531 (8-bit), PCA9532 (16-bit)
    • PCA9685 16-channel 12-bit PWM/Servo Driver
    • PCF8583 clock and calendar or event counter, 240 x 8-bit RAM
    • PCF8591 8-bit 4xA/D & 1xD/A converter
    • SHT2x Temperature/Humidity
    • SHT3x-D Temperature/Humidity
    • SSD1306 OLED Display Controller
    • TSL2561 Digital Luminosity/Lux/Light Sensor
    • Wii Nunchuck Controller
    • YL-40 Brightness/Temperature sensor, Potentiometer, analog input, analog output Driver

Support for devices that use Serial Peripheral Interface (SPI) have a shared set of drivers provided using the gobot/drivers/spi package:

  • SPI <=> Drivers
    • APA102 Programmable LEDs
    • MCP3002 Analog/Digital Converter
    • MCP3004 Analog/Digital Converter
    • MCP3008 Analog/Digital Converter
    • MCP3202 Analog/Digital Converter
    • MCP3204 Analog/Digital Converter
    • MCP3208 Analog/Digital Converter
    • MCP3304 Analog/Digital Converter
    • MFRC522 RFID Card Reader
    • SSD1306 OLED Display Controller

More platforms and drivers are coming soon...

API

Gobot includes a RESTful API to query the status of any robot running within a group, including the connection and device status, and execute device commands.

To activate the API, import the gobot.io/x/gobot/v2/api package and instantiate the API like this:

  master := gobot.NewMaster()
  api.NewAPI(master).Start()

You can also specify the api host and port, and turn on authentication:

  master := gobot.NewMaster()
  server := api.NewAPI(master)
  server.Port = "4000"
  server.AddHandler(api.BasicAuth("gort", "klatuu"))
  server.Start()

You may access the robeaux React.js interface with Gobot by navigating to http://localhost:3000/index.html.

CLI

Gobot uses the Gort http://gort.io Command Line Interface (CLI) so you can access important features right from the command line. We call it "RobotOps", aka "DevOps For Robotics". You can scan, connect, update device firmware, and more!

Documentation

We're always adding documentation to our web site at https://gobot.io/ please check there as we continue to work on Gobot

Thank you!

Need help?

Contributing

For our contribution guidelines, please go to https://github.com/hybridgroup/gobot/blob/master/CONTRIBUTING.md .

Gobot is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. You can read about it here.

License

Copyright (c) 2013-2020 The Hybrid Group. Licensed under the Apache 2.0 license.

The Contributor Covenant is released under the Creative Commons Attribution 4.0 International Public License, which requires that attribution be included.

gobot's People

Contributors

bezineb5 avatar caledhwa avatar cbwang2016 avatar codegangsta avatar come-maiz avatar conejoninja avatar danacr avatar deadprogram avatar dependabot[bot] avatar dgryski avatar dlstjq7685 avatar erkkah avatar gen2thomas avatar gmarik avatar hrishikesh195 avatar mattetti avatar npotts avatar nzmichaelh avatar oliverpool avatar pauleyj avatar rafmagana avatar sbinet avatar st-user avatar stewart avatar trevrosen avatar ulisesflynn avatar wfernandes avatar xixebombilla avatar zankavrogin avatar zankich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gobot's Issues

Docs clarification: what is the MCP?

I've had a look at the docs, and this project looks very useful -- but the demo examples don't discuss the high-level architecture very thoroughly.

There's mention of an MCP in a few places, but this isn't really covered in the docs. After a bit of digging and watching your videos and so on, I think I've got a grasp on these concepts -- but I think it would be useful to extend the docs to clearly cover a few of these points:

  • What is the MCP?
    • For a "Hello world" usecase, probably a laptop
    • For an IOT household sensor project, I suppose this could be a Raspberry Pi?
    • Any other use cases you have envisioned?
  • Can you load a program onto a microcontroller and then run it in standalone mode?
    • The docs seem to suggest that I need to keep my laptop (MCP?) connected all the time, rather than the Arduino way of compiling and loading a program onto the microcontroller. This is a big difference which isn't explicitly called out, and I think should be clarified.
    • I think a corrolary of this is that if I want to use an Arduino with GoBot, it must be connected to another device at all times.
    • What about ARM microcontrollers (such as the Teensy) which can run Go code natively? It looks like GoBot doesn't currently support running these guys in standalone mode.

If any of these points are wrong/incomplete please correct me, this is just what I've gleaned from a bunch of digging on your site.

Fail to run example with Sphero

I connected to sphero ok but got exception:

Initializing connections...
Initializing connection Sphero...
Initializing devices...
Initializing device Sphero...
Starting connections...
Starting connection Sphero...
Connecting to Sphero on port /dev/tty.Sphero-WBO-AMP-SPP...
Starting devices...
Starting device Sphero...
Device Sphero started
panic: time: invalid duration

goroutine 1 [running]:
runtime.panic(0x4224fc0, 0xc21000a7d0)
        /opt/boxen/homebrew/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:266 +0xb6
github.com/hybridgroup/gobot.parseDuration(0x0, 0x0, 0x10)
        /Users/owen_ou/gocode/src/github.com/hybridgroup/gobot/utils.go:37 +0x71
github.com/hybridgroup/gobot.Every(0x0, 0x0, 0xc21000a7c0)
        /Users/owen_ou/gocode/src/github.com/hybridgroup/gobot/utils.go:17 +0x67
github.com/hybridgroup/gobot-sphero.(*SpheroDriver).StartDriver(0xc210057280)
        /Users/owen_ou/gocode/src/github.com/hybridgroup/gobot-sphero/sphero_driver.go:38 +0x88
reflect.Value.call(0x426c000, 0xc210057280, 0xd38, 0x427f740, 0x4, ...)
        /opt/boxen/homebrew/Cellar/go/1.2/libexec/src/pkg/reflect/value.go:474 +0xe0b
reflect.Value.Call(0x426c000, 0xc210057280, 0xd38, 0x4751d00, 0x0, ...)
        /opt/boxen/homebrew/Cellar/go/1.2/libexec/src/pkg/reflect/value.go:345 +0x9d
github.com/hybridgroup/gobot.(*Device).Start(0xc2100442c0)
        /Users/owen_ou/gocode/src/github.com/hybridgroup/gobot/device.go:28 +0x1de
github.com/hybridgroup/gobot.(*Robot).startDevices(0xc21000f500)
        /Users/owen_ou/gocode/src/github.com/hybridgroup/gobot/robot.go:78 +0x265
github.com/hybridgroup/gobot.(*Robot).Start(0xc21000f500)
        /Users/owen_ou/gocode/src/github.com/hybridgroup/gobot/robot.go:27 +0x6d
main.main()
        /Users/owen_ou/gocode/src/acl-services/aclsphero/main.go:36 +0x302

goroutine 3 [syscall]:
runtime.goexit()
        /opt/boxen/homebrew/Cellar/go/1.2/libexec/src/pkg/runtime/proc.c:1394

Leaking goroutines, crash after 10K thread limit reached

Hi,

I was experimenting with an overly simplistic program talking to an arduino board via the firmata protocol and read the input from an IR sensor.

package main

import (
    "fmt"

    "github.com/hybridgroup/gobot"
    "github.com/hybridgroup/gobot/platforms/firmata"
    "github.com/hybridgroup/gobot/platforms/gpio"
)

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

    firmataAdaptor := firmata.NewFirmataAdaptor("firmata", "/dev/ttyACM0")
    sensor := gpio.NewAnalogSensorDriver(firmataAdaptor, "sensor", "0")

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

    robot := gobot.NewRobot("motorBot",
        []gobot.Connection{firmataAdaptor},
        []gobot.Device{sensor},
        work,
    )
    gbot.AddRobot(robot)
    gbot.Start()
}

However, after running for a couple of minutes, the program crashed due to hitting a thread limit:

runtime: program exceeds 10000-thread limit
fatal error: thread exhaustion

with thousands of goroutines having this crash dump:

goroutine 46469 [syscall]:
syscall.Syscall(0x0, 0x3, 0xc2136e6800, 0x400, 0x10, 0x400, 0x1)
        /opt/google/go/src/syscall/asm_linux_amd64.s:21 +0x5
syscall.read(0x3, 0xc2136e6800, 0x400, 0x400, 0x8, 0x0, 0x0)
        /opt/google/go/src/syscall/zsyscall_linux_amd64.go:867 +0x6e
syscall.Read(0x3, 0xc2136e6800, 0x400, 0x400, 0x4f1ce0, 0x0, 0x0)
        /opt/google/go/src/syscall/syscall_unix.go:136 +0x58
os.(*File).read(0xc20802e040, 0xc2136e6800, 0x400, 0x400, 0xc2136e6800, 0x0, 0x0)
        /opt/google/go/src/os/file_unix.go:191 +0x5e
os.(*File).Read(0xc20802e040, 0xc2136e6800, 0x400, 0x400, 0x400, 0x0, 0x0)
        /opt/google/go/src/os/file.go:95 +0x91
github.com/hybridgroup/gobot/platforms/firmata.(*board).read(0xc208012070, 0x0, 0x0, 0x0)
        /work/src/github.com/hybridgroup/gobot/platforms/firmata/firmata.go:248 +0xad
github.com/hybridgroup/gobot/platforms/firmata.(*board).readAndProcess(0xc208012070)
        /work/src/github.com/hybridgroup/gobot/platforms/firmata/firmata.go:142 +0x28
github.com/hybridgroup/gobot/platforms/firmata.(*FirmataAdaptor).AnalogRead(0xc2080300f0, 0x54ad50, 0x1, 0x462089)
        /work/src/github.com/hybridgroup/gobot/platforms/firmata/firmata_adaptor.go:117 +0xf7
github.com/hybridgroup/gobot/platforms/gpio.(*AnalogSensorDriver).Read(0xc2080320c0, 0x138)
        /work/src/github.com/hybridgroup/gobot/platforms/gpio/analog_sensor_driver.go:59 +0x6d
github.com/hybridgroup/gobot/platforms/gpio.func·002()
        /work/src/github.com/hybridgroup/gobot/platforms/gpio/analog_sensor_driver.go:45 +0x38
created by github.com/hybridgroup/gobot.func·011
        /work/src/github.com/hybridgroup/gobot/utils.go:18 +0x62

I am not familiar with the internals of gobot, but it would seem to be that the event callback goroutines block somewhere and are never released. Any ideas?

PS: My setup is an arduino uno with a QTR-1A reflectance sensor connected to 5V, GND and A0 pins.

More Precise Definitions of Driver and Adaptor Interfaces

As I said earlier, I am implementing a DMX USB Pro platform. I am using the github.com/hybridgroup/gobot/platforms/sphero package as an example, but went back to the defenitions of Driver and and the Adaptor interfaces to see exactly what methods need to be defined.

I had a couple of questions about how the methods should be implemented for each.

  1. What should the behavior of Adaptor.Connect() be if it is called a second time, after it has already connected?
  2. Should an adapter be able to be re-connected to after Adaptor.Finalize() has been called?
  3. Should Adaptor.Finalize() return an error if it wasn't connected to before?
  4. Same questions, but for the Driver.Start() and the Driver.Halt() methods.

OpenCV with Gobot example doesn't work

From this page: http://gobot.io/documentation/platforms/opencv/
I couldn't get the example to work, on Linux or on Mac OS X.
Continuous builds using Travis CI might really help to keep all builds green: https://travis-ci.org/

$ go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/opencv
hybridgroup/gobot/platforms/opencv/camera_driver.go:4:2: cannot find package "github.com/hybridgroup/go-opencv/opencv" in any of:
    /usr/local/go/src/pkg/github.com/hybridgroup/go-opencv/opencv (from $GOROOT)
    /Users/gmlewis/go/src/github.com/hybridgroup/go-opencv/opencv (from $GOPATH)

Gobot API not working

When running example:

gobot run examples/hello_api.go

I get this on http://localhost:4000 in browser

404 page not found

and this in console:

2014/04/25 13:59:04 Initializing API on :4000...
2014/04/25 13:59:04 WARNING: API using insecure connection. We recommend using an SSL certificate with Gobot.
2014/04/25 13:59:04 Initializing connections...
2014/04/25 13:59:04 Starting connections...
2014/04/25 13:59:04 Initializing devices...
2014/04/25 13:59:04 Starting devices...
[martini] Started GET / for [::1]:57877
[martini] Completed 404 Not Found in 99.188us

CLI generates wrong template.

I executed follow command.

gobot generate hoge

I use "hoge" module. But I have follow error.

# github.com/yuhki50/hoge
/Users/yuhki50/.golang/src/github.com/yuhki50/hoge/hoge_adaptor.go:14: unknown gobot.Adaptor field 'Name' in struct literal
/Users/yuhki50/.golang/src/github.com/yuhki50/hoge/hoge_driver.go:17: unknown gobot.Driver field 'Name' in struct literal
/Users/yuhki50/.golang/src/github.com/yuhki50/hoge/hoge_driver.go:18: unknown gobot.Driver field 'Events' in struct literal
/Users/yuhki50/.golang/src/github.com/yuhki50/hoge/hoge_driver.go:19: unknown gobot.Driver field 'Commands' in struct literal
/Users/yuhki50/.golang/src/github.com/yuhki50/hoge/hoge_driver.go:20: unknown gobot.Driver field 'Adaptor' in struct literal
/Users/yuhki50/.golang/src/github.com/yuhki50/hoge/hoge_driver.go:26: invalid type assertion: h.Driver.Adaptor.(*hogeAdaptor) (non-interface type func() gobot.AdaptorInterface on left)

Unable to start on Arduino

Hi, trying to get started and getting error when trying to upload firmware:

stk500_getsync() not in sync: resp=0x00

There are two mini-usb inputs I have tried on both.

When running the example app it hangs on connecting to the device

Time synchronization for multi-Sphero collision detection

In order for the timestamp values in #93 to be useful, there are two Core APIs that need to be implemented:

Assign Time Value – 50h
Poll Packet Times – 51h

http://orbotixinc.github.io/Sphero-Docs/docs/sphero-api/the-core.html

If possible, I'd like this to be completely internal to the SpheroDriver, but an exported API may be helpful when communicating Sphero timestamps to a network server. Still need to look into it more.

A bit more on detecting multi-Sphero collisions:
http://stackoverflow.com/questions/15234516/is-there-a-more-accurate-way-to-detect-ball-to-ball-collisions-with-sphero-api

leap: R, S, T unclear

I started playing around with the leap motion API. It took me a long time to find what R, S, and T mean. They aren't described in the leap motion "Hands" API, only in the API overview. I think at least a comment saying "Rotation", "Scale" and "Translation" is in order. Better yet would be to rename, though I understand if you want to match the json.

wrong package name for sphero

$ go build
found packages doc.go (sphero) and sphero_adaptor.go (main) in /Users/ericwq/dev/go_works/src/github.com/hybridgroup/gobot/platforms/sphero

$ grep package *.go
doc.go: package main //under comment, so ignore it.
doc.go:package sphero
sphero_adaptor.go:package main
sphero_adaptor_test.go:package sphero
sphero_driver.go:package sphero
sphero_driver_test.go:package sphero
sphero_packets.go:package sphero

Pi

Is it possible to use this with Raspberry Pi?

Stack trace when ctrl+c this program

This program stack traces when you ctrl+c it

package main                                                                                         

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()                                                                           

  board := edison.NewEdisonAdaptor("board")                                                          
  sensor := gpio.NewAnalogSensorDriver(board, "sensor", "0")                                         

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

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

  gbot.AddRobot(robot)                                                                               

  gbot.Start()                                                                                       
}
^C2015/07/09 17:21:26 Stopping Robot sensorBot ...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x1 pc=0x8098519]

goroutine 1 [running]:
github.com/hybridgroup/gobot/platforms/intel-iot/edison.(*EdisonAdaptor).Finalize(0x1843a060, 0x0, 0x0, 0x0)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/platforms/intel-iot/edison/edison_adaptor.go:298 +0x4e9
github.com/hybridgroup/gobot.(*Connections).Finalize(0x18438130, 0x0, 0x0, 0x0)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/connection.go:66 +0xb3
github.com/hybridgroup/gobot.func·006(0x1843a090)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/gobot.go:82 +0x3db
github.com/hybridgroup/gobot.(*Robots).Each(0x184380e0, 0x18478ea8)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/robot.go:73 +0x5e
github.com/hybridgroup/gobot.(*Gobot).Start(0x18436480, 0x0, 0x0, 0x0)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/gobot.go:88 +0x341
main.main()
        /home/adrian/code/hybridgroup/gobot/examples/edison_grove_rotary_sensor.go:31 +0x409

goroutine 5 [syscall]:
os/signal.loop()
        /home/adrian/code/go/go1.4.2/src/os/signal/signal_unix.go:21 +0x21
created by os/signal.init·1
        /home/adrian/code/go/go1.4.2/src/os/signal/signal_unix.go:27 +0x34

goroutine 6 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0x184380f0)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/event.go:39 +0x52
github.com/hybridgroup/gobot.func·003()
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/event.go:22 +0x31
created by github.com/hybridgroup/gobot.NewEvent
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/event.go:24 +0x125

goroutine 7 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0x18438100)
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/event.go:39 +0x52
github.com/hybridgroup/gobot.func·003()
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/event.go:22 +0x31
created by github.com/hybridgroup/gobot.NewEvent
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/event.go:24 +0x125

goroutine 8 [runnable]:
github.com/hybridgroup/gobot/platforms/gpio.func·002()
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/platforms/gpio/analog_sensor_driver.go:71 +0x186
created by github.com/hybridgroup/gobot/platforms/gpio.(*AnalogSensorDriver).Start
        /home/adrian/code/go/gopath/src/github.com/hybridgroup/gobot/platforms/gpio/analog_sensor_driver.go:77 +0xc6

Benchmark

Hi, where can i find the GoBot benchmark? GoBot vs JS for example. Thanks!

readme seems wrong

gobot:$ go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/platforms/gobot/beaglebone
can't load package: package github.com/hybridgroup/platforms/gobot/beaglebone: cannot find package "github.com/hybridgroup/platforms/gobot/beaglebone" in any of:

BeagleBone adaptor panics when trying to use direct pin

Hi there,
I am getting an index out of range panic when trying to use a direct pin driver with a BeagleBone adaptor. Below is a minimal repro case as well as some system information. It should be noted that the repro case here is very similar to the provided BB direct pin example at https://github.com/hybridgroup/gobot/blob/master/examples/beaglebone_direct_pin.go

Repro script

package main
import(
        _"github.com/hybridgroup/gobot"
        "github.com/hybridgroup/gobot/platforms/beaglebone"
        "github.com/hybridgroup/gobot/platforms/gpio"
)

func main() {
        beagleboneAdaptor := beaglebone.NewBeagleboneAdaptor("testbox")
        gpioPin           := gpio.NewDirectPinDriver(beagleboneAdaptor, "mahDevice", "P9_12")
        gpioPin.DigitalWrite(1)
}

Stack trace:

root@beaglebone:~/go/src/bbb_test# ./bbb_test
panic: runtime error: index out of range

goroutine 16 [running]:
runtime.panic(0x103658, 0x1a3264)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0x1a0
github.com/hybridgroup/gobot/platforms/beaglebone.(*BeagleboneAdaptor).digitalPin(0x1032e080, 0x110fb8, 0x5, 0x10fde8, 0x1, 0xb6fc8370)
    /root/go/src/github.com/hybridgroup/gobot/platforms/beaglebone/beaglebone_adaptor.go:237 +0x68
github.com/hybridgroup/gobot/platforms/beaglebone.(*BeagleboneAdaptor).DigitalWrite(0x1032e080, 0x110fb8, 0x5, 0x1)
    /root/go/src/github.com/hybridgroup/gobot/platforms/beaglebone/beaglebone_adaptor.go:174 +0x54
github.com/hybridgroup/gobot/platforms/gpio.(*DirectPinDriver).DigitalWrite(0x10318150, 0x1032e001)
    /root/go/src/github.com/hybridgroup/gobot/platforms/gpio/direct_pin_driver.go:65 +0x88
main.main()
    /root/go/src/bbb_test/main.go:12 +0xd0

System information

root@beaglebone:~/go/src/bbb_test# cat /etc/issue
Debian GNU/Linux 7 \n \l
root@beaglebone:~/go/src/bbb_test# go version
go version go1.3 linux/arm

OpenCV examples crash

When I try to build either of the /examples for Open CV, I get the following warnings:

../../go-opencv/opencv/opencv.c:26:21: warning: passing 'schar *' (aka 'signed char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
../../go-opencv/opencv/highgui.go:37:38: note: passing argument to parameter 'p0' here
../../go-opencv/opencv/opencv.c:26:36: warning: passing 'schar *' (aka 'signed char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
../../go-opencv/opencv/highgui.go:37:48: note: passing argument to parameter 'p1' here
../../go-opencv/opencv/opencv.c:62:18: warning: passing 'schar *' (aka 'signed char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
../../go-opencv/opencv/highgui.go:39:35: note: passing argument to parameter 'p0' here

Then when I run them they open the window and then will crash within a minute.

I get the following:

runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort

(and a dump of a bunch of goroutine traces)

Any idea what's going on?
Running on Mac OSX 10.10

Running firmata_blink on Arduino fails on second attempt.

If I control C out of a running process and retry then the new process hangs unless I unplug and replug the USB port from the Arduino device.


(examples)(master)$./firmata_blink 
2015/02/04 09:51:06 Initializing Robot bot ...
2015/02/04 09:51:06 Initializing connections...
2015/02/04 09:51:06 Initializing connection arduino ...
2015/02/04 09:51:06 Initializing devices...
2015/02/04 09:51:06 Initializing device led ...
2015/02/04 09:51:06 Starting Robot bot ...
2015/02/04 09:51:06 Starting connections...
2015/02/04 09:51:06 Starting connection arduino on port /dev/ttyACM0...
2015/02/04 09:51:12 Starting devices...
2015/02/04 09:51:12 Starting device led on pin 13...
2015/02/04 09:51:12 Starting work...
^C2015/02/04 09:51:35 Stopping Robot bot ...
dkinzer09:51[~/go/src/github.com/hybridgroup/gobot/examples]
(examples)(master)$./firmata_blink 
2015/02/04 09:51:47 Initializing Robot bot ...
2015/02/04 09:51:47 Initializing connections...
2015/02/04 09:51:47 Initializing connection arduino ...
2015/02/04 09:51:47 Initializing devices...
2015/02/04 09:51:47 Initializing device led ...
2015/02/04 09:51:47 Starting Robot bot ...
2015/02/04 09:51:47 Starting connections...
2015/02/04 09:51:47 Starting connection arduino on port /dev/ttyACM0...

Suppor for Teensy boards?

Currently there's no support listed for the ARM Cortex-M4 based Teensy 3.1 board. Do you have plans to add support for this board?

It's appealing since it has an interrupt-driven USB stack, so it can support high bandwidth applications.

Cant start gobot with raspberry pi adapter and servo driver

here is my code:

package main

import (
        "github.com/hybridgroup/gobot"
        "github.com/hybridgroup/gobot/platforms/gpio"
        "github.com/hybridgroup/gobot/platforms/raspi"
        "log"
        "time"
)

func main() {
        gbot := gobot.NewGobot()
        r := raspi.NewRaspiAdaptor("raspi")
        servo := gpio.NewServoDriver(r, "servo", "23")
        work := func() {
                gobot.Every(10*time.Second, func() {
                        i := uint8(gobot.Rand(180))
                        log.Printf("Moving servo to %d", i)
                        servo.Move(i)
                })
        }
        robot := gobot.NewRobot(
                "servoBot",
                []gobot.Connection{r},
                []gobot.Device{servo},
                work,
        )

        gbot.AddRobot(robot)
        gbot.Start()
}

and this is the error is get

./main.go:14: cannot use r (type *raspi.RaspiAdaptor) as type gpio.Servo in argument to gpio.NewServoDriver:                                                                                                        │
        *raspi.RaspiAdaptor does not implement gpio.Servo (missing InitServo method)

any suggestions?

Failing to get any analog input on Arduino Due

I have been trying your Firmata example with no success so far...

I have made a map of drivers, one for each input pin... I am trying to trigger an event by getting the value of the input to rise above -1.

I have tried all possible combinations of wiring for a test with a photo cell and pressure pad and nothing works.

I have tried .Read() on the driver and its always at -1 for all pins.

Is there a simple diagnostic test I could do to debug like piping my test LED output straight into the analog input or something to rule out my wiring config?

What is the correct pin number to use is it 0, or A0? There is no panic on arbitrary input for the pin value.

Thanks for any help you could give.

Blinking led doesn't

Followed example code at http://gobot.io/documentation/platforms/beaglebone/.

LED does not blink? I tried P9_12 and P9_14 (from the second led example).

Is there any documentation that describes how P9_12 and P9_14 etc. are mapped to the user LED on the BBB as the BBB manual describes the LED pins as:

USR0 GPIO1_21 V15
USR1 GPIO1_22 U15
USR2 GPIO1_23 T15
USR3 GPIO1_24 V16

Which means P9_12 is not intuitively the USER LED outputs.

I note that the user leds continue to reflect the Ethernet activity so it appears the Gobot code does not take command of LED.

Cheers,
B

problem in blink led gobot

hi
my platform is arduino - os : win7
my code :
package main

import (
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/gpio"
)

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

firmataAdaptor := firmata.NewFirmataAdaptor("arduino", "COM15")
led := gpio.NewLedDriver(firmataAdaptor, "led", "13")

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

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

gbot.AddRobot(robot)

gbot.Start()

}

all things is ok
i type go run blink.go
it return :
2015/02/21 00:07:40 Initializing Robot bot3 ...
2015/02/21 00:07:40 Initializing connections...
2015/02/21 00:07:40 Initializing connection arduino ...
2015/02/21 00:07:40 Initializing devices...
2015/02/21 00:07:40 Initializing device led ...
2015/02/21 00:07:40 Starting Robot bot3 ...
2015/02/21 00:07:40 Starting connections...
2015/02/21 00:07:40 Starting connection arduino on port COM15...

program start successful but led do not Toggle every 1 second
how do i do?

Neurosky runtime error

When I run neurosky.go I get the following output. I've double checked that the device port is correct. Am I doing something wrong?

go run neurosky.go 
2014/07/13 18:07:29 Initializing Robot brainBot ...
2014/07/13 18:07:29 Initializing connections...
2014/07/13 18:07:29 Initializing connection neurosky ...
2014/07/13 18:07:29 Initializing devices...
2014/07/13 18:07:29 Initializing device neuro ...
2014/07/13 18:07:29 Starting Robot brainBot ...
2014/07/13 18:07:29 Starting connections...
2014/07/13 18:07:29 Starting connection neurosky on port /dev/tty.MindWaveMobile-DevA...
2014/07/13 18:07:33 Starting devices...
2014/07/13 18:07:33 Starting device neuro...
2014/07/13 18:07:33 Starting work...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x403a94e]

goroutine 12 [running]:
runtime.panic(0x40d3c20, 0x4202eb9)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/hybridgroup/gobot.(*Event).Write(0x0, 0x40a6440, 0xc21004a400)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:23 +0x1e
github.com/hybridgroup/gobot.Publish(0x0, 0x40a6440, 0xc21004a400)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/utils.go:30 +0x3b
github.com/hybridgroup/gobot/platforms/neurosky.(*NeuroskyDriver).parsePacket(0xc210037120, 0xc210000160, 0x4, 0x4)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/platforms/neurosky/neurosky_driver.go:110 +0x584
github.com/hybridgroup/gobot/platforms/neurosky.(*NeuroskyDriver).parse(0xc210037120, 0xc21004b3f0)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/platforms/neurosky/neurosky_driver.go:82 +0x115
github.com/hybridgroup/gobot/platforms/neurosky.func·002()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/platforms/neurosky/neurosky_driver.go:64 +0x153
created by github.com/hybridgroup/gobot/platforms/neurosky.(*NeuroskyDriver).Start
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/platforms/neurosky/neurosky_driver.go:67 +0x63

goroutine 1 [chan receive]:
github.com/hybridgroup/gobot.(*Gobot).Start(0xc21004a020)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/gobot.go:49 +0x73
main.main()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/r1cky1337/go-neurosky/neurosky.go:56 +0x3f5

goroutine 3 [syscall]:
os/signal.loop()
    /usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
    /usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x31

goroutine 4 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a060)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 5 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a080)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 6 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a0a0)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 7 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a0c0)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 8 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a0e0)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 9 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a100)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 10 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc21004a120)
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:29 +0x3d
github.com/hybridgroup/gobot.func·001()
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:15 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/rickykirkendall/Documents/Code/Go/src/github.com/hybridgroup/gobot/event.go:17 +0xe3

goroutine 11 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1394
exit status 2

Thanks!

Sphero Bluetooth Busy Resource (Mac)

If I Ctrl-C the sample program and then go run it again, it would regularly panic on startup with an error that the resource is busy. Running it a second time would usually work fine.

I never experienced this problem on Windows.

Is there some sort of cleanup that isn't happening properly?

Unfortunately I don't own a Sphero (1.0) yet, so if you need more information, it may take me a little while to get. Mac OS X 10.9.3, both dev/master branches tested.

sphero func GetRGB not work as expected

Hi, I tried the GetRGB function, but can not get regular response output.
fmt.Println("GetRGB is", driver.GetRGB())

sometimes, the output of GetRGB is empty, like this:
2014/07/25 16:30:33 Sphero Changing Direction 273
GetRGB is []
SetRGB is 226 248 202

Usually, after some loops running, it can return part of or all the reponse packets:
2014/07/25 15:53:36 Sphero Changing Direction 109
GetRGB is [255 255 0 169 4 4 229 215 146]
SetRGB is 63 137 234
PowerState is [255 255 0 176 9 1 2 3 6 0 42 10 47 215]
2014/07/25 15:53:46 Sphero Changing Direction 28
GetRGB is [255 255 0 172 1 82]
SetRGB is 75 63 25
PowerState is [255 255 0 177 1 77]
2014/07/25 15:53:56 Sphero Changing Direction 29
GetRGB is [255 255 0 177 4 63 137 234 152]
SetRGB is 11 224 1
PowerState is [255 255 0 184 9 1 2 3 5 0 42 10 67 188]
2014/07/25 15:54:06 Sphero Changing Direction 81
GetRGB is [255 255 0 180 1 74]
SetRGB is 197 186 184

Gobot not working on Arduino Duemilanove

I have an Arduino Duemilanove. It works fine and i am able to use it from Processing code in Arduino IDE v1.6.3 on my OSX machine.
I installed gobot,but the arduino example given on gobot.io does not work on it. The LED on pin 13 does not blink every 1 second. I see the list of supported hardware is Arduino uno R3 and Teensy, as given on http://gobot.io/documentation/platforms/arduino/.
Any way i can make gobot work with Arduino Duemilanove ?

Thanks

Arduino Uno cannot be connected

I'm running the example code for Arduino. I get the following the logs on stdout, without any activity -

➜  scripts  go run arduino.go
2014/04/26 02:19:02 Initializing connections...
2014/04/26 02:19:02 Initializing connection  firmata ...
2014/04/26 02:19:02 Starting connections...
2014/04/26 02:19:02 Starting connection firmata...
2014/04/26 02:19:02 Connecting to firmata on port /dev/tty.usbmodem1411...

Am I missing something?

Failed to install ARDrone library

Hi

I've successfully installed and tested the intel-iot library and wanted to exercise my luck with ARDrone library but I'm getting an error which seems to be caused by some missing reference:

# go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/ardrone
/Users/username/Documents/dev/go/src/github.com/hybridgroup/gobot/platforms/ardrone/ardrone_adaptor.go:4:2: cannot find package "github.com/hybridgroup/go-ardrone/client" in any of:
    /usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/hybridgroup/go-ardrone/client (from $GOROOT)
    /Users/username/Documents/dev/go/src/github.com/hybridgroup/go-ardrone/client (from $GOPATH)

Is there something I'm doing wrong or maybe my setup is messed up?

beaglebone usr led path incorrect

Trying out gobot with a white Beaglebone running Debian. The path to the usr leds on my device is /sys/devices/ocp.3/gpio-leds.7/leds/beaglebone:green:, but the Beaglebone adaptor is hard-coded to /sys/devices/ocp.3/gpio-leds.8/leds/beaglebone:green:. So the blinking doesn't happen (and worse, there's no error).

I haven't found a canonical source for this info, but from this it appears (and I've verified) that there are symlinks in /sys/class/leds that point to the appropriate gpio-leds.X location. Also referenced here.

If there's not already a fix in the works (haven't seen any other issues filed for this), I'll whip up a PR.

Gobot & Tinker - Function not found

If one tries to program a Spark using the Gobot lib, you must have the default Tinker firmware installed otherwise we get a 'Function not found error'.

➜ go run gobot.go
2014/05/02 13:49:55 Initializing API on :3000...
2014/05/02 13:49:55 WARNING: API using insecure connection. We recommend using an SSL certificate with Gobot.
2014/05/02 13:49:55 Initializing connections...
2014/05/02 13:49:55 Initializing connection RBIN ...
2014/05/02 13:49:55 Starting connections...
2014/05/02 13:49:55 Starting connection RBIN...
2014/05/02 13:49:55 Connecting to RBIN on port ...
2014/05/02 13:49:55 Initializing devices...
2014/05/02 13:49:55 Initializing device Red...
2014/05/02 13:49:55 Device Red initialized
2014/05/02 13:49:55 Starting devices...
2014/05/02 13:49:55 Starting device Red...
2014/05/02 13:49:55 Device Red started
RBIN Error: Function not found
RBIN Error: Function not found
RBIN Error: Function not found
RBIN Error: Function not found

After reflashing the spark through the Tinker default hardware, the Go code works fine.

Having trouble with blink example

I've edited the blink example to reflect the only /dev/tty.usbmodem* is see on my Macbook Pro, but my Arduino Uno R3 isn't successful in uploading the program. The Arduino IDE's blink program works without an issue (and it's configured under Tools/Serial to use this same /dev/tty.usbmodemfa131 port).

go run ~/.gocode/src/github.com/hybridgroup/gobot/examples/firmata_blink.go
2014/10/30 20:25:21 Initializing Robot bot ...
2014/10/30 20:25:21 Initializing connections...
2014/10/30 20:25:21 Initializing connection arduino ...
2014/10/30 20:25:21 Initializing devices...
2014/10/30 20:25:21 Initializing device led ...
2014/10/30 20:25:21 Starting Robot bot ...
2014/10/30 20:25:21 Starting connections...
2014/10/30 20:25:21 Starting connection arduino on port /dev/tty.usbmodemfa131...
(at this point, it hangs and the blink rate of the Uno doesn't change)

I do see the RX light blink once when Starting connection arduino on port /dev/tty.usbmodemfa131, but it's nothing like the series of blinks I see when the Arduino IDE uploads a binary.

Thoughts on troubleshooting steps I can take?

Thanks!
Boone

Sphero Collision Detection Sensitivity

Collision events didn't trigger consistently from a Sphero 1.0. We tweaked the settings at https://github.com/hybridgroup/gobot/blob/master/platforms/sphero/sphero_driver.go#L181 to make it more sensitive.

Maybe it would be worth exposing those settings as an API? (with reasonable defaults, of course). We are hoping to detect collisions with other Spheros while filtering out collisions with foam walls -- that may result in settings different than what other people would use.

Reference: collision detection docs and the packet under Configure Collision Detection – 12h.

get beaglebone doesn't

go get -u github.com/hybridgroup/gobot appears to work fine

go get -u github.com/hybridgroup/gobot-beaglebone does not.

Reports "undefined syscall.SYS_LOCAL" in i2c_device.go and "not enough arguments in call to syscall.Syscall" in i2c_device.go.

I am running 64bit windows 7 and running g1.3.1 windows/386.

This is all clean first time install.

Any ideas.

Cheers,
B

Compiling for digispark on OSX

I first got this one:

go install github.com/hybridgroup/gobot/platforms/digispark
# github.com/hybridgroup/gobot/platforms/digispark
In file included from ../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.go:4:
./littleWire.h:34:13: fatal error: 'usb.h' file not found
   #include <usb.h>       // this is libusb, see http://libusb.sourceforge.net/
            ^
1 error generated.

Even through I did run brew install libusb successfully! So I also run brew install libusb-compat and then received this error:

go install github.com/hybridgroup/gobot/platforms/digispark
# github.com/hybridgroup/gobot/platforms/digispark
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.go:5:24: warning: redefinition of typedef 'littleWire' is a C11 feature [-Wtypedef-redefinition]
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.h:105:24: note: previous definition is here
# github.com/hybridgroup/gobot/platforms/digispark
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.c:30:1: warning: '/*' within block comment [-Wcomment]
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.c:48:1: warning: '/*' within block comment [-Wcomment]
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.c:156:53: warning: passing 'unsigned char [64]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
/usr/local/include/usb.h:310:30: note: passing argument to parameter 'bytes' here
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.c:176:83: warning: passing 'unsigned char [64]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
/usr/local/include/usb.h:310:30: note: passing argument to parameter 'bytes' here
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.c:182:56: warning: passing 'unsigned char [64]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
/usr/local/include/usb.h:310:30: note: passing argument to parameter 'bytes' here
../Documents/GoCode/src/github.com/hybridgroup/gobot/platforms/digispark/littleWire.c:184:56: warning: passing 'unsigned char [64]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
<snip>

Any pointers about what I'm doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.