Skip to content

Student API

Ashwin Vangipuram edited this page Aug 22, 2020 · 13 revisions

Student API

The student API is the set of all functions that the students have available to them to communicate with the robot.

Cython

The student API is written in Cython, which is a static compiler from Python to C. It provides static typing and lets you easily call C functions within Python. You can learn more about Cython at our wiki page https://github.com/pioneers/runtime/wiki/Cython.

In Cython, the .pxd files act as header files while .pyx files act as source files. In runtime.pxd, you will see many extern declarations to C files in Runtime. In studentapi.pyx, each API function converts the Python arguments into C arguments and calls the corresponding shm_wrapper C functions to access shared memory. The only exception is Robot.run and Robot.is_running which are purely Python and use the Python threading module to run a robot action asynchronously to the main thread.