Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_adc_gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
ADC
ADC_2021
iri_adc_gui
Commits
3a9d6bc2
Commit
3a9d6bc2
authored
3 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
Manage error when loading yaml file
parent
2c3523fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
html/index.html
+36
-17
36 additions, 17 deletions
html/index.html
with
36 additions
and
17 deletions
html/index.html
+
36
−
17
View file @
3a9d6bc2
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
<script
src=
"./js-yaml/dist/js-yaml.min.js"
></script>
<script
src=
"./js-yaml/dist/js-yaml.min.js"
></script>
<link
rel=
"stylesheet"
href=
"style.css"
>
<link
rel=
"stylesheet"
href=
"style.css"
>
<script>
<script>
document
.
title
=
"
ADC GUI
"
;
document
.
title
=
"
ADC GUI
"
;
...
@@ -91,7 +93,7 @@
...
@@ -91,7 +93,7 @@
action_goal
.
send
();
action_goal
.
send
();
document
.
getElementById
(
"
action_info
"
).
innerHTML
=
"
Goal sent. Expecting feedback...
"
;
document
.
getElementById
(
"
action_info
"
).
innerHTML
=
"
Goal sent. Expecting feedback...
"
;
document
.
getElementById
(
"
action_info
"
).
style
.
backgroundColor
=
'
white
'
;
document
.
getElementById
(
"
action_info
"
).
style
.
backgroundColor
=
'
yellow
'
;
feedback_watchdog_timer
();
feedback_watchdog_timer
();
//action_running=true; //true when received feedback?
//action_running=true; //true when received feedback?
...
@@ -286,28 +288,43 @@
...
@@ -286,28 +288,43 @@
}
}
},
2000
);
},
2000
);
}
}
function
load_goals_from_yaml
()
function
load_goals_from_yaml
()
{
{
goals_file
=
document
.
getElementById
(
"
goals_file
"
).
value
;
document
.
getElementById
(
"
goals_info
"
).
innerHTML
=
"
Loading file
"
;
var
goals_from_yaml
;
document
.
getElementById
(
"
goals_info
"
).
style
.
backgroundColor
=
'
yellow
'
;
goals_file
=
document
.
getElementById
(
"
goals_file
"
).
value
;
var
goals_from_yaml
;
$
.
get
(
goals_file
).
done
(
function
(
data
)
$
.
ajax
(
//$.get( goals_file, function( data )
{
goals_from_yaml
=
jsyaml
.
load
(
data
);
//TODO: check if loaded succesfully or not
//console.log("Loaded goals");
goal_array_msg
=
new
ROSLIB
.
Message
(
{
{
goals
:
goals_from_yaml
url
:
goals_file
,
});
success
:
function
(
result
)
{
goals_from_yaml
=
jsyaml
.
load
(
result
);
goals_loaded
=
true
;
goal_array_msg
=
new
ROSLIB
.
Message
(
{
goals
:
goals_from_yaml
});
});
goals_loaded
=
true
;
document
.
getElementById
(
"
goals_info
"
).
innerHTML
=
"
Loaded
"
;
document
.
getElementById
(
"
goals_info
"
).
style
.
backgroundColor
=
'
green
'
;
document
.
getElementById
(
'
startStop
'
).
disabled
=
false
;
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
//alert(xhr.status);
//alert(thrownError);
document
.
getElementById
(
"
goals_info
"
).
innerHTML
=
"
Error loading file
"
;
document
.
getElementById
(
"
goals_info
"
).
style
.
backgroundColor
=
'
red
'
;
document
.
getElementById
(
'
startStop
'
).
disabled
=
true
;
}
}
);
}
}
$
(
document
).
ready
$
(
document
).
ready
...
@@ -382,6 +399,8 @@
...
@@ -382,6 +399,8 @@
<input
type=
"text"
id=
"goals_file"
value=
"./data/goals0.yaml"
onchange=
"load_goals_from_yaml()"
/>
<input
type=
"text"
id=
"goals_file"
value=
"./data/goals0.yaml"
onchange=
"load_goals_from_yaml()"
/>
<br>
<br>
<span
id=
"goals_info"
>
&
nbsp
</span>
<br>
<!--<button class="btn btn-primary" id = "load_goals_button" onclick = "load_goals_from_yaml()">Load goals</button>-->
<!--<button class="btn btn-primary" id = "load_goals_button" onclick = "load_goals_from_yaml()">Load goals</button>-->
<hr>
<hr>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment