diff --git a/ProjectFiles/js/ros_scripts.js b/ProjectFiles/js/ros_scripts.js index 7cb83b4..6b5c08b 100644 --- a/ProjectFiles/js/ros_scripts.js +++ b/ProjectFiles/js/ros_scripts.js @@ -1,8 +1,11 @@ var ros = new ROSLIB.Ros(); +ros.topics = []; +ros.nodes = []; + ros.connectioninfo = ['ws://', '192', '168', '0', '100', '9090']; // ros.connectionName = 'ws://localhost:9090'; - ros.connectionName = 'ws://192.168.0.100:9090'; +ros.connectionName = 'ws://192.168.0.100:9090'; // If there is an error on the backend, an 'error' emit will be emitted. ros.on('error', function(error) { document.getElementById("ConnectionIPForm").className = "form-group has-warning has-feedback"; @@ -10,6 +13,7 @@ ros.on('error', function(error) { document.getElementById("ConnectionIPLabel").innerHTML = 'No connection'; document.getElementById("ConnectionButton").className = "btn btn-warning" document.getElementById("rosbridgeconnection_badge").innerHTML = 'No connection'; + document.getElementById("ROSNodes").innerHTML = ""; rosbridgeconnection_badge console.log(error);192 @@ -24,10 +28,20 @@ ros.on('connection', function() { document.getElementById("ConnectionButton").className = "btn btn-success" + ros.nodes = []; + ros.topics = []; + }); ros.on('close', function() { console.log('Connection closed.'); + + document.getElementById("ConnectionIPForm").className = "form-group has-warning has-feedback"; + document.getElementById("ConnectionIPLabel").innerHTML = 'Connection closed'; + document.getElementById("ConnectionButton").className = "btn btn-warning" + document.getElementById("rosbridgeconnection_badge").innerHTML = 'Connection closed'; + ros.nodes = []; + ros.topics = []; }); // Create a connection to the rosbridge WebSocket server. ros.connect(ros.connectionName); @@ -59,11 +73,12 @@ function getTopics() { var request = new ROSLIB.ServiceRequest(); + // ros.topics = []; topicsClient.callService(request, function(result) { ros.topics = result.topics; }); - return ros.topics + return ros.topics; }; function getNodes() { @@ -76,11 +91,12 @@ function getNodes() { var request = new ROSLIB.ServiceRequest(); + // ros.nodes = []; topicsClient.callService(request, function(result) { ros.nodes = result.nodes; }); - return ros.nodes + return ros.nodes; }; function getTime() { diff --git a/README.md b/README.md index e8b2de8..1c95953 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ The purpose of this project is an example of how to write a web page that can be ### Quick Start Guide -This guide is for after you have completed the setup requirements If you are connecting to a remote computer that is running the roscore, you need to run the following lines in the terminal: @@ -20,10 +19,10 @@ Then run the bash file in the working directory by running the following in the Feel free to clone this project and use it as a base for your own GUI. -There is a file called "RobotDisplyPanel.html" that is pasted into the "Robot Display Panel" on the web page. This is where you should put in all your HTML for what you want to display. +You can easily customise the "Robot Display" pannel by changing the HTML "index.html" file. -All ROS related Javascript should go in the "/include/js/ros_scripts.js" file. -All functions that are used to update the GUI should go in the "update_guis.js" file +All ROS related Javascript should go in the "ProjectFiles/js/ros_scripts.js" file. +All functions that are used to update the GUI should go in the "ProjectFiles/js/update_guis.js" file diff --git a/index.html b/index.html index 572f3d8..ab3ff5b 100644 --- a/index.html +++ b/index.html @@ -17,12 +17,6 @@ - - @@ -35,15 +29,18 @@ - - +
-
+

Example GUI

@@ -64,12 +61,59 @@
- - + + + + + + +
+ +
+ ROS Bag +
+
+
+ +
+
+ +
+ +
+ +
+ Example Pannel Heading +
+ + +
+
+ +
+
+ No data recieved yet.
+
+
+
+ +
+ +
+ N/A +
+
+
+ + +
@@ -129,6 +173,5 @@
- diff --git a/launch.bash~ b/launch.bash~ new file mode 100644 index 0000000..be2010a --- /dev/null +++ b/launch.bash~ @@ -0,0 +1,14 @@ +#!/bin/bash + +trap 'killall' INT + +killall() { + trap '' INT TERM # ignore INT and TERM while shutting down + echo "**** Shutting down... ****" # added double quotes + kill -TERM 0 # fixed order, send TERM not INT +# wait + echo DONE +} +roslaunch rosbridge_GUI_example all.launch & +python -m SimpleHTTPServer 8000 + diff --git a/launch/all.launch b/launch/all.launch index 61547ea..fd379e5 100644 --- a/launch/all.launch +++ b/launch/all.launch @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/launch/bagger.launch b/launch/bagger.launch index ff76710..c2207ba 100644 --- a/launch/bagger.launch +++ b/launch/bagger.launch @@ -1,3 +1,3 @@ -# + diff --git a/src/bagger.py b/src/bagger.py old mode 100644 new mode 100755