Skip to content

Commit 0ce412e

Browse files
committed
Add: Use offsets from config
1 parent 70c5270 commit 0ce412e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/lib/servoarray.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ ServoArray::ServoArray(std::shared_ptr<Driver> driver, const std::vector<double>
2828
ServoArray::ServoArray(const std::string& name, const DriverParams& params, DriverManager& manager) : driver_(manager.load(name, params)) {
2929
this->cache_.resize(this->size());
3030
this->offsets_.resize(this->size());
31+
32+
for (const auto& p : manager.config().offset().offsets()) {
33+
if (p.first >= this->size()) {
34+
throw std::runtime_error("Offset index out of range");
35+
}
36+
37+
this->offsets_[p.first] = p.second;
38+
}
3139
}
3240

3341
void ServoArray::write(std::size_t index, double rad) {

0 commit comments

Comments
 (0)