|
Developers
How to setup oculus for developmentAs a developer you have two options. Extend the source code from SVN, or hook into the command server. The benefit of the CommandServer is that you can get updates without having to merge your code. Also, because it is just a simple socket connection, you can use any language you prefer. So, C, ruby, python etc is all going to be supported this way. The last benefit is that you can connect to robot without logging into the web based control screens. Basic 'zombie mode' requires a valid user name and password, but you are not going to show up as a full fledged user in the web app controls. commands are available, but will be extended as there is need. To enable this feature, you must set: commandport 4444 in your Oculus/conf/oculus_settings.txt This will turn on the Command Server and take most of the PlayerCommands.
The Terminal can be launched from the command line, shell script or right from eclipse. You can use and valid user, pass word pair in plain text, or the hashed value. You can use telnet and then login with user:pass combo at the prompt. telnet 192.168.1.176 4444 Connected to 192.168.1.176. Escape character is '^]'. oculus version 438 ready for login. user:pass java -classpath "./webapps/oculus/WEB-INF/classes/" developer.terminal.Terminal 192.168.1.176 4444 brad password Or like this using the hashed password. java developer.terminal.Terminal 192.168.1.176 4444 brad +tVfDvTicIG5chk8ibFky34L63A8= & The parameters are, robot's local ip, port number, user name, hashed password. (find these in oculus/conf/oculus_settings.txt) This is available in plain text over TCP, but you client must first send user name and password first. As an example of how the TCP connections are sent updates, see below. We can chat with the logged in users and any TCP connections as well. All tcp commands will be seen in the web user's screens as chat text for now, so you''ll see the requests the clients are making. If you extend from AbstractTerminal, you can avoid dealing with just the State object and the out going stream object. The changes you make in these classes actually run on your workstation you code/test on, so no need to re-deploy and restart the server. Another reason for using the CommandServer is faster development.
An Example in screen capture below: Deploying class and java script filesIf you are coding directly in java, here is deployment script that will move your files over to the robot. The use of 'sudo' and 'chown' are required to make SMB shares behave. #!/bin/sh
LOCAL="/Users/brad/Documents/workspace/Oculus/webapps/oculus"
REMOTE="/Volumes/temp/oculus/webapps/oculus"
sudo rm -rf $REMOTE/*.html
sudo rm -rf $REMOTE/javascript
sudo rm -rf $REMOTE/WEB-INF/classes
sudo rm -rf $REMOTE/WEB-INF/src
#sudo rm -rf $REMOTE/flash
sudo cp $LOCAL/*.html $REMOTE/
sudo cp -r $LOCAL/javascript $REMOTE/
sudo cp -r $LOCAL/WEB-INF/classes $REMOTE/WEB-INF/classes/
sudo cp -r $LOCAL/WEB-INF/src $REMOTE/WEB-INF/
#sudo cp -r $LOCAL/flash $REMOTE/
sudo chown -R brad $REMOTE
dateSamba not working? Use curl or ftpIf running an FTP server on the robot, you can use this script to deploy your class files. This is useful if your robot is not on your LAN and you still need to update and restart the server. (note: this uses the same user, password pair for FTP and oculus terminal.) #!/bin/sh
# don't put your passwords in scripts
PASSWD=$1
HOST='192.168.1.176'
PORT='4444'
USER='brad'
function doFolder {
echo $1
for f in $1/*.class
do
curl -T "$f" ftp://$HOST/$1 --user $USER:$PASSWD --ftp-create-dirs
done
}
doFolder 'webapps/Oculus/WEB-INF/classes/oculus/'
doFolder 'webapps/Oculus/WEB-INF/classes/oculus/commport/'
doFolder 'webapps/Oculus/WEB-INF/classes/developer/'
doFolder 'webapps/Oculus/WEB-INF/classes/developer/terminal/'
doFolder 'webapps/Oculus/WEB-INF/classes/developer/sonar/'
doFolder 'webapps/Oculus/WEB-INF/classes/developer/ftp/'
# change if script file not in root
CLASSPATH='webapps/oculus/WEB-INF/classes/'
# reboot oculus
java -classpath $CLASSPATH developer.terminal.Terminal $HOST $PORT $USER $PASSWD restart byeNote that you can open a terminal session and then send a few commands. In this case, restart the server and then logout. This basically uploads the changes and gets the server back up.
| ||||||||||||||||||||||||||||||||||||