Okapi chassis->turnAngle with a variable

I would like to be able to change the angle that the chassis->turnAngle() function using a variable for my auton.
chassis->turnAngle(Motion sensor.get_heading());

error: cannot convert ‘double’ to ‘okapi::QAngle’


1 Like

I’m like pretty sure that isn’t what you want. It seems you are just throwing stuff together until it compiles.

That says, I believe, “get my current angle. Say 30 degrees, and turn that much” so you either end at 60 or 0 degrees depending on how you handle sign convention.


Besides, this won’t even do what tabor says.

You are using the QAngle constructor, which you should not, because it initializes the QAngle using the internal unit. In the case of QAngle, the internal unit is radians, so if “get_heading” returns 90 degrees, you are saying “turn 90 radians”.

The proper use of the api is get_heading() * degree, but like tabor says, you need to think about your logic.


I was just coming back to add that part. After the okapi developer told me I missed it.

1 Like