You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect only one motor to the brick and try to send a program to drive a short distance.
robot@ev3dev:~$ python NEPOprog.py
Exception AttributeError: "'LargeMotor' object has no attribute '_path'" in <bound method LargeMotor.__del__ of <ev3dev.core.LargeMotor object at 0xb65f7d50>> ignored
Traceback (most recent call last):
File "NEPOprog.py", line 44, in <module>
main()
File "NEPOprog.py", line 33, in main
run()
File "NEPOprog.py", line 29, in run
hal.driveDistance('C', 'B', False, 'foreward', 30, 20)
File "/usr/lib/python2.7/dist-packages/roberta/ev3.py", line 353, in driveDistance
ml.run_to_rel_pos(speed_regulation_enabled='on',
AttributeError: 'NoneType' object has no attribute 'run_to_rel_pos'
NEPOprog.py:
#!/usr/bin/python
from __future__ import absolute_import
from roberta.ev3 import Hal
from roberta.BlocklyMethods import BlocklyMethods
from sets import Set
from ev3dev import ev3 as ev3dev
import math
TRUE = True
_brickConfiguration = {
'wheel-diameter': 5.6,
'track-width': 18.0,
'actors': {
'B':Hal.makeLargeMotor(ev3dev.OUTPUT_B, 'on', 'foreward', 'right'),
'C':Hal.makeLargeMotor(ev3dev.OUTPUT_C, 'on', 'foreward', 'left'),
},
'sensors': {
'1':Hal.makeTouchSensor(ev3dev.INPUT_1),
'2':Hal.makeGyroSensor(ev3dev.INPUT_2),
'3':Hal.makeColorSensor(ev3dev.INPUT_3),
'4':Hal.makeUltrasonicSensor(ev3dev.INPUT_4),
},
}
_usedSensors = Set([])
hal = Hal(_brickConfiguration, _usedSensors)
def run():
hal.driveDistance('C', 'B', False, 'foreward', 30, 20)
def main():
try:
run()
except Exception as e:
hal.drawText('Fehler im EV3', 0, 0)
hal.drawText(e.__class__.__name__, 0, 1)
if e.message:
hal.drawText(e.message, 0, 2)
hal.drawText('Press any key', 0, 4)
while not hal.isKeyPressed('any'): hal.waitFor(500)
raise
if __name__ == "__main__":
main()
The text was updated successfully, but these errors were encountered:
The issue is that we create brickconfiguration entries for also unused elements. Right now the factory methods there are non-fatal, that is in case of error they return None.
We want to only create the brickconfiguration for used elements and then fail if we can't create all of them.
In OpenRoberta/robertalab@d771049684fa6c3d8e4e3e4da9df3f3bfbd70607 I am unly instantiating sensors that are used.
also need to constrain this to actors
make actor / sensor instantiation failures fatal again
Connect only one motor to the brick and try to send a program to drive a short distance.
NEPOprog.py:
The text was updated successfully, but these errors were encountered: