Hi Rich,
1) The neck speed is controlled by the constant MAX_ABS_NECK_SPEED in
robot_controller.py. If you change that and then restart the web server or the Pi, then the neck speed will change. See my answer to question 3) though for a possible alternative.
2) I think that the config page settings won't take effect until you hit the 'Save' button in the bottom left (may be hard to see on a mobile or tablet). You can test that they've worked by setting the upper and lower bounds to the same value and hitting save, the neck should then hold in place.
3) You're correct that you just need to fiddle with the files in the
www folder and then restart the web server to change the web interface. Restarting the web interface can be done by running the following from the Pi command line
- Code: Select all
sudo service robot_web_server restart
Now, looking inside
index.html you should see that most communication with the robot is done using the websocket interface which consists of the socket object and socket.send command. Commands are just text strings, and there are 3 different commands you can send for the neck
- PanTilt joystickPosX joystickPosY (this is the command sent by the right stick)
- Centre (centres the neck to 90 degrees pan, 90 degrees tilt. Sent when you tap the right stick)
- SetNeckAngles panAngle tiltAngle (I added this for py_websockets_bot. You could use this to link a button to set neck directions)
Now, if you want to add a new command then you would need to modify the ConnectionHandler on_message routine in
robot_web_server.py. So for example, if you wanted to add a RunScript command you would add something like
- Code: Select all
socket.send( "RunScript SCRIPT_NAME" )
to index.html, and then in robot_web_server.py you'd add another elif clause
- Code: Select all
elif lineData[ 0 ] == "RunScript" and len( lineData ) >= 2: # Checks for command name and args
scriptName = lineData[ 1 ]
# Run the script (perhaps open and exec?)
All of this is a bit hacky at the moment I'm afraid, but hopefully it makes a bit of sense
. If I get the time then I'd like to add in something like the script running capabilities of
WebIOPi.
Regards
Alan