mvillalba / python-ant

[UNMAINTAINED, LOOK INTO THE FORKS] Python implementation of the ANT, ANT+, and ANT-FS protocols (http://www.thisisant.com/).
https://github.com/mvillalba/python-ant
MIT License
160 stars 131 forks source link

__init__.py and node.py missing. #8

Closed agcooke closed 13 years ago

agcooke commented 13 years ago

I am trying to run the demos and they do not work.

First problem is that the src/ant/ directory needs an init.py file to tell python its a module directory.

Then the node.py file is missing from src/ant/core directory. The import used in the demo files does not work. Can you try update the demos to see how the package works.

Good work so far and I hope I can use this for my project.

mvillalba commented 13 years ago

Yes, I'm terribly sorry about that. I was expecting a free weekend to work on it, but life had other plans. I'll probably do it over the next 2-3 days as time permits.

In the meantime, do tell me what ANT stick it is you are using; chances are you'll need a small driver (I'm using a USB1 model stick, which is the only one I've written one for).

agcooke commented 13 years ago

I use the http://www.sparkfun.com/products/8840, which comes up as FTDI device so you can access with serial communication. Does that differ at all from what you are doing? I have not had too much time to look into the tech behind these things, I was trying to see if I can get something read from the device, quickly and dirty...

The demos still dont work, the node.py file is still missing. Or maybe I am missing something? I took a look at all the branches.

The code looks like it has a lot of things that it can do, but there seems to be something missing from the repository.

mvillalba commented 13 years ago

Yes, I'm using PySerial to drive the stick, so it should work (baud rate adjustment not withstanding). It's just that the USB2 stick model uses a USB-to-serial interface not supported by the Linux kernel and thus needs a special libusb-based driver. However, I don't have one of those sticks to test against, so I didn't write one.

node.* is still missing, see #4 for details as they become available. However, if you checkout the feature/message branch, demos 5 and 6 do work (raw messages). That should give you what you need for quick & dirty I/O.

Do keep in mind I am yet to write tests for the individual message handlers, some of which are probably buggy; but the main Message and ChannelMessage classes work just fine.

I've also gone ahead and added another ticket for a log module, which should come in handy (#9).

The thing about node.* is that it heavily depends on "event" and "message", the former not existing at all. That is, I wouldn't expect node to be in the repos for a few days.

agcooke commented 13 years ago

Yeah I figured it work because its pure serial communication. I have run demos 05 and 06 (on features/message) and things get written but I do not see things getting read.

I will go read ANT docs to see which Messages I should write before reading. I am testing using a Garmin Velocity and Cadence sensor. It runs on Channel two. When using http://chomsky.shampoo.ca/goldenembed/ the data points get logged.

I want to build the USB system in parallel for testing and rapid development... but I have many other things to do at the moment so do not have too much time per day to delve into the technicalities of the ANT protocol right now. So if you can put in a raw message demo of all the messages that should me made to reset, set channel and listen to sensors that would be good. Otherwise I will go delve into docs to see if I can figure it out.

I just could not figure out how you ran those demos before the node.py class existed... or did you write the demos before being able to test them? Anyway thanks for the effort so far and I hope to get to use your system.

mvillalba commented 13 years ago

I wrote the demos before anything else existed so I wouldn't end up writing a dysfunctional API. It's partially modeled after my original hack-ish prototype.

I'll see what I can do about that demo.

agcooke commented 13 years ago

Ok that makes a load of sense now!

mvillalba commented 13 years ago

There, try demo 7.

Do note I have a combined speed & cadence sensor myself which has a slightly different ANT channel configuration than the standalone speed and cadence sensors. For the speed-only sensor set device_type to 123 and period to 8118; for the cadence-only sensor set device_type to 122 and period to 8102.

agcooke commented 13 years ago

Thanks for the demo 7. I ran it with my USB stick and tested with the Garmin 010-10644-00 GSC Speed Cadence sensor that we have and did not see any packets being received. I will try with a HRM soon to see if that works.

I will take a look into it again in a few weeks time. I will have to set time aside to take a more technical look into ANT+ and start debugging here, but at the moment there is too much other things going on in our project.

mvillalba commented 13 years ago

Yeah, that's pretty much the exact same device I have. Weird. Sounds either like a bad baudrate (stick says nothing).

A few weeks? Great, that way I'll have time to finish what's missing, :).

Martín.

agcooke commented 12 years ago

I finally got time to figure out why it was not working on our system usting the Sparkfun ANT+ stcik. You were correct and after reading the page on http://www.sparkfun.com/products/8840 I saw that the default Baud Rate is 4800 on the factory shipped devices. This can be changed with jumpers.

Once I changed the value of the Baudrate in the constructor and run the demo 07 I could read values from the USB stick and Garmin device.

Thanks for your great work!