Add distance sensor and display

This commit is contained in:
2026-03-03 21:11:34 -05:00
parent f09e367d53
commit e67d44a536
16 changed files with 288 additions and 27 deletions

View File

@@ -24,7 +24,11 @@ struct current_text {
std::string text;
};
typedef std::variant<target_angle, current_angle, current_text> sensor_value;
struct distance {
float distance;
};
typedef std::variant<target_angle, current_angle, current_text, distance> sensor_value;
class SensorMessageBuilder {
public:
@@ -51,6 +55,10 @@ class SensorMessageBuilder {
static_cast<const Messaging::CurrentText *>(value);
return current_text{current->value()->str()};
}
case Messaging::SensorValue_Distance: {
const Messaging::Distance *current = static_cast<const Messaging::Distance *>(value);
return distance{current->value()};
}
default:
return std::nullopt;
}