Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

274 Commits

Repository files navigation

What is BittyBuzz?

BittyBuzz is an implementation of the Buzz programming language for microcrontrollers. BittyBuzz is designed to fit a 32k flash memory and work with as little as 2k of RAM.

While the BittyBuzz VM has a number of limitations with respect to the original Buzz VM, BittyBuzz supports 100% of the Buzz bytecode.

Compiling BittyBuzz

For your PC

Type these commands:

$ cd bittybuzz
$ mkdir build
$ cd build
$ cmake ../src/
$ make

For the Kilobot

To compile BittyBuzz to an .hex file that can be used with the Kilobot, you need avr-gcc and related tools. avr-gcc is expected to be installed under /usr/lib/avr/ so that CMake may find its header files.

Type these commands:

$ cd bittybuzz
$ mkdir build_kilobot
$ cd build_kilobot
$ cmake -DCMAKE_TOOLCHAIN_FILE=../src/cmake/Kilobot.cmake ../src/
$ make

Generating documentation

A good place to get started with BittyBuzz is the source code documentation. One may optionaly create such Doxygen-generated documentation of BittyBuzz. This requires Doxygen and can be done via:

$ make doc

The documentation will be subsequently available in HTML and LaTeX formats under <build_dir>/doc, for example, build/doc.

Writing your own behaviors

For kilobots

Currently, BittyBuzz does not support global installation. Behaviors must thus be implemented under src/kilobot/behaviors directly.

The C source file should be placed inside src/<robot_name>/behaviors, whereas the Buzz script is expected to have the same name and be placed under src/<robot_name>/behaviors/buzz_scripts. You should also place a Buzz String Table (.bst) file (which allows BittyBuzz to generate a string ID corresponding to each string) next to your Buzz script, which should contain any string used within the C code and that does not appear in the Buzz script. Look at existing files if you are unsure.

EDIT: It is no longer required to put any thing in the .bst file. However, the file itself is still required to be there. It will eventualy become optional.

At this point, you may run make inside your kilobot build directory to generate a HEX file that can be sent to the kilobots. You will find it under <build_dir>/kilobot/behaviors/<buzz_script_name>/<buzz_script_name>.hex. This file can be sent to the kilobots using the KiloGUI.

Important: After adding new files, be sure to run cmake ../src inside your kilobot build directory for CMake to take them into account.

For Zooids

See src/zooids/README.md

For Crazyflie

See src/crazyflie/README.md

Options

It is possible to specify a custom value for a range of configuration values. Behaviors on low-resource robots often require parameter-tweaking. However, we recommend against changing these values unless it is necessary.

The table below describes all configurable values and classifies each one by the likelihood that one will require changing it.

OptionDescriptionAdjustment likelihoodPCKilobot
BBZHEAP_SIZESize of the heap (B)High32641088
BBZHEAP_ELEMS_PER_TSEGNum. entries per table segmentModerate55
BBZSTACK_SIZESize of the stack (num. objects)High9696
BBZVSTIG_CAPCapacity of the stigmergy structure (num. entries)High33
BBZNEIGHBORS_CAPCapacity of the neighbors structure (num. neighbors)Low1515
BBZINMSG_QUEUE_CAPCapacity of the incoming message queue (num. msgs)Low1010
BBZOUTMSG_QUEUE_CAPCapacity of the outgoing message queue (num. msgs)Low1010
BBZHEAP_RSV_ACTREC_MAXNum. objects on the heap reserved for activation recordsModerate2828
BBZLAMPORT_THRESHOLDLength of Lamport clocks' accepting zoneLow5050
BBZHEAP_GCMARK_DEPTHGarbage collector max recursion depthLow88
BBZMSG_IN_PROC_MAXMax. num. of incoming messages processed per timestepModerate1010
BBZNEIGHBORS_CLR_PERIODNum. timesteps between neighbor clearsLow1010
BBZNEIGHBORS_MARK_TIMENum. timesteps before clear we spend marking neighborsLow44
BBZ_XTREME_MEMORYWhether to reduce RAM at the cost of FlashModerateOFFON
BBZ_USE_PRIORITY_SORTWhether to use priority sort on outgoing message queueLowOFFOFF
BBZ_USE_FLOATWhether to use float typeLowOFFOFF
BBZ_DISABLE_NEIGHBORSWhether to disable the neighbors structureHighOFFOFF
BBZ_DISABLE_VSTIGSWhether to disable the stigmergy structureHighOFFOFF
BBZ_DISABLE_SWARMSWhether to disable the swarms structureHighOFFOFF
BBZ_DISABLE_MESSAGESWhether to disable Buzz messagesModerateOFFOFF
BBZ_DISABLE_PY_BEHAVWhether to disable Python behaviors of closuresLowOFFOFF
BBZ_NEIGHBORS_USE_FLOATSWhether to use floats for the neighbor's range and bearingModerateONOFF
BBZ_ENABLE_FLOAT_OPERATIONSWhether to enable floats operations<span style="color:#880>ONOFF

For example, for a Buzz program requiring larger stack sizes but less heap allocations, you may run cmake as:

$ cmake -DBBZHEAP_SIZE=750 -DBBZSTACK_SIZE=200 ../src

About

BittyBuzz is an implementation of Buzz for microcrontrollers.

Resources

Stars

8 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages