-
Notifications
You must be signed in to change notification settings - Fork 145
Closed
Description
- ev3dev version: 4.4.68-20-ev3dev-ev3
One of my students ran into an issue where they set motor.run_forever for a large motor via a formula. Once the result reached 1050 they got a OSError: InvalidArgument. 1050 is the max_speed. I think the library should cap the input at 1050 (or the max_speed of the corresponding tacho-motor) or throw a ValueError instead.
The error message, in any way, is very cryptic considering how easy it is to trigger.
speed_R was set to something larger than the max_speed.
Traceback (most recent call last):
File "./braitenberg4b.py", line 26, in <module>
motor_R.run_forever(speed_sp = speed_R)
File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 793, in run_forever
setattr(self, key, kwargs[key])
File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 583, in speed_sp
self._speed_sp = self.set_attr_int(self._speed_sp, 'speed_sp', value)
File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 217, in set_attr_int
return self._set_attribute(attribute, name, str(int(value)))
File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 206, in _set_attribute
attribute.write(value.encode())
OSError: [Errno 22] Invalid argument
Metadata
Metadata
Assignees
Labels
No labels