Open JensHendar opened 9 years ago
Hi! And greetings from Reddit :smile:
I spent most of yesterday looking at this. I think the problem is related to continuation frames with WebSockets. I spent quite a while looking at the WebSocket RFC but got pretty lost. Then I figured I could try to implement a minimal webserver that only accepted POST requests, but that has the disadvantage of needing to use JSON-P to get around the same-site origin policy on the client end, and the server would need to negotiate a new TCP connection for every message, which seemed wasteful. It's also a lot different from my UDP version of the code.
I'm not sure what the best course of action now is. I think I might copy a more complete implementation of the WebSocket protocol into here, but that will probably increase the file size of pi_pcm.c
a lot.
In the meantime, the interactive_control.py
with Python and PyGame should be working. The pi_pcm
program just listens for JSON formatted messages over UDP, so you could copy some of the example code from the interactive control to see what the JSON messages look like, and then manually send your own messages.
I saw you mentioned on Reddit taking the RC car apart; for cheap vehicles, I think hacking the H-bridge is probably the easiest route.
I'll try to look at this more this week. Thanks for the detailed report though! It helped a lot in figuring out what was happening.
And greetings to you!
Thanks for taking the time to answer my question. I'll take a look at the interactive_control.py and see if I can't implement something that works. If I have any luck I'll post back here to help others.
Been trying to get a car running through the control.html-site, but getting all kinds of errors (see attached image). Sometimes it works, sometimes it doesn't. I am running the control.html-file using a Tornado web server and visiting the site using my Mac. Maybe there is something with the encoding?
My json looks like this: { "name": "Driftin Cars 27 mhz", "description": "Bought for 99 crowns at Teknikmagasinet. 27.145 mhz.", "frequency": 27.145, "synchronization_burst_us": 1200, "synchronization_spacing_us": 400, "total_synchronizations": 4, "signal_burst_us": 400, "signal_spacing_us": 400,
}