@@ -207,7 +207,7 @@ class sensor : protected device {
207
207
208
208
// Command: write-only
209
209
// Sends a command to the sensor.
210
- auto set_command (std::string v) -> decltype(* this ) {
210
+ sensor& set_command (std::string v) {
211
211
set_attr_string (" command" , v);
212
212
return *this ;
213
213
}
@@ -231,7 +231,7 @@ class sensor : protected device {
231
231
// Returns the current mode. Writing one of the values returned by `modes`
232
232
// sets the sensor to that mode.
233
233
std::string mode () const { return get_attr_string (" mode" ); }
234
- auto set_mode (std::string v) -> decltype(* this ) {
234
+ sensor& set_mode (std::string v) {
235
235
set_attr_string (" mode" , v);
236
236
return *this ;
237
237
}
@@ -279,7 +279,7 @@ class i2c_sensor : public sensor {
279
279
// coded as 50 msec. Returns -EOPNOTSUPP if changing polling is not supported.
280
280
// Currently only I2C/NXT sensors support changing the polling period.
281
281
int poll_ms () const { return get_attr_int (" poll_ms" ); }
282
- auto set_poll_ms (int v) -> decltype(* this ) {
282
+ i2c_sensor& set_poll_ms (int v) {
283
283
set_attr_int (" poll_ms" , v);
284
284
return *this ;
285
285
}
@@ -684,7 +684,7 @@ class motor : protected device {
684
684
// Command: write-only
685
685
// Sends a command to the motor controller. See `commands` for a list of
686
686
// possible values.
687
- auto set_command (std::string v) -> decltype(* this ) {
687
+ motor& set_command (std::string v) {
688
688
set_attr_string (" command" , v);
689
689
return *this ;
690
690
}
@@ -737,7 +737,7 @@ class motor : protected device {
737
737
// Units are in percent. Valid values are -100 to 100. A negative value causes
738
738
// the motor to rotate in reverse.
739
739
int duty_cycle_sp () const { return get_attr_int (" duty_cycle_sp" ); }
740
- auto set_duty_cycle_sp (int v) -> decltype(* this ) {
740
+ motor& set_duty_cycle_sp (int v) {
741
741
set_attr_int (" duty_cycle_sp" , v);
742
742
return *this ;
743
743
}
@@ -754,7 +754,7 @@ class motor : protected device {
754
754
// a positive duty cycle will cause the motor to rotate counter-clockwise.
755
755
// Valid values are `normal` and `inversed`.
756
756
std::string polarity () const { return get_attr_string (" polarity" ); }
757
- auto set_polarity (std::string v) -> decltype(* this ) {
757
+ motor& set_polarity (std::string v) {
758
758
set_attr_string (" polarity" , v);
759
759
return *this ;
760
760
}
@@ -765,31 +765,31 @@ class motor : protected device {
765
765
// Likewise, rotating counter-clockwise causes the position to decrease.
766
766
// Writing will set the position to that value.
767
767
int position () const { return get_attr_int (" position" ); }
768
- auto set_position (int v) -> decltype(* this ) {
768
+ motor& set_position (int v) {
769
769
set_attr_int (" position" , v);
770
770
return *this ;
771
771
}
772
772
773
773
// Position P: read/write
774
774
// The proportional constant for the position PID.
775
775
int position_p () const { return get_attr_int (" hold_pid/Kp" ); }
776
- auto set_position_p (int v) -> decltype(* this ) {
776
+ motor& set_position_p (int v) {
777
777
set_attr_int (" hold_pid/Kp" , v);
778
778
return *this ;
779
779
}
780
780
781
781
// Position I: read/write
782
782
// The integral constant for the position PID.
783
783
int position_i () const { return get_attr_int (" hold_pid/Ki" ); }
784
- auto set_position_i (int v) -> decltype(* this ) {
784
+ motor& set_position_i (int v) {
785
785
set_attr_int (" hold_pid/Ki" , v);
786
786
return *this ;
787
787
}
788
788
789
789
// Position D: read/write
790
790
// The derivative constant for the position PID.
791
791
int position_d () const { return get_attr_int (" hold_pid/Kd" ); }
792
- auto set_position_d (int v) -> decltype(* this ) {
792
+ motor& set_position_d (int v) {
793
793
set_attr_int (" hold_pid/Kd" , v);
794
794
return *this ;
795
795
}
@@ -800,7 +800,7 @@ class motor : protected device {
800
800
// can use the value returned by `counts_per_rot` to convert tacho counts to/from
801
801
// rotations or degrees.
802
802
int position_sp () const { return get_attr_int (" position_sp" ); }
803
- auto set_position_sp (int v) -> decltype(* this ) {
803
+ motor& set_position_sp (int v) {
804
804
set_attr_int (" position_sp" , v);
805
805
return *this ;
806
806
}
@@ -825,7 +825,7 @@ class motor : protected device {
825
825
// RPM or deg/sec to tacho counts per second. Use the `count_per_m` attribute to
826
826
// convert m/s to tacho counts per second.
827
827
int speed_sp () const { return get_attr_int (" speed_sp" ); }
828
- auto set_speed_sp (int v) -> decltype(* this ) {
828
+ motor& set_speed_sp (int v) {
829
829
set_attr_int (" speed_sp" , v);
830
830
return *this ;
831
831
}
@@ -837,7 +837,7 @@ class motor : protected device {
837
837
// setpoint. The actual ramp time is the ratio of the difference between the
838
838
// `speed_sp` and the current `speed` and max_speed multiplied by `ramp_up_sp`.
839
839
int ramp_up_sp () const { return get_attr_int (" ramp_up_sp" ); }
840
- auto set_ramp_up_sp (int v) -> decltype(* this ) {
840
+ motor& set_ramp_up_sp (int v) {
841
841
set_attr_int (" ramp_up_sp" , v);
842
842
return *this ;
843
843
}
@@ -849,31 +849,31 @@ class motor : protected device {
849
849
// setpoint. The actual ramp time is the ratio of the difference between the
850
850
// `speed_sp` and the current `speed` and max_speed multiplied by `ramp_down_sp`.
851
851
int ramp_down_sp () const { return get_attr_int (" ramp_down_sp" ); }
852
- auto set_ramp_down_sp (int v) -> decltype(* this ) {
852
+ motor& set_ramp_down_sp (int v) {
853
853
set_attr_int (" ramp_down_sp" , v);
854
854
return *this ;
855
855
}
856
856
857
857
// Speed P: read/write
858
858
// The proportional constant for the speed regulation PID.
859
859
int speed_p () const { return get_attr_int (" speed_pid/Kp" ); }
860
- auto set_speed_p (int v) -> decltype(* this ) {
860
+ motor& set_speed_p (int v) {
861
861
set_attr_int (" speed_pid/Kp" , v);
862
862
return *this ;
863
863
}
864
864
865
865
// Speed I: read/write
866
866
// The integral constant for the speed regulation PID.
867
867
int speed_i () const { return get_attr_int (" speed_pid/Ki" ); }
868
- auto set_speed_i (int v) -> decltype(* this ) {
868
+ motor& set_speed_i (int v) {
869
869
set_attr_int (" speed_pid/Ki" , v);
870
870
return *this ;
871
871
}
872
872
873
873
// Speed D: read/write
874
874
// The derivative constant for the speed regulation PID.
875
875
int speed_d () const { return get_attr_int (" speed_pid/Kd" ); }
876
- auto set_speed_d (int v) -> decltype(* this ) {
876
+ motor& set_speed_d (int v) {
877
877
set_attr_int (" speed_pid/Kd" , v);
878
878
return *this ;
879
879
}
@@ -889,7 +889,7 @@ class motor : protected device {
889
889
// Also, it determines the motors behavior when a run command completes. See
890
890
// `stop_actions` for a list of possible values.
891
891
std::string stop_action () const { return get_attr_string (" stop_action" ); }
892
- auto set_stop_action (std::string v) -> decltype(* this ) {
892
+ motor& set_stop_action (std::string v) {
893
893
set_attr_string (" stop_action" , v);
894
894
return *this ;
895
895
}
@@ -912,7 +912,7 @@ class motor : protected device {
912
912
// `run-timed` command. Reading returns the current value. Units are in
913
913
// milliseconds.
914
914
int time_sp () const { return get_attr_int (" time_sp" ); }
915
- auto set_time_sp (int v) -> decltype(* this ) {
915
+ motor& set_time_sp (int v) {
916
916
set_attr_int (" time_sp" , v);
917
917
return *this ;
918
918
}
@@ -1030,7 +1030,7 @@ class dc_motor : protected device {
1030
1030
// Sets the command for the motor. Possible values are `run-forever`, `run-timed` and
1031
1031
// `stop`. Not all commands may be supported, so be sure to check the contents
1032
1032
// of the `commands` attribute.
1033
- auto set_command (std::string v) -> decltype(* this ) {
1033
+ dc_motor& set_command (std::string v) {
1034
1034
set_attr_string (" command" , v);
1035
1035
return *this ;
1036
1036
}
@@ -1055,15 +1055,15 @@ class dc_motor : protected device {
1055
1055
// Valid values are -100 to 100 (-100% to 100%). Reading returns the current
1056
1056
// setpoint.
1057
1057
int duty_cycle_sp () const { return get_attr_int (" duty_cycle_sp" ); }
1058
- auto set_duty_cycle_sp (int v) -> decltype(* this ) {
1058
+ dc_motor& set_duty_cycle_sp (int v) {
1059
1059
set_attr_int (" duty_cycle_sp" , v);
1060
1060
return *this ;
1061
1061
}
1062
1062
1063
1063
// Polarity: read/write
1064
1064
// Sets the polarity of the motor. Valid values are `normal` and `inversed`.
1065
1065
std::string polarity () const { return get_attr_string (" polarity" ); }
1066
- auto set_polarity (std::string v) -> decltype(* this ) {
1066
+ dc_motor& set_polarity (std::string v) {
1067
1067
set_attr_string (" polarity" , v);
1068
1068
return *this ;
1069
1069
}
@@ -1072,7 +1072,7 @@ class dc_motor : protected device {
1072
1072
// Sets the time in milliseconds that it take the motor to ramp down from 100%
1073
1073
// to 0%. Valid values are 0 to 10000 (10 seconds). Default is 0.
1074
1074
int ramp_down_sp () const { return get_attr_int (" ramp_down_sp" ); }
1075
- auto set_ramp_down_sp (int v) -> decltype(* this ) {
1075
+ dc_motor& set_ramp_down_sp (int v) {
1076
1076
set_attr_int (" ramp_down_sp" , v);
1077
1077
return *this ;
1078
1078
}
@@ -1081,7 +1081,7 @@ class dc_motor : protected device {
1081
1081
// Sets the time in milliseconds that it take the motor to up ramp from 0% to
1082
1082
// 100%. Valid values are 0 to 10000 (10 seconds). Default is 0.
1083
1083
int ramp_up_sp () const { return get_attr_int (" ramp_up_sp" ); }
1084
- auto set_ramp_up_sp (int v) -> decltype(* this ) {
1084
+ dc_motor& set_ramp_up_sp (int v) {
1085
1085
set_attr_int (" ramp_up_sp" , v);
1086
1086
return *this ;
1087
1087
}
@@ -1096,7 +1096,7 @@ class dc_motor : protected device {
1096
1096
// Stop Action: write-only
1097
1097
// Sets the stop action that will be used when the motor stops. Read
1098
1098
// `stop_actions` to get the list of valid values.
1099
- auto set_stop_action (std::string v) -> decltype(* this ) {
1099
+ dc_motor& set_stop_action (std::string v) {
1100
1100
set_attr_string (" stop_action" , v);
1101
1101
return *this ;
1102
1102
}
@@ -1111,7 +1111,7 @@ class dc_motor : protected device {
1111
1111
// `run-timed` command. Reading returns the current value. Units are in
1112
1112
// milliseconds.
1113
1113
int time_sp () const { return get_attr_int (" time_sp" ); }
1114
- auto set_time_sp (int v) -> decltype(* this ) {
1114
+ dc_motor& set_time_sp (int v) {
1115
1115
set_attr_int (" time_sp" , v);
1116
1116
return *this ;
1117
1117
}
@@ -1171,7 +1171,7 @@ class servo_motor : protected device {
1171
1171
// Sets the command for the servo. Valid values are `run` and `float`. Setting
1172
1172
// to `run` will cause the servo to be driven to the position_sp set in the
1173
1173
// `position_sp` attribute. Setting to `float` will remove power from the motor.
1174
- auto set_command (std::string v) -> decltype(* this ) {
1174
+ servo_motor& set_command (std::string v) {
1175
1175
set_attr_string (" command" , v);
1176
1176
return *this ;
1177
1177
}
@@ -1187,7 +1187,7 @@ class servo_motor : protected device {
1187
1187
// Valid values are 2300 to 2700. You must write to the position_sp attribute for
1188
1188
// changes to this attribute to take effect.
1189
1189
int max_pulse_sp () const { return get_attr_int (" max_pulse_sp" ); }
1190
- auto set_max_pulse_sp (int v) -> decltype(* this ) {
1190
+ servo_motor& set_max_pulse_sp (int v) {
1191
1191
set_attr_int (" max_pulse_sp" , v);
1192
1192
return *this ;
1193
1193
}
@@ -1200,7 +1200,7 @@ class servo_motor : protected device {
1200
1200
// where the motor does not turn. You must write to the position_sp attribute for
1201
1201
// changes to this attribute to take effect.
1202
1202
int mid_pulse_sp () const { return get_attr_int (" mid_pulse_sp" ); }
1203
- auto set_mid_pulse_sp (int v) -> decltype(* this ) {
1203
+ servo_motor& set_mid_pulse_sp (int v) {
1204
1204
set_attr_int (" mid_pulse_sp" , v);
1205
1205
return *this ;
1206
1206
}
@@ -1211,7 +1211,7 @@ class servo_motor : protected device {
1211
1211
// is 600. Valid values are 300 to 700. You must write to the position_sp
1212
1212
// attribute for changes to this attribute to take effect.
1213
1213
int min_pulse_sp () const { return get_attr_int (" min_pulse_sp" ); }
1214
- auto set_min_pulse_sp (int v) -> decltype(* this ) {
1214
+ servo_motor& set_min_pulse_sp (int v) {
1215
1215
set_attr_int (" min_pulse_sp" , v);
1216
1216
return *this ;
1217
1217
}
@@ -1222,7 +1222,7 @@ class servo_motor : protected device {
1222
1222
// inversed. i.e `-100` will correspond to `max_pulse_sp`, and `100` will
1223
1223
// correspond to `min_pulse_sp`.
1224
1224
std::string polarity () const { return get_attr_string (" polarity" ); }
1225
- auto set_polarity (std::string v) -> decltype(* this ) {
1225
+ servo_motor& set_polarity (std::string v) {
1226
1226
set_attr_string (" polarity" , v);
1227
1227
return *this ;
1228
1228
}
@@ -1233,7 +1233,7 @@ class servo_motor : protected device {
1233
1233
// are -100 to 100 (-100% to 100%) where `-100` corresponds to `min_pulse_sp`,
1234
1234
// `0` corresponds to `mid_pulse_sp` and `100` corresponds to `max_pulse_sp`.
1235
1235
int position_sp () const { return get_attr_int (" position_sp" ); }
1236
- auto set_position_sp (int v) -> decltype(* this ) {
1236
+ servo_motor& set_position_sp (int v) {
1237
1237
set_attr_int (" position_sp" , v);
1238
1238
return *this ;
1239
1239
}
@@ -1246,7 +1246,7 @@ class servo_motor : protected device {
1246
1246
// case reading and writing will fail with `-EOPNOTSUPP`. In continuous rotation
1247
1247
// servos, this value will affect the rate_sp at which the speed ramps up or down.
1248
1248
int rate_sp () const { return get_attr_int (" rate_sp" ); }
1249
- auto set_rate_sp (int v) -> decltype(* this ) {
1249
+ servo_motor& set_rate_sp (int v) {
1250
1250
set_attr_int (" rate_sp" , v);
1251
1251
return *this ;
1252
1252
}
@@ -1283,7 +1283,7 @@ class led : protected device {
1283
1283
// Brightness: read/write
1284
1284
// Sets the brightness level. Possible values are from 0 to `max_brightness`.
1285
1285
int brightness () const { return get_attr_int (" brightness" ); }
1286
- auto set_brightness (int v) -> decltype(* this ) {
1286
+ led set_brightness (int v) {
1287
1287
set_attr_int (" brightness" , v);
1288
1288
return *this ;
1289
1289
}
@@ -1308,7 +1308,7 @@ class led : protected device {
1308
1308
// trigger. However, if you set the brightness value to 0 it will
1309
1309
// also disable the `timer` trigger.
1310
1310
std::string trigger () const { return get_attr_from_set (" trigger" ); }
1311
- auto set_trigger (std::string v) -> decltype(* this ) {
1311
+ led set_trigger (std::string v) {
1312
1312
set_attr_string (" trigger" , v);
1313
1313
return *this ;
1314
1314
}
@@ -1318,7 +1318,7 @@ class led : protected device {
1318
1318
// 0 and the current brightness setting. The `on` time can
1319
1319
// be specified via `delay_on` attribute in milliseconds.
1320
1320
int delay_on () const { return get_attr_int (" delay_on" ); }
1321
- auto set_delay_on (int v) -> decltype(* this ) {
1321
+ led set_delay_on (int v) {
1322
1322
set_attr_int (" delay_on" , v);
1323
1323
return *this ;
1324
1324
}
@@ -1328,7 +1328,7 @@ class led : protected device {
1328
1328
// 0 and the current brightness setting. The `off` time can
1329
1329
// be specified via `delay_off` attribute in milliseconds.
1330
1330
int delay_off () const { return get_attr_int (" delay_off" ); }
1331
- auto set_delay_off (int v) -> decltype(* this ) {
1331
+ led set_delay_off (int v) {
1332
1332
set_attr_int (" delay_off" , v);
1333
1333
return *this ;
1334
1334
}
@@ -1340,7 +1340,7 @@ class led : protected device {
1340
1340
}
1341
1341
1342
1342
// Sets the LED's brightness as a percentage (0-1) of the maximum.
1343
- auto set_brightness_pct (float v) -> decltype(* this ) {
1343
+ led set_brightness_pct (float v) {
1344
1344
return set_brightness (v * max_brightness ());
1345
1345
}
1346
1346
@@ -1640,7 +1640,7 @@ class lego_port : protected device {
1640
1640
// associated with the port will be removed new ones loaded, however this
1641
1641
// this will depend on the individual driver implementing this class.
1642
1642
std::string mode () const { return get_attr_string (" mode" ); }
1643
- auto set_mode (std::string v) -> decltype(* this ) {
1643
+ lego_port set_mode (std::string v) {
1644
1644
set_attr_string (" mode" , v);
1645
1645
return *this ;
1646
1646
}
@@ -1651,7 +1651,7 @@ class lego_port : protected device {
1651
1651
// example, since NXT/Analog sensors cannot be auto-detected, you must use
1652
1652
// this attribute to load the correct driver. Returns -EOPNOTSUPP if setting a
1653
1653
// device is not supported.
1654
- auto set_set_device (std::string v) -> decltype(* this ) {
1654
+ lego_port set_set_device (std::string v) {
1655
1655
set_attr_string (" set_device" , v);
1656
1656
return *this ;
1657
1657
}
0 commit comments