Skip to content

issues with the new apis (compared to boost bindings) #64

@ensonic

Description

@ensonic

= Button =

Nov 05 12:30:28 ev3dev openrobertalab.py[716]: File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
Nov 05 12:30:28 ev3dev openrobertalab.py[716]: self.run()
Nov 05 12:30:28 ev3dev openrobertalab.py[716]: File "/usr/bin/openrobertalab.py", line 111, in run
Nov 05 12:30:28 ev3dev openrobertalab.py[716]: if self.service.hal.isKeyPressed('back'):
Nov 05 12:30:28 ev3dev openrobertalab.py[716]: File "/usr/lib/python2.7/dist-packages/roberta/ev3.py", line 140, in isKeyPressed
Nov 05 12:30:28 ev3dev openrobertalab.py[716]: return getattr(self.key, key).pressed
Nov 05 12:30:28 ev3dev openrobertalab.py[716]: AttributeError: type object 'Button' has no attribute 'back'

Button.back vs. Button.backspace
I renamed this for now

Nov 05 12:34:03 ev3dev openrobertalab.py[742]: File "/tmp/NEPOprog.py", line 44, in <module>
Nov 05 12:34:03 ev3dev openrobertalab.py[742]: main()
Nov 05 12:34:03 ev3dev openrobertalab.py[742]: File "/tmp/NEPOprog.py", line 40, in main
Nov 05 12:34:03 ev3dev openrobertalab.py[742]: while not hal.isKeyPressed('any'): hal.waitFor(500)
Nov 05 12:34:03 ev3dev openrobertalab.py[742]: File "/usr/lib/python2.7/dist-packages/roberta/ev3.py", line 127, in isKeyPressed
Nov 05 12:34:03 ev3dev openrobertalab.py[742]: if getattr(self.key, key).pressed:
Nov 05 12:34:03 ev3dev openrobertalab.py[742]: AttributeError: 'property' object has no attribute 'pressed'

Button.pressed vs. Button.check_buttons ?
but that'd be repeating the name, since what else should be checked in a Button class.
Same issues with 'buttons_pressed' property on subclasses.

Also why is Buttons.any a property?

Nov 05 13:11:28 ev3dev openrobertalab.py[887]: Traceback (most recent call last):
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: self.run()
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: File "/usr/bin/openrobertalab.py", line 111, in run
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: if self.service.hal.isKeyPressed('back'):
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: File "/usr/lib/python2.7/dist-packages/roberta/ev3.py", line 134, in isKeyPressed
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: return self.keys.check_buttons([key])
Nov 05 13:11:28 ev3dev openrobertalab.py[887]: TypeError: unbound method check_buttons() must be called with Button instance as first argument (got list instance instead)

ev3dev.button became ev3dev.Buttons

= Sound =
since this changed from sync (system) to async.
tone(a,b) becomes tone(a,b).wait()

= Motors =
.state is always []

I expect this to work (works with the boost bindings)

m=ev3dev.LargeMotor(ev3dev.OUTPUT_B)
m.run_to_rel_pos(speed_regulation_enabled='on', position_sp=1000)
while (m.state):
  print m.state

If you change while(m.state) to while(True), it prints [] even though the motor is running.

= Sensors =
.value() return 0

I expect this to work (works with the boost bindings)

s = ev3dev.TouchSensor(ev3dev.INPUT_1)
s.value()

Whether I hold the touch sensor button pressed ot not, it returns 0. Or another one:

s = ev3dev.UltrasonicSensor(ev3dev.INPUT_4)
while(True):
  print s.value()
  time.sleep(0.5)

This prints a static value (191) for me. If instead for any of the sensors I do:

watch -n0.1 cat /sys/class/lego-sensor/sensor*/value0

I see the values changing.

At this point I wonder how you verify the bindings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions