From 6d395c2bbe47c0efcdc908d0aef000d87883a617 Mon Sep 17 00:00:00 2001 From: "GLEN TURNER (8GT6)" <8gt6@queensu.ca> Date: Mon, 1 Jun 2015 11:50:07 -0400 Subject: [PATCH] Moved files around. ROS Display panel html is now back in the index file --- ProjectFiles/js/ros_scripts.js | 22 +++++++++-- README.md | 7 ++-- index.html | 67 ++++++++++++++++++++++++++++------ launch.bash~ | 14 +++++++ launch/all.launch | 2 +- launch/bagger.launch | 2 +- src/bagger.py | 0 7 files changed, 93 insertions(+), 21 deletions(-) create mode 100644 launch.bash~ mode change 100644 => 100755 src/bagger.py 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 @@ - - +