examples: modify consumers of joystick.NewAdaptor() to pass joystick ID as is now required
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
603fe264f5
commit
8e434f2bc0
|
@ -25,7 +25,7 @@ var leftX, leftY, rightX, rightY atomic.Value
|
|||
const offset = 32767.0
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
||||
|
||||
ardroneAdaptor := ardrone.NewAdaptor()
|
||||
|
|
|
@ -25,7 +25,7 @@ var leftX, leftY, rightX, rightY atomic.Value
|
|||
const offset = 32767.0
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
||||
|
||||
bebopAdaptor := bebop.NewAdaptor()
|
||||
|
|
|
@ -83,7 +83,7 @@ func ffmpeg() (stdin io.WriteCloser, stderr io.ReadCloser, err error) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
||||
|
||||
bebopAdaptor := bebop.NewAdaptor()
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock3)
|
||||
|
||||
work := func() {
|
||||
|
@ -64,15 +64,27 @@ func main() {
|
|||
stick.On(joystick.RightPress, func(data interface{}) {
|
||||
fmt.Println("right_press")
|
||||
})
|
||||
stick.On(joystick.RightRelease, func(data interface{}) {
|
||||
fmt.Println("right_release")
|
||||
})
|
||||
stick.On(joystick.LeftPress, func(data interface{}) {
|
||||
fmt.Println("left_press")
|
||||
})
|
||||
stick.On(joystick.LeftRelease, func(data interface{}) {
|
||||
fmt.Println("left_release")
|
||||
})
|
||||
stick.On(joystick.UpPress, func(data interface{}) {
|
||||
fmt.Println("up_press")
|
||||
})
|
||||
stick.On(joystick.UpRelease, func(data interface{}) {
|
||||
fmt.Println("up_release")
|
||||
})
|
||||
stick.On(joystick.DownPress, func(data interface{}) {
|
||||
fmt.Println("down_press")
|
||||
})
|
||||
stick.On(joystick.DownRelease, func(data interface{}) {
|
||||
fmt.Println("down_release")
|
||||
})
|
||||
|
||||
// joysticks
|
||||
stick.On(joystick.LeftX, func(data interface{}) {
|
||||
|
@ -92,15 +104,27 @@ func main() {
|
|||
stick.On(joystick.R1Press, func(data interface{}) {
|
||||
fmt.Println("R1Press", data)
|
||||
})
|
||||
stick.On(joystick.R1Release, func(data interface{}) {
|
||||
fmt.Println("R1Release", data)
|
||||
})
|
||||
stick.On(joystick.R2Press, func(data interface{}) {
|
||||
fmt.Println("R2Press", data)
|
||||
})
|
||||
stick.On(joystick.R2Release, func(data interface{}) {
|
||||
fmt.Println("R2Release", data)
|
||||
})
|
||||
stick.On(joystick.L1Press, func(data interface{}) {
|
||||
fmt.Println("L1Press", data)
|
||||
})
|
||||
stick.On(joystick.L1Release, func(data interface{}) {
|
||||
fmt.Println("L1Release", data)
|
||||
})
|
||||
stick.On(joystick.L2Press, func(data interface{}) {
|
||||
fmt.Println("L2Press", data)
|
||||
})
|
||||
stick.On(joystick.L2Release, func(data interface{}) {
|
||||
fmt.Println("L2Release", data)
|
||||
})
|
||||
}
|
||||
|
||||
robot := gobot.NewRobot("joystickBot",
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock4)
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, joystick.Dualsense)
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, joystick.Xbox360)
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, joystick.Xbox360RockBandDrums)
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
joystick := joystick.NewDriver(joystickAdaptor, joystick.XboxOne)
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -43,7 +43,7 @@ var leftX, leftY, rightX, rightY atomic.Value
|
|||
const offset = 32767.0
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor,
|
||||
"./platforms/joystick/configs/dualshock3.json",
|
||||
)
|
||||
|
|
|
@ -43,7 +43,7 @@ var leftX, leftY, rightX, rightY atomic.Value
|
|||
const offset = 32767.0
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
||||
|
||||
droneAdaptor := ble.NewClientAdaptor(os.Args[1])
|
||||
|
|
|
@ -74,7 +74,7 @@ var (
|
|||
flightData *tello.FlightData
|
||||
|
||||
// joystick
|
||||
joyAdaptor = joystick.NewAdaptor()
|
||||
joyAdaptor = joystick.NewAdaptor(0)
|
||||
stick = joystick.NewDriver(joyAdaptor, "dualshock4")
|
||||
leftX, leftY, rightX, rightY atomic.Value
|
||||
)
|
||||
|
|
|
@ -37,7 +37,7 @@ var leftX, leftY, rightX, rightY atomic.Value
|
|||
const offset = 32767.0
|
||||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
joystickAdaptor := joystick.NewAdaptor(0)
|
||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
||||
|
||||
drone := tello.NewDriver("8888")
|
||||
|
|
Loading…
Reference in New Issue