Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in Hitechnic EOPD sensor class #20

Closed
GoogleCodeExporter opened this issue Oct 10, 2015 · 5 comments
Closed

bug in Hitechnic EOPD sensor class #20

GoogleCodeExporter opened this issue Oct 10, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Attempt to instantiate nxt.sensor.hitechnic.EOPD:
     import nxt
     from nxt import sensor
     from nxt.sensor import hitechnic

     brick = nxt.find_one_brick()
     laser = hitechnic.EOPD(brick, sensor.PORT_3)

What is the expected output? What do you see instead?
An EOPD object should be created; instead, the following exception is raised:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "nxt/sensor/hitechnic.py", line 245, in __init__
    super(Light, self).__init__(brick, port)
NameError: global name 'Light' is not defined


What version of nxt-python are you using? On what operating system?
I'm using nxt-python version 2.0.1 on Ubuntu 10.10 64-bit. I also tested the 
latest source code from the Subversion repo (revision 273), with the same 
result.

Original issue reported on code.google.com by jerradge...@gmail.com on 22 Jan 2011 at 11:25

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Oh crap. This is embarrassing. Here's a patch to fix it (applicable to the 
trunk or stable v2.0.1). Let me know if it works, and whether the values 
returned are correct. It would also be nice if you could test switching between 
ranges.

This problem was due to lack of being able to actually test some of the sensors 
due to lack of hardware. If you have any other sensors marked as untested in 
the docstrings, it would be cool if you could make sure they work with 
nxt-python. Thanks!

Original comment by marcus@wanners.net on 23 Jan 2011 at 12:01

  • Changed state: Accepted
  • Added labels: Component-Sensors, OpSys-All, Series-2.x, Usability

Attachments:

@GoogleCodeExporter
Copy link
Author

The patch works, however, you forgot to import the math module(you're calling 
sqrt in EOPD.get_processed_value). After fixing this, the EOPD class works 
without raising exceptions - I don't think the values it's returning are 
correct, though I'm not sure what the units of measurement are for this sensor. 
I'll work some on this later to help fix it. I'll also test the other Hitechnic 
sensors that I have.

Thanks for writing nxt-python, and don't worry about bugs in code you can't 
test - I'm glad I can program my NXT in Python. You might want to try out 
Pylint sometime. I think it would have caught these bugs.   

Original comment by jerradge...@gmail.com on 23 Jan 2011 at 12:27

@GoogleCodeExporter
Copy link
Author

Thank you. I'll be releasing a bugfix version once all the bugs in the sensors 
you have are ironed out. This is really helpful!

I'll look at pylint when I get some spare time. As I've told some other people, 
I'm currently rushing to get IPv6 up on my servers and home network before all 
the tunnel brokers are clogged with new accounts and it becomes hard to test 
things. Hurricane Electric is currently estimating 10 days to IPv4 exhaustion. 
What a nice birthday surprise.

Original comment by marcus@wanners.net on 23 Jan 2011 at 12:34

@GoogleCodeExporter
Copy link
Author

Fixed in r275.

Original comment by marcus@wanners.net on 23 Jan 2011 at 1:18

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant