@@ -173,46 +173,33 @@ class BraccioClass
173
173
174
174
#define Braccio BraccioClass::get_default_instance ()
175
175
176
- class Servo {
176
+ class Servo
177
+ {
177
178
public:
178
- Servo (SmartServoClass & servos, int idx) : _servos (servos), _idx (idx) {}
179
- Servo& to (float angle) {
180
- _servos.setPosition (_idx, angle, _speed);
181
- return *this ;
182
- }
183
- Servo& in (std::chrono::milliseconds len) {
184
- _servos.setTime (_idx, len.count ());
185
- return *this ;
186
- }
187
- Servo& move () {
188
- return *this ;
189
- }
190
- float position () {
191
- return _servos.getPosition (_idx);
192
- }
193
179
194
- inline bool connected () { return Braccio.connected (_idx); }
180
+ Servo (SmartServoClass & servos, int const idx) : _servos (servos), _idx (idx) { }
181
+
182
+ inline void disengage () { _servos.disengage (_idx); }
183
+ inline void engage () { _servos.engage (_idx); }
184
+ inline bool engaged () { return _servos.isEngaged (_idx); }
185
+
186
+ inline Servo & move () { return *this ; }
187
+ inline Servo & to (float const angle) { _servos.setPosition (_idx, angle, _speed); return *this ; }
188
+ inline Servo & in (std::chrono::milliseconds const len) { _servos.setTime (_idx, len.count ()); return *this ; }
189
+
190
+ inline float position () { return _servos.getPosition (_idx); }
191
+ inline bool connected () { return Braccio.connected (_idx); }
192
+ inline void info (Stream & stream) { _servos.getInfo (stream, _idx); }
193
+
194
+ operator bool () { return connected (); }
195
195
196
- operator bool () {
197
- return connected ();
198
- }
199
- void info (Stream& stream) {
200
- _servos.getInfo (stream, _idx);
201
- }
202
- void disengage () {
203
- _servos.disengage (_idx);
204
- }
205
- void engage () {
206
- _servos.engage (_idx);
207
- }
208
- bool engaged () {
209
- return _servos.isEngaged (_idx);
210
- }
211
196
212
197
private:
198
+
213
199
SmartServoClass & _servos;
214
- int _idx;
215
- int _speed = 100 ;
200
+ int const _idx;
201
+ int const _speed = 100 ;
202
+
216
203
};
217
204
218
205
struct __callback__container__ {
0 commit comments