Conversation
lib/constantes/constantes.h
Outdated
|
|
||
| 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 |
There was a problem hiding this comment.
Variable names should be understandable for its name
There was a problem hiding this comment.
I already changed it to must understandable names
lib/constantes/constantes.h
Outdated
| 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'; | ||
|
|
There was a problem hiding this comment.
Are you using this ?? If not, then remove it from your repo
lib/motores/motores.cpp
Outdated
| : 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) | ||
| {} |
There was a problem hiding this comment.
Name each object as front left, front right, back left, back right for you to know which motor are you refering to
lib/motores/motores.cpp
Outdated
| 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(); |
There was a problem hiding this comment.
As this is a robot with an omnidirectional base, I don't see the necessity of having this functions
There was a problem hiding this comment.
Could be useful for debug and pin control, just be careful with motor names and positions to avoid confusion.
There was a problem hiding this comment.
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) { |
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) { |
There was a problem hiding this comment.
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
| 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"); | ||
| } |
platformio.ini
Outdated
| ; Please visit documentation for the other options and examples | ||
| ; https://docs.platformio.org/page/projectconf.html | ||
|
|
||
| [env:teensy41] |
| adafruit/Adafruit BusIO | ||
| adafruit/Adafruit BNO055 | ||
| servo | ||
| wire |
There was a problem hiding this comment.
Why there's no environment for the motor test code??
There was a problem hiding this comment.
I dont understand
There was a problem hiding this comment.
Read soccer Lightweight 2025 documentation
Bahena05
left a comment
There was a problem hiding this comment.
Clean Pull request before asking for review
lib/motores/motores.cpp
Outdated
| void Motors::MoveMotor1() { front_left.MoveForward(); } | ||
| void Motors::MoveMotor2() { front_right.MoveForward(); } | ||
| void Motors::MoveMotor3() { back_right.MoveForward(); } | ||
| void Motors::MoveMotor4() { back_left.MoveForward(); } | ||
|
|
There was a problem hiding this comment.
Understandable names. which motor are you moving ??
lib/motores/motores.h
Outdated
| 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); |
There was a problem hiding this comment.
understandable names, which variable corresponds to each motor ??
There was a problem hiding this comment.
understandable names, phototransistors , multiplexer, etc. You have two different things in the same class, separate mux and phototransistors
| // - 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); | ||
|
|
src/main.cpp
Outdated
|
|
||
| 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); |
src/main.cpp
Outdated
| // Ball not seen anywhere — sweep side to side | ||
| if (millis() - last_time >= 1000) { | ||
| last_time = millis(); |
src/main.cpp
Outdated
| side = !side; | ||
| } | ||
|
|
src/main.cpp
Outdated
| if (side) { | ||
| motorss.MoveOmnidirectionalBase(-90, Speed, speed_w); | ||
| } else { | ||
| motorss.MoveOmnidirectionalBase(90, Speed, speed_w); | ||
| } |
| adafruit/Adafruit BusIO | ||
| adafruit/Adafruit BNO055 | ||
| servo | ||
| wire |
There was a problem hiding this comment.
Read soccer Lightweight 2025 documentation
No description provided.