Skip to content

Commit

Permalink
starting to form something
Browse files Browse the repository at this point in the history
  • Loading branch information
flynneva committed May 17, 2020
1 parent 515ff61 commit 6ce82ed
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/components/ROS.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useState } from 'react'
import React, { createContext, useState, useEffect } from 'react'
import ROSLIB from 'roslib'

const rosObj = {
Expand Down Expand Up @@ -32,14 +32,31 @@ function useROS(rosObj) {
console.log(e);
}
}

useEffect(() => {
handleConnect();
});

return rosObj;
}

// ROS Component to
function ROS(rosObj) {
const ros = useROS(rosObj);

var text = ""

if (ros.connected) {
console.log("HERE");
text = "connected"
} else {
console.log("HERE");
text ="not connected"
}

return (
<div>
ROS: {rosObj.url}
ROS: {text}
</div>
)
}
Expand Down

0 comments on commit 6ce82ed

Please sign in to comment.