Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #20 from vortexntnu/use-mcu-heartbeat
Browse files Browse the repository at this point in the history
Use mcu heartbeat
  • Loading branch information
petterhs authored Jan 23, 2019
2 parents 3df246d + 5c61245 commit a725c43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BROWSER=none
REACT_APP_ROSBRIDGE_URL=ws://10.42.0.191:9090
REACT_APP_ROSBRIDGE_URL=ws://10.42.0.174:9090
//REACT_APP_ROSBRIDGE_URL=ws://localhost:9090
12 changes: 6 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ class App extends Component {
ros.on('close', () => {
console.log('Connection to websocket server closed.');
this.setState({isConnectedToRosbridge: false});
this.reconnectionTimer = setTimeout(() => this.connectToRosbridge(), 500);
this.reconnectionTimer = setTimeout(() => this.connectToRosbridge(), 1400);
});

const isRovAliveTopic = new ROSLIB.Topic({
ros: ros,
name: '/is_alive',
messageType: 'std_msgs/Empty'
name: '/mcu_heartbeat',
messageType: 'std_msgs/String'
});
this.refreshAliveTimeout();
isRovAliveTopic.subscribe(this.stillAlive);
};

refreshAliveTimeout = () => {
clearTimeout(this.aliveTimeout);
this.aliveTimeout = setTimeout(this.die, 1000);
this.aliveTimeout = setTimeout(this.die, 1400);
};

stillAlive = () => {
Expand All @@ -72,9 +72,9 @@ class App extends Component {
};

die = () => {
const connectedToRov = this.state.isConnectedToRov;
const isConnectedToRov = this.state.isConnectedToRov;

if(connectedToRov) {
if(isConnectedToRov) {
this.setState({isConnectedToRov: false});
}
};
Expand Down

0 comments on commit a725c43

Please sign in to comment.