vector-gobot
This is a Go wrapper for poc.vic-hack. It allows you to directly communicate with the Anki Vector robot's hardware with easy-to-use Go functions and definitions.
Modules
- vcam
- vbody
- vimu
- vscreen
- vjpeg
- Meant to be used in conjunction with vcam.
- Takes a camera frame, unpacks it, debayers it, and converts it to JPEG as fast as possible with turbojpeg.
- Needs an extra lib to be built.
Building
- Clone the repo (with submodules):
git clone --recurse-submodules https://github.com/kercre123/vector-gobot
- Build the libs:
make
- At this point, you can use vcam, vscreen, and vbody. To use vjpeg, you must compile libjpeg-turbo.so:
make libjpeg-turbo
- Build your program (in this case, the body example program):
CC="$(pwd)/vic-toolchain/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc" \
CGO_LDFLAGS="-Lbuild" \
GOARM=7 \
GOARCH=arm \
CGO_ENABLED=1 \
go build -o build/main examples/body/readout.go
- You can define your own toolchain. Just make sure the same one used to build the libs is also the one you are using to build the Go program. Example:
TOOLCHAIN=$HOME/vchain/arm-linux-gnueabi/bin/arm-linux-gnueabi- make
- If you want to build for x86/native, do
TOOLCHAIN=" " make
- For body communication on x86, you will have to run something like
sudo ln -s /dev/ttyUSB0 /dev/ttyHS0
before trying anything out
Installing a program on a bot
- The anki-robot.target must be stopped, so SSH in and run:
systemctl stop anki-robot.target
- The built libs (in ./build) need to be in a place where programs can find them. You can do this by copying them over to the bot's /lib folder or by putting them in any directory and running a program like this:
LD_LIBRARY_PATH=/data/gobot_libs ./main
- Note: by default, /data is mounted as noexec, meaning you can't run any programs in it. To change this:
mount -o rw,remount,exec /data
Features
- Spine (vspine)
- LEDs
- Motors
- Encoders
- Mics
- Touch
- Battery/Charger Voltage
- Body Temperature
- ToF Sensor
- It is able to get data, but I haven't figured out how to calculate it all into a nice mm value
- Cliff Sensors
- Camera (vcam)
- Communicates with mm-anki-camera to get data
- Changes service file to get full framerate from camera
- Gets RGGB10 data from camera. Functions to convert that are included
- JPEG (vjpeg)
- Meant to be used in conjunction with camera
- Communicates with libturbojpeg to quickly compress frames, like for an MJPEG stream
- Includes a direct RGGB10-to-JPEG function
- Screen (vscreen)
- IMU (vimu)
- Fully working
- Polls every 10 ms
TODO
- PCM (speaker)
- ToF sensor calculations
- Maybe read from calibration files
- Implement a way to normalize a camera image and remove distortion from lens
- Nice mic interface functions
- Remove all memory leaks