Skip to content

Commit c057754

Browse files
committed
Fix documentations
1 parent 155451c commit c057754

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

include/hardware/Distance/DistanceSensor.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DistanceSensor : public Device {
1515
/**
1616
* @brief Get the distance measured by the distance sensor
1717
*
18-
* The distance measured by the encoder is the distance from the sensor to the nearest object.
18+
* The distance measured by the distance sensor is the distance from the sensor to the nearest object.
1919
*
2020
* @return Length the distance measured by the encoder
2121
* @return INFINITY if there is an error, setting errno
@@ -51,7 +51,7 @@ class DistanceSensor : public Device {
5151
* if (distanceSensor->setOffset(1_in) == 0) {
5252
* std::cout << "Offset set!" << std::endl;
5353
* // With an object touching the surface of the distance sensor
54-
* std::cout < "Offset distance: " << distanceSensor->getDistance().convert(in) << std::endl; // outputs 1 inch
54+
* std::cout << "Offset distance: " << distanceSensor->getDistance().convert(in) << std::endl; // outputs 1 inch
5555
* } else {
5656
* std::cout << "Error setting offset!" << std::endl;
5757
* }

include/hardware/Distance/V5DistanceSensor.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class V5DistanceSensor : public DistanceSensor {
4242
* @b Example:
4343
* @code {.cpp}
4444
* void initialize() {
45-
* lemlib::V5DistanceSensor distance = lemlib::V5RDistanceSensor::from_pros_dist(pros::Distance(1));
45+
* lemlib::V5DistanceSensor distance = lemlib::V5DistanceSensor::from_pros_dist(pros::Distance(1));
4646
* }
4747
* @endcode
4848
*/
@@ -56,7 +56,7 @@ class V5DistanceSensor : public DistanceSensor {
5656
* @b Example:
5757
* @code {.cpp}
5858
* void initialize() {
59-
* lemlib::V5DistanceSensor distance = pros::Distance(1);
59+
* lemlib::V5DistanceSensor distance = lemlib::V5DistanceSensor(1);
6060
* const int result = distance.isConnected();
6161
* if (result == 1) {
6262
* std::cout << "Distance sensor is connected!" << std::endl;
@@ -83,7 +83,7 @@ class V5DistanceSensor : public DistanceSensor {
8383
* @b Example:
8484
* @code {.cpp}
8585
* void initialize() {
86-
* lemlib::V5DistanceSensor distanceSensor = pros::Distance(1);
86+
* lemlib::V5DistanceSensor distanceSensor = lemlib::V5DistanceSensor(1);
8787
* const Length distance = distanceSensor.getDistance();
8888
* if (angle == INFINITY) {
8989
* std::cout << "Error getting distance!" << std::endl;
@@ -107,11 +107,11 @@ class V5DistanceSensor : public DistanceSensor {
107107
* @b Example:
108108
* @code {.cpp}
109109
* void initialize() {
110-
* DistanceSensor* distanceSensor;
110+
* lemlib::V5DistanceSensor distanceSensor(1);
111111
* if (distanceSensor->setOffset(1_in) == 0) {
112112
* std::cout << "Offset set!" << std::endl;
113113
* // With an object touching the surface of the distance sensor
114-
* std::cout < "Offset distance: " << distanceSensor->getDistance().convert(in) << std::endl; // outputs 1 inch
114+
* std::cout << "Offset distance: " << distanceSensor->getDistance().convert(in) << std::endl; // outputs 1 inch
115115
* } else {
116116
* std::cout << "Error setting offset!" << std::endl;
117117
* }

src/hardware/Distance/V5DistanceSensor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "hardware/util.hpp"
33
#include <limits.h>
44
#include <mutex>
5+
#include <cmath>
56

67
namespace lemlib {
78
V5DistanceSensor::V5DistanceSensor(SmartPort port)
@@ -24,7 +25,7 @@ Length V5DistanceSensor::getDistance() const {
2425
std::lock_guard lock(m_mutex);
2526
const int32_t raw = pros::c::distance_get(m_port);
2627
if (raw == INT_MAX) return from_in(INFINITY);
27-
// the rotation sensor returns mm
28+
// the distance sensor returns mm
2829
const Length distance = from_mm(raw);
2930
return distance + m_offset;
3031
}

0 commit comments

Comments
 (0)