[JacoBot] Arduino #4
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Adrien/JacoBot:main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[JacoBot] Motor encoder basic Arduino implementation with PIDto [JacoBot] Arduino robot0f5ef1e24d
to4bb3c4bd90
4bb3c4bd90
to0fdb58b6cc
[JacoBot] Arduino robotto [JacoPad/JacoBot] Arduino[JacoPad/JacoBot] Arduinoto [JacoBot] ArduinoGood job bro 💪, see my comment to make it a bit more readable.
@ -0,0 +3,4 @@
#include "MotorEncoder.h"
#define pi 3.1415
Car::Car(MotorEncoder* m1, MotorEncoder* m2, float distance)
@ -0,0 +7,4 @@
: m_m1(m1), m_m2(m2), m_distance(distance) {
}
void Car::forward(float distance, double setPoint) { //distance : mm
Add doc string also, see style here : https://www.doxygen.nl/manual/docblocks.html
@ -0,0 +14,4 @@
double m2_duration = 0;
m_m1->setPoint = setPoint;
m_m2->setPoint = setPoint/m2_mmp*m1_mmp;
while(m1_duration<distance/m1_mmp && m2_duration<distance/m2_mmp) {
Compute this
distance/m1_mmp
and thisdistance/m2_mmp
only once, store this before the while in 2 variables.@ -0,0 +32,4 @@
m_m2->stop();
}
void Car::turn(float angle, double setPoint) { //angle : degre
Tell that setPoint is the number of detection seen by the encodor between 2 correction (PWM computed changes).
Comment the method using doxygen
I will put this in MotoEncoder.h
@ -0,0 +4,4 @@
class Car {
private:
float m_distance;// mm
Rename it to distance_between_wheels, add a comment it to indicate that it use to rotate right or left.
@ -0,0 +5,4 @@
class Car {
private:
float m_distance;// mm
MotorEncoder* m_m1;
Rename it to m_left or m_right.
@ -0,0 +6,4 @@
private:
float m_distance;// mm
MotorEncoder* m_m1;
MotorEncoder* m_m2;
Rename it to m_left or m_right.
@ -0,0 +3,4 @@
#include "Radio.h"
#include "MotorEncoder.h"
#include "Car.h"
Put all pins in constant using explicit naming :
@ -0,0 +29,4 @@
//car.forward(100,50);
}
void loop() {
@ -0,0 +12,4 @@
Serial.println("Error while initialise the NRF module");
while (1);
}
Serial.println("Module initialised");
Serial.println("Radio module initialised");
[JacoBot] Arduinoto WIP: [JacoBot] ArduinoWIP: [JacoBot] Arduinoto [JacoBot] Arduino5f8c0a03ad
tofa390c8530
fa390c8530
tob61f8b5648
Checkout
From your project repository, check out a new branch and test the changes.