Linter Error? or just a acutal error

Hello, I am trying to code some stuff but these errors are occurring, I know a couple of them are because of the linter but there’s so many I don’t know if it’s because of me.pppppppppppp

1 Like

This is what I have in Initalize.cpp

void initialize() {
	pros::lcd::initialize();
	pros::lcd::set_text(0, "7157X was here");

	backLeftD.set_brake_mode( pros::E_MOTOR_BREAK_COAST ) ; 
	backRightD.set_brake_mode( pros::E_MOTOR_BREAK_COAST ) ; 
    frontLeftD.set_brake_mode( pros::E_MOTOR_BREAK_COAST ) ; 
	frontRightD.set_brake_mode( pros::E_MOTOR_BREAK_COAST ) ; 
	
}

and this is what is in my drive.cpp file

#include "main.h"



// HELPER FUNCTIONS

void setDrive(int left, int right) {

  frontLeftD = left ;
  frontRightD = right ;
  backLeftD = left ;
  backLeftD = right ;



void resetDriveEncoders() {

  backLeftD.tare_position();
  backRightD.tare_position();
  frontLeftD.tare_position();
  frontRightD.tare_position();

}

double avgDriveEncoderValue() {
  return fabs(frontLeftD.get_position()) < abs(units)) +
         fabs(frontRightD.get_position()) < abs(units)) +
         fabs(backLeftD.get_position()) < abs(units)) +
         fabs(backRightD.get_position()) < abs(units))) / 4;
}

//DRIVER CONTROL FUNCTIONS

void setDriveMotors() {

  int leftJoystick = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);
  int rightJoystick = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y);
  if(abs(leftJoystick) < 10) {
   leftJoystick = 0;
  }
  if(abs(rightJoystick) < 10) {
    rightJoystick = 0;
  }
  setDrive(leftJoystick, rightJoystick);
}

// AUTONOMOUS FUNCTIONS

void translate( int units, int voltage ) {
  int direction = abs(units) / units ;

  // reset motor encoders
  resetDriveEncoders();
  //drive forward until nutis are reached
  while(avgDriveEncoderValue() < abs(units)) {
    setDrive(voltage * direction, voltage * direction);
    pros::delay(10);

  }
  //breif break
  setDrive(-10 * direction,-10 * direction);
  pros::delay(50);
  // drive back to neutral
  setDrive(0 , 0 );

}



1 Like

NewProject.zip (17.3 MB)

1 Like

Well I can clear 4 of them without downloading your project. You spelled “Brake” wrong. It really helps to read the errors. I’m on my phone so it can’t download but those are easy fixed.

6 Likes

I guess I didn’t notice that, thanks for the feedback.

If you are still having errors you should post variables.cpp and autonomous.cpp because the errors in your original screenshot list those files too. It is very likely that you did not include the definition of those functions in those files.

2 Likes

I was looking through it and I forgot a } this solved most of the errors now. The only ones I have left are these.

#include "main.h"

pros::Imu interial('B' , 0.91);

// HELPER FUNCTIONS

void setDrive(int left, int right) {

  frontLeftD = left ;
  frontRightD = right ;
  backLeftD = left ;
  backLeftD = right ;
  
}



void resetDriveEncoders() {

  backLeftD.tare_position();
  backRightD.tare_position();
  frontLeftD.tare_position();
  frontRightD.tare_position();

}

double avgDriveEncoderValue() {
  return fabs(frontLeftD.get_position()) < abs(units)) +
         fabs(frontRightD.get_position()) < abs(units)) +
         fabs(backLeftD.get_position()) < abs(units)) +
         fabs(backRightD.get_position()) < abs(units))) / 4;
}

//DRIVER CONTROL FUNCTIONS

void setDriveMotors() {

  int leftJoystick = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);
  int rightJoystick = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y);
  if(abs(leftJoystick) < 10) {
   leftJoystick = 0;
  }
  if(abs(rightJoystick) < 10) {
    rightJoystick = 0;
  }
  setDrive(leftJoystick, rightJoystick);
}

// AUTONOMOUS FUNCTIONS

void translate(int units, int voltage) {
  // define a direction based on untis.
  int direction = abs(units) / units ;
  // reset motor encoders
  resetDriveEncoders();
  inertial.reset();
  //drive forward until nutis are reached
  while(avgDriveEncoderValue() < abs(units)) {
    setDrive(voltage * direction + inertial.get_value(), voltage * direction + inertial.get_value());
    pros::delay(10);

  }
//breif break
setDrive(-10 * direction,-10 * direction);
pros::delay(50);
// drive back to neutral
setDrive(0 , 0 );

}


1: its becuase of the inertial, I formatted it just as the gyro was but idk how to format it.
2: it says units was a undeclared identifier.

The solution to tell if errors are made up by the linter or not? Don’t use the linter, just compile!

6 Likes

Just glancing at it, you spelled “inertial” as “interial” in your definition in line 3.

2 Likes