Skip to content

Codigo del MVP#3

Open
R2D2-Robobot wants to merge 13 commits intomainfrom
test
Open

Codigo del MVP#3
R2D2-Robobot wants to merge 13 commits intomainfrom
test

Conversation

@R2D2-Robobot
Copy link
Copy Markdown
Collaborator

No description provided.

@R2D2-Robobot R2D2-Robobot requested a review from emilwinkp March 4, 2026 19:53
@R2D2-Robobot R2D2-Robobot requested a review from Bahena05 March 7, 2026 01:57
Comment on lines +30 to +34

const uint8_t selectPins[3] = {16, 15, 14}; // S0, S1, S2 Pines de seleccion
const uint8_t muxPins[4] = {A6, A7, A9, A14}; // Pines de salida MUX

// Receive signals
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names should be understandable for its name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already changed it to must understandable names

Comment on lines +35 to +41
const uint8_t RECEIVE_BNO = 's';
const uint8_t RECEIVE_BALL_ANGLE= 'c';
const uint8_t RECEIVE_BALL_DISTANCE = 'd';
const uint8_t RECEIVE_GOAL_ANGLE = 'g';
const uint8_t RECEIVE_GOAL_DISTANCE = 'k';
const uint8_t RECEIVE_LINE_ANGLE = 'r';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using this ?? If not, then remove it from your repo

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment on lines +10 to +14
: motor1(pwm_pin1, in1_1, in2_1),
motor2(pwm_pin2, in1_2, in2_2),
motor3(pwm_pin3, in1_3, in2_3),
motor4(pwm_pin4, in1_4, in2_4)
{}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name each object as front left, front right, back left, back right for you to know which motor are you refering to

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +47 to +66
void Motors::StopMotors()
{
motor1.StopMotor();
motor2.StopMotor();
motor3.StopMotor();
motor4.StopMotor();
}

void Motors::MoveForward()
{
motor1.MoveForward();
motor2.MoveForward();
motor3.MoveBackward();
motor4.MoveBackward();
}

void Motors::MoveRight()
{
motor1.MoveForward();
motor2.MoveBackward();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a robot with an omnidirectional base, I don't see the necessity of having this functions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be useful for debug and pin control, just be careful with motor names and positions to avoid confusion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used them for debug mainly, everytime we made a change in electronics, useful to fix if a wheel is turning the other way its supposed to

src/main.cpp Outdated
motorss.MoveMotorsImu((int)ang, Speed, 0);

//If ball not seen with FCamera Mcamera is used
} else if (m_open_ball_seen) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_open ball???? understandable names

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/main.cpp Outdated
} else if (m_open_ball_seen) {
Serial.print("Ball seen in mirror");
Serial.println(m_ball_angle);
if (m_ball_angle > 45.0f) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed some of them, there are a few that are not completely defined as fully functional, will continue to work on them on new branch

src/main.cpp Outdated
Comment on lines +153 to +160
double m_ang = m_ball_angle + 15.0;
motorss.MoveMotorsImu((int)m_ang, 90, speed_w);
Serial.println("Moving right");
} else if (m_ball_angle < -40.0f) {
double m_ang = m_ball_angle - 15.0;
motorss.MoveMotorsImu((int)m_ang, 90, speed_w);
Serial.println("Moving left");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers, variable names

platformio.ini Outdated
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:teensy41]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change environment name to main

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

adafruit/Adafruit BusIO
adafruit/Adafruit BNO055
servo
wire
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why there's no environment for the motor test code??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont understand

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read soccer Lightweight 2025 documentation

@R2D2-Robobot R2D2-Robobot requested a review from Bahena05 March 17, 2026 17:09
Copy link
Copy Markdown

@Bahena05 Bahena05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean Pull request before asking for review

Comment on lines +89 to +93
void Motors::MoveMotor1() { front_left.MoveForward(); }
void Motors::MoveMotor2() { front_right.MoveForward(); }
void Motors::MoveMotor3() { back_right.MoveForward(); }
void Motors::MoveMotor4() { back_left.MoveForward(); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understandable names. which motor are you moving ??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +16 to +19
Motors(uint8_t speed1, uint8_t in1_1, uint8_t in2_1,
uint8_t speed2, uint8_t in1_2, uint8_t in2_2,
uint8_t speed3, uint8_t in1_3, uint8_t in2_3,
uint8_t speed4, uint8_t in1_4, uint8_t in2_4);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understandable names, which variable corresponds to each motor ??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understandable names, phototransistors , multiplexer, etc. You have two different things in the same class, separate mux and phototransistors

Comment on lines +4 to +8
// - Constructor: copy pin arrays and init defaults
PhotoMux::PhotoMux(const uint8_t selectPins[3], const uint8_t muxPins[4]) {
memcpy(_selectPins, selectPins, 3);
memcpy(_muxPins, muxPins, 4);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understandable names

src/main.cpp Outdated
Comment on lines +263 to +272

if (m_ball_angle > 45.0f) {
motorss.MoveOmnidirectionalBase((int)(m_ball_angle + 30.0), 90, speed_w);
Serial.println("Moving right");
} else if (m_ball_angle < -40.0f) {
motorss.MoveOmnidirectionalBase((int)(m_ball_angle - 30.0), 90, speed_w);
Serial.println("Moving left");
} else {
Serial.println("Ball is behind");
motorss.MoveOmnidirectionalBase(120, Speed, speed_w);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

src/main.cpp Outdated
Comment on lines +276 to +278
// Ball not seen anywhere — sweep side to side
if (millis() - last_time >= 1000) {
last_time = millis();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, magic number for time

src/main.cpp Outdated
Comment on lines +279 to +281
side = !side;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side is not side ???

src/main.cpp Outdated
Comment on lines +282 to +286
if (side) {
motorss.MoveOmnidirectionalBase(-90, Speed, speed_w);
} else {
motorss.MoveOmnidirectionalBase(90, Speed, speed_w);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable for angle movement

adafruit/Adafruit BusIO
adafruit/Adafruit BNO055
servo
wire
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read soccer Lightweight 2025 documentation

@R2D2-Robobot R2D2-Robobot requested a review from Bahena05 March 22, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants