-
Notifications
You must be signed in to change notification settings - Fork 39
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
[cpp] NXT devices support #59
Comments
It looks like But there is no ev3 alternative to NXT sound sensor, and the NXT light sensor has different modes than EV3 color sensor. So may be it would be better to create new classes for the sensors? Edit: changed |
Also, I think it should be possible to use the sensors with the base |
NXT Sound: Works, but the driver_name shows up as 'nxt-analog'. Python access with generic sensor(). Also, modes reports 'ANALOG-0' and ANALOG-1'. This doesn't match the documentation. (same results with two different sound sensors) NXT Touch: Works, driver name 'lego-nxt-touch', Python access with generic sensor() and with touch_sensor() works. NXT Light: Works, driver name 'lego-nxt-light', Python access with generic sensor, both 'AMBIENT' and 'REFLECT' modes work. NXT Color: Not recognized by the system (doesn't show up in /sys/class/lego-sensor). |
The fine print explains why the sound sensor is detected as a generic analog sensor. You have to manually load the correct driver using the (And yes, we don't have a driver for the NXT color sensor yet) |
Ok - I missed the fine print. Thanks! |
@WasabiFan, since there are situations when a user needs access to |
Short answer: Yes, it should. My hope has been that we would finalize a full release with just sensors and motors (just the generics, no normalized classes for specific sensor types yet). Once we had released all of our bindings with the basics, I was planning on adding ports and specific sensor classes (the sensor classes would probably be best added using their own format within the spec that I haven't quite figured out yet). My thinking was this:
Does that seem reasonable? My feeling is that we are fairly close to being ready, and after that we can start to implement more features. |
Seems like a nice plan. So currently, in C++ one should be able to use |
@robojay, I have added a limited support for connecting generic device class to python bindings. For now the only supported filter is port name. This allows to use >>> from ev3dev import *
>>> d = device()
>>> d.connect('/sys/class/lego-port/', 'port', 'outA')
>>> d.connected
True
>>> d.set_attr_string('set_device', 'lego-nxt-sound')
>>> d.get_attr_string('status')
'no-motor' # Should be 'lego-nxt-sound' for you. After this, NXT sound sensor should work with python generic sensor. The updated egg is on pypi. |
@robojay , I've tried to add a native support for NXT sound and light sensors in 830fb07, ddemidov/ev3dev-lang-python@79844e3. You should be able to use The sound sensor tries to connect to a port with either Could you please test if the changes work as intended? |
I'll have a chance to test over the weekend and will let you know the results. Thanks! --Jay
|
I've moved the egg with nxt devices support under 'Experimental eggs' here. |
Both sound_sensor() and light_sensor() work with the corresponding NXT sensors. Just curious... attempting to set an invalid mode does not cause an exception. Would that be a good idea, or does it cause problems? Noticed this when I was testing out the different modes (and kept repeating a typo...). |
@robojay in #45 pointed out that NXT devices are not supported by C++ bindings. It turns out at least some of the devices may be used by piggy-backing the existing classes as it is done with ultrasonic sensor in #58. I am opening this issue to track the rest of the devices.
The text was updated successfully, but these errors were encountered: