Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
behaviors-ai-public
LaVizu
Commits
89686464
Commit
89686464
authored
May 28, 2019
by
Dorian Goepp
Browse files
third tentative fix for line chart field and topic name
parent
b2dd2c1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/LineChart/RosLineChart.js
View file @
89686464
...
...
@@ -86,7 +86,8 @@ class RosLineChart extends Component {
* Extract a field from a ros message and add it to the state, for plotting.
*
* If there are already maxPoints in storage, we remove the oldest data point.
* @param {string} field path to the field to be extracted from incoming messages
* @param {Object} curve has two entries, `field`, path to the field to be extracted from incoming messages
* and `topic` the ROS topic from which we extract the field.
* @param {integer} maxPoints mupper limit on the number of data entries for the plot
* @param {Object} message messages from a ROS topic
*/
...
...
@@ -94,13 +95,14 @@ class RosLineChart extends Component {
this.setState((state) => {
let new_data = this.state.data;
const field = curve.field;
if (!(field in new_data)) {
new_data[field] = []
const data_field = curve.topic+field;
if (!(data_field in new_data)) {
new_data[data_field] = []
}
if (new_data[field].length >= maxPoints) {
new_data[field].shift();
if (new_data[
data_
field].length >= maxPoints) {
new_data[
data_
field].shift();
}
new_data[
curve.topic+
field] = this.state.data[
curve.topic+
field].concat([{"y": property(field)(message)}])
new_data[
data_
field] = this.state.data[
data_
field].concat([{"y": property(field)(message)}])
return {
data: new_data,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment