No Member Named turnToHeading

Inertia.turnToHeading(90, degrees);

This tidbit of code gives me the error

no member named 'turnToHeading' in 'vex::inertial'

What is causing this, and how could I fix it?

(note that the inertial sensor is named Inertia in code)

Thinking you probably meant to reference Drivetrain?

1 Like

What is this supposed to mean?

One of two things, depending on what you are trying to do. Not clear to me if you are using C++ or Python. Perhaps it would be clearer if you could post all of your code. Nevertheless, it appears to me that either you are using the wrong class or the wrong function. Your post did not show how you created the referenced objects.

Since you seem to be wanting to move the robot (e.g. turn), I suppose you have invoked the drivetrain or smartdrive objects? The function you referenced is “turnToHeading” which is not included under the inertial class - hence the error you are seeing. There is a “turnToHeading” function listed for the C++ API and the Python API under IQ. I don’t do V5 but looked at the V5 APIs and did not see an equivalent function under drivetrain, but perhaps smartdrive? Regardless, I believe this function is included under the Drivetrain class (at least for C++ under IQ ). Consequently, your code would look something like

 Drivetrain.turnToHeading(90, degrees);

Your post also references “Inertia” with respect to inertial sensor. I’m guessing you created the related inertial object using the name “inertia” (again, posting all of your code would be helpful)? Regardless, functions related to inertial sensor would be found in the inertial class. I checked the V5 and IQ APIs for functions under the inertial class and did not find “turnToHeading” listed.

1 Like

This makes way more sense. I know how to configure my drivetrain (6-motor, if relevant) into a smart-drive, so I will try that.