diff --git a/html/data/goals0.yaml b/html/data/goals0.yaml deleted file mode 100644 index 430e070a9458069a580282070e5debbefd2bc45b..0000000000000000000000000000000000000000 --- a/html/data/goals0.yaml +++ /dev/null @@ -1,6 +0,0 @@ -goals: - - id: goal1a - x: 3.0 - y: -0.22 - yaw: 0.0 - type: 0 diff --git a/html/data/goals1.yaml b/html/data/goals1.yaml deleted file mode 100644 index bd145f2b69a269e818ab4ec08df28a37b25f97ba..0000000000000000000000000000000000000000 --- a/html/data/goals1.yaml +++ /dev/null @@ -1,24 +0,0 @@ -goals: - - id: goal1a - x: 3.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1b - x: 4.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1c - x: 6.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1d - x: 7.0 - y: -0.22 - yaw: 0.0 - type: 0 diff --git a/html/data/goals2.yaml b/html/data/goals2.yaml deleted file mode 100644 index bd145f2b69a269e818ab4ec08df28a37b25f97ba..0000000000000000000000000000000000000000 --- a/html/data/goals2.yaml +++ /dev/null @@ -1,24 +0,0 @@ -goals: - - id: goal1a - x: 3.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1b - x: 4.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1c - x: 6.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1d - x: 7.0 - y: -0.22 - yaw: 0.0 - type: 0 diff --git a/html/data/goals3.yaml b/html/data/goals3.yaml deleted file mode 100644 index bd145f2b69a269e818ab4ec08df28a37b25f97ba..0000000000000000000000000000000000000000 --- a/html/data/goals3.yaml +++ /dev/null @@ -1,24 +0,0 @@ -goals: - - id: goal1a - x: 3.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1b - x: 4.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1c - x: 6.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1d - x: 7.0 - y: -0.22 - yaw: 0.0 - type: 0 diff --git a/html/data/goals4.yaml b/html/data/goals4.yaml deleted file mode 100644 index bd145f2b69a269e818ab4ec08df28a37b25f97ba..0000000000000000000000000000000000000000 --- a/html/data/goals4.yaml +++ /dev/null @@ -1,24 +0,0 @@ -goals: - - id: goal1a - x: 3.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1b - x: 4.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1c - x: 6.0 - y: -0.22 - yaw: 0.0 - type: 0 - - - id: goal1d - x: 7.0 - y: -0.22 - yaw: 0.0 - type: 0 diff --git a/html/jury.html b/html/jury.html index 20eac0bd79b64aedab2126f6bc081788811abf42..d639438138d8f543d9212d3cbb6d985725715fc0 100644 --- a/html/jury.html +++ b/html/jury.html @@ -174,16 +174,25 @@ //rosbag_record_is_recording_subscriber.unsubscribe(); }); - var challenge_xodr_param = new ROSLIB.Param({ + // var challenge_xodr_param = new ROSLIB.Param({ + // ros : ros, + // name : '/iri_adc_gui_image_generator/xodr_file' + // }); + + var set_xodr_service_client = new ROSLIB.Service({ ros : ros, - name : '/iri_adc_gui_image_generator/xodr_file' + name : '/iri_adc_gui_image_generator/set_xodr', + serviceType : 'iri_adc_msgs/set_string' }); + var set_xodr_request = new ROSLIB.ServiceRequest({ + data: ""}); - + var goal_param = new ROSLIB.Param({ + ros : ros, + name : '/goals' + }); - - var adc_jury_service_client = new ROSLIB.Service({ ros : ros, name : '/jury/set_mode', @@ -252,22 +261,46 @@ challenge = document.getElementById("challenge_input").value; localStorage.setItem('challenge', challenge); challenge_param.set(challenge); - set_challenge_xodr_param(challenge); load_goals_from_yaml(); + set_challenge_xodr_param(challenge); } function set_challenge_xodr_param(challenge) { if(challenge==0) - challenge_xodr_param.set(ch0_xodr); + { + //challenge_xodr_param.set(ch0_xodr); + set_xodr_request.data=ch0_xodr; + } else if(challenge==1) - challenge_xodr_param.set(ch1_xodr); + { + //challenge_xodr_param.set(ch1_xodr); + set_xodr_request.data=ch1_xodr; + } else if(challenge==2) - challenge_xodr_param.set(ch2_xodr); + { + //challenge_xodr_param.set(ch2_xodr); + set_xodr_request.data=ch2_xodr; + } else if(challenge==3) - challenge_xodr_param.set(ch3_xodr); + { + //challenge_xodr_param.set(ch3_xodr); + set_xodr_request.data=ch3_xodr; + } else if(challenge==4) - challenge_xodr_param.set(ch4_xodr); + { + //challenge_xodr_param.set(ch4_xodr); + set_xodr_request.data=ch4_xodr; + } + + set_xodr_service_client.callService(set_xodr_request, + function(result) + { + }, + function(result) + { + console.error("ERROR: set_xodr service server returned error!!!"); + }); } function send_goal() @@ -288,6 +321,9 @@ document.getElementById("action_info").innerHTML = "Goal sent. Expecting feedback..."; document.getElementById("action_info").style.backgroundColor = 'yellow' ; + + document.getElementById('team_input').disabled=true; + document.getElementById('challenge_input').disabled=true; feedback_watchdog_timer(); //action_running=true; //set to true when received feedback @@ -330,6 +366,8 @@ action_running=false; clearTimeout(feedback_timer); add_feedback_line0("[GUI] FINISHED"); + document.getElementById('team_input').disabled=false; + document.getElementById('challenge_input').disabled=false; stop_rosbag_record(); save_feedback_file(); clearTimeout(iteration_timeout); @@ -430,9 +468,9 @@ } else { - document.getElementById("service_info").innerHTML = "ERROR: couldn't contact service server!!!"; + document.getElementById("service_info").innerHTML = "ERROR: couldn't contact jury_mode service server!!!"; document.getElementById("service_info").style.backgroundColor = 'red' ; - console.error("ERROR: couldn't contact service server!!!"); + console.error("ERROR: couldn't contact jury_mode service server!!!"); } } @@ -575,6 +613,7 @@ }); goals_loaded=true; + goal_param.set(goals_from_yaml.goals); document.getElementById("goals_info").innerHTML = "Loaded file: " + goals_file; document.getElementById("goals_info").style.backgroundColor = 'SeaGreen' ; document.getElementById('startStop').disabled=false; @@ -1088,6 +1127,15 @@ <!--<br>--> Challenge <input type="number" id="challenge_input" min="0" max="4" step="1" style="width: 2em" value="1" onchange="update_challenge()"> + <!-- + <select id="challenge_input2" name="challenge_input2"> + <option value="0">0</option> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + </select> + --> <br> Goals <span id="goals_info" > </span> </div> diff --git a/launch/link_goal_files.launch b/launch/link_goal_files.launch new file mode 100644 index 0000000000000000000000000000000000000000..67f7d3752e078e7809de8f181f23ab64499240f5 --- /dev/null +++ b/launch/link_goal_files.launch @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- --> +<launch> + + <node name="iri_adc_gui_link_goal_file0" pkg="iri_adc_gui" type="link_goal_files.sh" output="screen" + args="$(find iri_adc_launch)/data/adc/goals0.yaml $(find iri_adc_gui)/html/data/goals0.yaml"/> + + <node name="iri_adc_gui_link_goal_file1" pkg="iri_adc_gui" type="link_goal_files.sh" output="screen" + args="$(find iri_adc_launch)/data/challenge1/challenge1_goals.yaml $(find iri_adc_gui)/html/data/goals1.yaml"/> + + <node name="iri_adc_gui_link_goal_file2" pkg="iri_adc_gui" type="link_goal_files.sh" output="screen" + args="$(find iri_adc_launch)/data/challenge2/challenge2_goals.yaml $(find iri_adc_gui)/html/data/goals2.yaml"/> + + <node name="iri_adc_gui_link_goal_file3" pkg="iri_adc_gui" type="link_goal_files.sh" output="screen" + args="$(find iri_adc_launch)/data/challenge3/challenge3_goals.yaml $(find iri_adc_gui)/html/data/goals3.yaml"/> + + <node name="iri_adc_gui_link_goal_file4" pkg="iri_adc_gui" type="link_goal_files.sh" output="screen" + args="$(find iri_adc_launch)/data/challenge4/challenge4_goals.yaml $(find iri_adc_gui)/html/data/goals4.yaml"/> + +</launch> diff --git a/launch/test.launch b/launch/test.launch index 594f1926f05b04fcf9c4a1650e81c1a9395aa091..edd21bf2aec03e6db37c6ef9adad7cb26ab955cd 100644 --- a/launch/test.launch +++ b/launch/test.launch @@ -14,6 +14,8 @@ <!--<arg name="address" default="localhost"/>--> <arg name="address" default="$(optenv MASTER_IP localhost)"/> + + <node pkg="roswww" type="webserver.py" name="$(arg name)" @@ -23,7 +25,7 @@ --cached $(arg cached)"> </node> - <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"> + <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"> <arg name="port" value="$(arg rosbridge_port)" /> <arg name="address" value="$(arg address)" /> <arg name="ssl" value="false" /> @@ -34,10 +36,10 @@ <arg name="delay_between_messages" value="0" /> <arg name="max_message_size" value="None" /> <arg name="authenticate" value="false" /> - </include> + </include> - <node if="$(arg video_server)" + <node if="$(arg video_server)" name="web_video_server" pkg ="web_video_server" type="web_video_server"> @@ -45,7 +47,9 @@ <param name="port" value="$(arg videoserver_port)"/> <param name="server_threads" value="1"/> <param name="ros_threads" value="2"/> - </node> + </node> + + <include file="$(find iri_adc_gui)/launch/link_goal_files.launch"/> </launch> diff --git a/scripts/link_goal_files.sh b/scripts/link_goal_files.sh new file mode 100755 index 0000000000000000000000000000000000000000..f9532aba8526d24dff504fcb151e778cd1aea29b --- /dev/null +++ b/scripts/link_goal_files.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ -L "$2" ]; then + unlink "$2" +fi + +if [ -f "$1" ]; then + ln -s $1 $2 +else + echo -e "ERROR: the desired goal file does not exist" +fi + +# while true; do sleep 2; done +