Closed JocelynVelarde closed 10 months ago
Found possible reason on why 4th motor not working properly. (see picture below)
It seems that the pins for IN1 and IN2 are encountering continuity issues due to bad welding.
Additionally pins where separated into the different categories when using the TB6612FNG controller
For motor 1:
For motor 2:
For motor 3:
For motor 4:
The code was updated to function in a modular manner.
The Motor class encapsulates the functionality related to a single motor, providing methods to set the motor parameters (speed, pins), initialize the motor, and control its movement (forward, backward, stop).
Then the Motors class acts as a container for multiple instances of the Motor class, representing a set of motors.
Additionally methods for using the motor controller and setting speed to a specified PWM where included.
The robot now correctly moves forward and backward (see video below)
Using the instances is as simple as writting the following to control the robot:
myMotors.moveForward(); delay(1000); myMotors.stopMotors(); delay(1000); myMotors.moveBackward();
Update on robot movement for method moveMotors(int degree, int speed);
The polarity of the pins for IN1 and IN2 was checked in order to ensure correct motor control, additionally numbers and order for each motor where assigned corresponding the kinematic equations
float m1 = cos(((45+degree) * PI / 180));
(and so on for each motor)
A picture below with the robot diagram is shown
Finished correct robot movement with moveMotors();
method, the method receives and angle and PWM.
As seen in video below. Note that the code follows a pattern of 45°, 135°, 225° and 315°, it is important to keep in mind that because of lack in floor friction the motors might not move as expected.
Ensure motor control is working properly. There have been some issues regarding the movement such as:
To discard programming problems with the robot the following tasks will be performed
Currently the robot performs the following way when placed on the ground (see video below)
https://github.com/RoBorregos/robocup-soccer-open-2024/assets/70779495/8ba192f9-fbae-40c7-8d33-efeb8d246874
Looks like the movement of the motors is not totally free and something is preventing them from spinning correctly. On the second video the robot is tested in the air (watch below)
https://github.com/RoBorregos/robocup-soccer-open-2024/assets/70779495/0a6011da-aa4a-4413-ae2d-83bf7ab2c242
This could be mainly a mechanics problem, still the mentioned tests will be performed to discard any issue with the code.