[JacoBot] Arduino #4
Loading…
Add table
Add a link
Reference in a new issue
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 robot0f5ef1e24dto4bb3c4bd904bb3c4bd90to0fdb58b6cc[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.1415Car::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 : mmAdd 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_mmpand thisdistance/m2_mmponly once, store this before the while in 2 variables.@ -0,0 +32,4 @@m_m2->stop();}void Car::turn(float angle, double setPoint) { //angle : degreTell 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;// mmRename 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;// mmMotorEncoder* m_m1;Rename it to m_left or m_right.
@ -0,0 +6,4 @@private:float m_distance;// mmMotorEncoder* 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] Arduino5f8c0a03adtofa390c8530fa390c8530tob61f8b5648View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.