I've read how to read PHP POST/GET data and all that jazz with arduino Ethernet
To control a robot through a web GUI, I'd need the obvious 8 directional controls. Would the easiest be to just have a box where user (me) sets the timeout for each command?
For advanced control, I found this: http://blog.numfum.com/ And would like to use it.
That said, getting javascript data from the joystick, and pushing it "live" to a PHP query, not such a cakewalk.
I'm thinking to have the arduino's page iframed into a local page on my laptop, and use javascript to refresh that iframe with the joystick data in the GET query of the URL, every half-second.
urlbase = "http://192.168.1.133" // Arduino
url = urlbase + "?joyX=" + joyX + "&joyY=" + joyY;
document.getElementById("iframe").src = url;
Would this method work?
Robot will have Arduino Ethernet and Arduino Mega onboard, linked up by either I2C or TTL (haven't decided yet). Ethernet will handle control inputs, Mega will interpret the inputs and control the motors.
Ethernet will be wired to a router on the robot (which will also receive 2 IR day/night security IP cameras), which will have a high-gain directional antenna mounted to a servo platform. Using my phone to get coordinates, I'll enter my current control position into the robot's session memory, and using those coordinates + onboard GPS + compass, the servo will ensure the antenna is always aimed in my direction.
IE:
controlX: -97.111444
controlY: 32.722666
currX: -97.112238
currY: 32.722930
currHead: 38 degrees
vector_Dist: sqrt( sqrt( pow(2,(controlX - currX)) + pow(2,(controlY - currY)) ) //Assume, given Wifi range, to ignore longitude angular distortion
vector_angle: arctan( (controlX - currX) / (controlY - currY) ) // Assume, given Wifi range, to ignore longitude angular distortion
thus,
vector_Dist: sqrt ( pow(2, (-97.111444 - -97.112238) * 69.17) + pow(2, (32.722666 - 32.722930) * (69.17 * cos(currY))) ) = sqrt (pow(2, 0.000794 * 69.17) + pow(2, -0.0006634 * (69.17 * cos(32.722930))) = sqrt (pow(2, .05492098) + pow(2, -0.0006634 * 58.192) = sqrt (pow(2, .05492098) + pow(2, -.038605) = sqrt (3.016e-3 + 1.49e-3 ) = 0.067 miles * 5280 feet = 354 feet (GEarth says 262 feet)
vector_angle: arctan ( (-97.111444 - -97.112238) / (32.722666 - 32.722930) ) = arctan( 0.000794 / -0.0006634 ) = -50.12 degrees = 50 degrees east of south (GEarth says 111 heading = 70 EoS) = (180-50) = 130 degrees - 38 degree heading = antenna should point 92 degrees back of right on robot.
That will take some refining....
Calculate distance and bearing between two Latitude/Longitude points using haversine formula in JavaScript has the haversine distance formula, but heading seems way off...