@@ -91,108 +91,111 @@ class Arduino_AlvikCarrier{
9191
9292 Arduino_AlvikCarrier ();
9393
94- int begin ();
94+ int begin (); // initialize the robot
9595
9696
97- void getVersion (uint8_t &high_byte, uint8_t &mid_byte, uint8_t &low_byte);
97+ void getVersion (uint8_t &high_byte, uint8_t &mid_byte, uint8_t &low_byte); // get firmware version
9898
9999
100100 // Color sensor, APDS9960
101- int beginAPDS (); // initialize all components required by color detection
102- void updateAPDS (); // refresh data
103- void setIlluminator (uint8_t value); // set white leds
104- void enableIlluminator (); // white leds on
105- void disableIlluminator (); // white leds off
106- int getRed (); // red value 0-4095
107- int getGreen (); // green value 0-4095
108- int getBlue (); // blue value 0-4095
109- int getProximity (); // proximity value 0-127
101+ int beginAPDS (); // initialize all components required by color detection
102+ void updateAPDS (); // refresh data
103+ void setIlluminator (uint8_t value); // set white leds
104+ void enableIlluminator (); // white leds on
105+ void disableIlluminator (); // white leds off
106+ int getRed (); // red value 0-4095
107+ int getGreen (); // green value 0-4095
108+ int getBlue (); // blue value 0-4095
109+ int getProximity (); // proximity value 0-127
110110
111111
112112 // Servo
113- int beginServo (); // initialize Servo interfaces
114- void setServoA (int position); // 0°-180° servo position
115- void setServoB (int position); // 0°-180° servo position
113+ int beginServo (); // initialize Servo interfaces
114+ void setServoA (int position); // 0°-180° servo position
115+ void setServoB (int position); // 0°-180° servo position
116116
117117
118118 // I2C select
119- int beginI2Cselect (); // initialize I2C bus selector
120- void setExternalI2C (uint8_t state); // set A4,A5 connection on I2C bus 2
121- void connectExternalI2C (); // allow A4,A5 on nano connector to be attached to I2C bus 2
122- void disconnectExternalI2C (); // disable the connection on A4,A5
119+ int beginI2Cselect (); // initialize I2C bus selector
120+ void setExternalI2C (uint8_t state); // set A4,A5 connection on I2C bus 2
121+ void connectExternalI2C (); // allow A4,A5 on nano connector to be attached to I2C bus 2
122+ void disconnectExternalI2C (); // disable the connection on A4,A5
123123
124124
125125 // BMS, MAX17332
126- int beginBMS ();
127- void updateBMS ();
128- float getBatteryVoltage ();
129- float getBatteryChargePercentage ();
126+ int beginBMS (); // initialize BMS
127+ void updateBMS (); // update the BMS
128+ float getBatteryVoltage (); // get Voltage
129+ float getBatteryChargePercentage (); // get battery percentage
130+
130131
131132
132133 // Motors
133- int beginMotors ();
134- void updateMotors ();
135- bool setRpmLeft (const float rpm);
136- float getRpmLeft ();
137- bool setRpmRight (const float rpm);
138- float getRpmRight ();
139- bool setRpm (const float left, const float right); // sets RPMs on left and right wheels
140- void getRpm (float & left, float & right); // get RPMs on left and right wheels
141- void setKPidRight (const float kp, const float ki, const float kd); // set PID parameters for right wheel
142- void setKPidLeft (const float kp, const float ki, const float kd); // set PID parameters for left wheel
134+ int beginMotors (); // initialize motor controls
135+ void updateMotors (); // update motor control
136+ bool setRpmLeft (const float rpm); // set RPM of left motor
137+ float getRpmLeft (); // get RPM of left motor
138+ bool setRpmRight (const float rpm); // set RPM of right motor
139+ float getRpmRight (); // get RPM of right motor
140+ bool setRpm (const float left, const float right); // sets RPMs on left and right wheels
141+ void getRpm (float & left, float & right); // get RPMs on left and right wheels
142+ void setKPidRight (const float kp, const float ki, const float kd); // set PID parameters for right wheel
143+ void setKPidLeft (const float kp, const float ki, const float kd); // set PID parameters for left wheel
144+
143145
144146
145147 // Touch
146- int beginTouch (); // initialize touch
147- void updateTouch (); // update touch status
148- bool getAnyTouchPressed (); // get any touch pressed
149- bool getTouchKey (const uint8_t key); // return true if key touch is pressed
150- uint8_t getTouchKeys (); // return touched pads as byte
151- bool getTouchUp (); // get nav pad up
152- bool getTouchRight (); // get nav pad right
153- bool getTouchDown (); // get nav pad down
154- bool getTouchLeft (); // get nav pad left
155- bool getTouchCenter (); // get nav pad enter (center circle)
156- bool getTouchOk (); // get nav pad ok (right check)
157- bool getTouchDelete (); // get nav pad delete (right x)
148+ int beginTouch (); // initialize touch
149+ void updateTouch (); // update touch status
150+ bool getAnyTouchPressed (); // get any touch pressed
151+ bool getTouchKey (const uint8_t key); // return true if key touch is pressed
152+ uint8_t getTouchKeys (); // return touched pads as byte
153+ bool getTouchUp (); // get nav pad up
154+ bool getTouchRight (); // get nav pad right
155+ bool getTouchDown (); // get nav pad down
156+ bool getTouchLeft (); // get nav pad left
157+ bool getTouchCenter (); // get nav pad enter (center circle)
158+ bool getTouchOk (); // get nav pad ok (right check)
159+ bool getTouchDelete (); // get nav pad delete (right x)
160+
158161
159162
160163 // Leds
161- int beginLeds ();
162- void setLedBuiltin (const uint8_t value);
163- void setLedLeft (const uint32_t color);
164- void setLedLeft (const uint32_t red, const uint32_t green, const uint32_t blue);
165- void setLedLeftRed (const uint32_t red);
166- void setLedLeftGreen (const uint32_t green);
167- void setLedLeftBlue (const uint32_t blue);
168- void setLedRight (const uint32_t color);
169- void setLedRight (const uint32_t red, const uint32_t green, const uint32_t blue);
170- void setLedRightRed (const uint32_t red);
171- void setLedRightGreen (const uint32_t green);
172- void setLedRightBlue (const uint32_t blue);
173- void setLeds (const uint32_t color);
174- void setLeds (const uint32_t red, const uint32_t green, const uint32_t blue);
175- void setAllLeds (const uint8_t value);
164+ int beginLeds (); // initialize leds
165+ void setLedBuiltin (const uint8_t value); // set built-in led
166+ void setLedLeft (const uint32_t color); // set left led by color
167+ void setLedLeft (const uint32_t red, const uint32_t green, const uint32_t blue); // set left led by RGB (only boolean values)
168+ void setLedLeftRed (const uint32_t red); // set red left led
169+ void setLedLeftGreen (const uint32_t green); // set green left led
170+ void setLedLeftBlue (const uint32_t blue); // set blue left led
171+ void setLedRight (const uint32_t color); // set right led by color
172+ void setLedRight (const uint32_t red, const uint32_t green, const uint32_t blue);// set right led by RGB (only boolean values)
173+ void setLedRightRed (const uint32_t red); // set red right led
174+ void setLedRightGreen (const uint32_t green); // set green right led
175+ void setLedRightBlue (const uint32_t blue); // set blue right led
176+ void setLeds (const uint32_t color); // set both leds by color
177+ void setLeds (const uint32_t red, const uint32_t green, const uint32_t blue); // set both leds by RGB (only boolean values)
178+ void setAllLeds (const uint8_t value); // set all leds by a byte
176179
177180
178181 // Imu
179- int beginImu (); // initialize LSD6DSOX-
180- void updateImu (); // update accelerometer and gyroscope data. Update sensor fusion
181- float getAccelerationX (); // get acceleration on x axis
182- float getAccelerationY (); // get acceleration on y axis
183- float getAccelerationZ (); // get acceleration on z axis
184- float getAngularVelocityX (); // get angular velocity on x axis
185- float getAngularVelocityY (); // get angular velocity on y axis
186- float getAngularVelocityZ (); // get angular velocity on z axis
187- float getRoll (); // get robot roll
188- float getPitch (); // get robot pitch
189- float getYaw (); // get robot yaw
182+ int beginImu (); // initialize LSD6DSOX-
183+ void updateImu (); // update accelerometer and gyroscope data. Update sensor fusion
184+ float getAccelerationX (); // get acceleration on x axis
185+ float getAccelerationY (); // get acceleration on y axis
186+ float getAccelerationZ (); // get acceleration on z axis
187+ float getAngularVelocityX (); // get angular velocity on x axis
188+ float getAngularVelocityY (); // get angular velocity on y axis
189+ float getAngularVelocityZ (); // get angular velocity on z axis
190+ float getRoll (); // get robot roll
191+ float getPitch (); // get robot pitch
192+ float getYaw (); // get robot yaw
190193
191- void errorLed (const int error_code); // error routine, locks on code blinking led
194+ void errorLed (const int error_code); // error routine, locks on code blinking led
192195
193196
194197 // Kinematics
195- void drive (const float linear, const float angular);
198+ void drive (const float linear, const float angular); // set mm/s and deg/s of the robot
196199
197200 void rotate (const float angle);
198201
0 commit comments