Skip to content
Antonio Vivace edited this page Dec 3, 2017 · 1 revision

Python API

Get started

import coderbot
bot = coderbot.CoderBot.get_instace()

Movement

Elapse is the duration, in seconds. The following commands are sync.

Backward: bot.backward(speed=100, elapse=1)

Forward: bot.forward(speed=100, elapse=1)

Left: get_bot().left(speed=100, elapse=1)

Right: get_bot().right(speed=100, elapse=1)

Sensors

bot.get_sonar_distance(i) gets the measured value from Sonar Sensor i.

Audio

pactl list

Stream to RTMP

Assuming ffmpeg and avconv are installed:

raspivid -o - -t 0 -vf -hf -w [WIDTH] -h [HEIGHT] -fps [FRAMERATE] -b [BITRATE] | avconv -re -ar 44100 -ac 2 -acodec pcm_s16le -f pulse -i [AUDIO_DEVICE_NAME] -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv [RTMP_ENDPOINT]/[AUTH_TOKEN]