<< return to Pixycam.com

setNextTurn() with Python

I am using a Raspberry Pi 4 with the Pixy2, running it through Python 3.7.3. I noticed in the Line API documentation that there is a

int8_t setNextTurn(int16_t angle)

function for when the camera will switch the primary vector at an intersection to a new one, but cannot find this function in the Python libraries. Do you have any suggestions on how to tackle this issue?

Hello,
Sorry for this – we need to add this to the Python API. Hopefully we can get this done in the next couple weeks.

Edward

Around what time could I expect this to be released? Is this a simple workaround I could use to combat this?

Hi Stew,
It’s not too difficult if you’re willing to edit some files.

Add the line below to pixy.i:

extern int line_set_next_turn(angle);

Then add the code below to pixy_python_interface.cpp:

int line_set_next_turn(int angle)
{
    return pixy_instance.line.setNextTurn(angle);
}

and then recompile by running build_python_demos.sh.

You can then invoke this command like so:

import pixy

pixy.init()
pixy.line_set_next_turn(90)

Let me know how it goes, and sorry for the extra trouble :frowning:

Edward