0
$\begingroup$

Have a bunch of work in setting up a flask webserver to control a robot from an app, and I'm not too pleased with the results for driving. Touch sensitivity issues are driving me nuts, and looking to maybe try a slightly different route instead.

The flask server has a bunch of empty page web requests(my term) where it has a page for http://192.168.10.1/Forward and some python code to control the motor controller. When you go to that URL the code executes in the background and the car goes forward. Have all the URL's mapped to buttons in an app and it works till the screen thinks you let go which is constant and pretty aggrevating.

I've now setup a python script with EVDEV to find and search for joystick events which works. I thought I could use something like this on the event:

webbrowser.get('lynx').open('http://192.168.10.1/Forward')

And it would goto the url with Lynx...but sadly Lynx then wants you to hit Q to Quit then you can send another Joystick command. I guess there's a way to kill the process after each hit but that seems messy.

If there another way I might be able to do something like that without installing the GUI and does not involve having to figure out how to make two scripts talk to one another a different way all together?

Regards, Matt

$\endgroup$
0
$\begingroup$

If you're already in Python, use one of the URL libraries, such as urllib.request

On the commandline, you can use curl or wget.

When you go to that URL the code executes in the background and the car goes forward.

You shouldn't really be using GET requests where there is a side effect. https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

$\endgroup$
  • $\begingroup$ Thankyou! A bit new to programming, this did the trick. Didn't realize I could do it this way, opens a few new doors. $\endgroup$ – tarnis Mar 14 '18 at 2:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.