The PROS api for c++ is not working

I was trying to program the inertial sensor with PROS API on their website, but it did not work. If anyone has experience programming with PROS and can help me, that would be great. Thanks.

Bruce Miller 621B

Could you please elaborate on the following:

  1. What are you trying to do with the internal sensor
  2. Show what you have tried
  3. How are the results different than what you expected to happen

It is challenging to help people when there is little information about the problem, so please try to provide more information and you can expect much better assistance.

1 Like

inertial senor, not internal

Bruce,

Having more info about what sort of errors you’re seeing, etc., is the only way to get that help. Posting code is also helpful, don’t forget to put three backtick marks “`” before the start of the code and then three more afterwards, so that it formats it and makes it easier to read.

https://pros.cs.purdue.edu/v5/api/cpp/imu.html
link to api
what i have:

void autonomous() {
	//inetial imu_sensor
	printf("IMU get rotation: %f degrees\n", imu_sensor.get_rotation());
	printf("IMU get heading: %f degrees\n", imu_sensor.get_heading());
	pros::c::quaternion_s_t qt = imu_sensor.get_quaternion();
	printf("IMU quaternion: {x: %f, y: %f, z: %f, w: %f}\n", qt.x, qt.y, qt.z, qt.w);
	pros::c::imu_gyro_s_t gyro = imu_sensor.get_gyro_rate();
	printf("IMU gyro values: {x: %f, y: %f, z: %f}\n", gyro.x, gyro.y, gyro.z);
	imu_sensor.reset();

What are you looking to get out of the inertial? Heading or rotation for being able to more accurately drive an autonomous route?

When you call those functions, are they providing values? Have you run calibration before calling autonomous()?

The code overall looks okay, nothing looks wrong overall with it, so I’m not seeing where the issue is. Help us understand more of what’s not working like you’re expecting.

1 Like