thomasfla / Linux-ESPNOW

An attempt at implementing a direct link between a linux station and an ESP module using ESPNOW protocol for real time robot control
BSD 2-Clause "Simplified" License
178 stars 28 forks source link

Is this a valid tool? #3

Open ipsod opened 2 years ago

ipsod commented 2 years ago

Hi. I was considering using this and wondered whether you would recommend it? Development seems to have stopped a while ago - did you quit using the code for some reason?

mreditor97 commented 2 years ago

Hi, I found the code to work, and have used it to help me create communication between ESP devices and a host Raspberry Pi. It turns out it works quite well once the wireless configuration has been properly setup on the Pi.

I don't think there is any particular requirement to keep updating it as it works. Also this is the only method I found to enable ESP Now communication on non ESP based devices.

Hope this helps!

thomasfla commented 2 years ago

Hello, Indeed, the code is working well, even if not updated for some time. This can be seen as a proof of concept more than a polished library. BTW, this code has been integrated in a robotic project I'm involved in: https://github.com/open-dynamic-robot-initiative/master-board

Hope this helps, Thomas.

ipsod commented 2 years ago

@MrEditor97

Hi, I found the code to work, and have used it to help me create communication between ESP devices and a host Raspberry Pi. It turns out it works quite well once the wireless configuration has been properly setup on the Pi.

That's great. I would like to set it up on a Pi, as well. Do you have any tips for setting up the wireless, or should I find that in the docs?

@thomasfla

Ok, sounds good. I've been using serial to communicate with an ESP32, and using that to interface with ESP-NOW, and it would save quite a bit of trouble if I could just directly use ESP-NOW. I'll see if I can understand your code well enough to use it. I was looking over your simple example and on the surface it's confusing (ie: why does the receive callback call handler->send()? plus, I've never done cpp threading, so that's its own can of worms). I'll see if I can't understand it better by diving into the library.

Would you have any tips for setting it up to work with Python? I was thinking to use cppyy to load the code in Python, so that messages are received via a Python callback and sent via a Python function. I've only barely used cppyy (or c++ on the desktop at all), so I'm really just kind of feeling my way through the dark, but I already have a lot of my project built in Python, so I'm trying to stick with that. Not trying to be fancy with the cppyy thing - just found it to make development of small libraries much easier, since it lets me introspect and use c++ code and objects through Python - but nothing I've made is so complex as your library, so maybe it'd be best to let it run in its own executable and communicate through sockets, files, or maybe ZeroMQ?

thomasfla commented 2 years ago

why does the receive callback call handler->send()?

If I remember correctly, the basic example was a ping test, so it sends a message as soon as an incoming one is received.

Would you have any tips for setting it up to work with Python?

We have an implementation (specific to the robot control) that has been binded in python using boost python https://github.com/open-dynamic-robot-initiative/master-board/tree/master/sdk/master_board_sdk You can take inspiration from this, but be warned that you would have to clean a lot of things to remove all the layers we needed for our application. Also, this is not a very nice solution since you have to run your python interpreter as sudo to have the monitor mode access.

I fill that having a c++ executable communicating with your python scripts, as you describe, might be a simpler option.

Best, Thomas.

ipsod commented 2 years ago

Thank you for the info and advice.

nicklasb commented 1 year ago

Hi,

I am looking at this and is thinking that it would be such a blast if a generalized implementation was made. Then I could automate way more testing of my ESP32-code on Mac/Linux/Windows machines. However, it seems that there is kernel patching required, is this something that could be worked around or will that always be a deal breaker?

Cool project!

Kind regards, Nicklas