-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Food on Fork Integration with Web App #76
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cf58078
made changes to be able to subscribe to Float messages
atharva-kashyap 37bd348
[IP] Is able to listen to the FoF topic
atharva-kashyap 1907c7a
formatted
atharva-kashyap df98000
[IP] Bite Transfer FoF integrated (with immediate motion)
atharva-kashyap 0b11338
[IP] minor change
atharva-kashyap 5d6ea87
[IP] added a call back function
atharva-kashyap 959e863
Merge remote-tracking branch 'origin/main' into atharvak/food-on-fork
atharva-kashyap 3efbd45
added window
atharva-kashyap 213f8f3
added window for FoF in in-front of face
atharva-kashyap 8a77faa
FoF has been added everywhere
atharva-kashyap 6ce30ba
made minor changes
atharva-kashyap 84a80db
Merge remote-tracking branch 'origin/main' into atharvak/food-on-fork
atharva-kashyap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
// React imports | ||
import React, { useState } from 'react' | ||
// Component | ||
import PropTypes from 'prop-types' | ||
|
||
// Local imports | ||
import { useROS, subscribeToROSTopic } from './ros_helpers' | ||
|
@@ -8,7 +10,10 @@ import { useROS, subscribeToROSTopic } from './ros_helpers' | |
* The TestROSSubscribe component demonstrates the functionality of subscribing | ||
* to a ROS topic. | ||
*/ | ||
function TestROSSubscribe() { | ||
function TestROSSubscribe(props) { | ||
// get the value of props | ||
let topicType = props.topicType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good generalization of this component! |
||
|
||
// The defaults to use on this page | ||
let defaultTopicName = 'test_topic' | ||
|
||
|
@@ -21,7 +26,7 @@ function TestROSSubscribe() { | |
let [recvData, setRecvData] = useState('No message received yet.') | ||
|
||
// Callback function for when the user clicks the "Subscribe" button | ||
function subscribeTopic(event) { | ||
function subscribeTopic(event, topicType) { | ||
// Prevent the browser from reloading the page | ||
event.preventDefault() | ||
|
||
|
@@ -34,7 +39,7 @@ function TestROSSubscribe() { | |
} | ||
|
||
// Subscribe to the topic | ||
subscribeToROSTopic(ros, topicName, 'std_msgs/String', callback) | ||
subscribeToROSTopic(ros, topicName, topicType, callback) | ||
} | ||
|
||
// Render the component | ||
|
@@ -43,8 +48,8 @@ function TestROSSubscribe() { | |
{/** | ||
* Allow users to subscribe to a topic and display its data | ||
*/} | ||
<h4>Subscribe to a 'std_msgs/String' Topic and Display Its Data:</h4> | ||
<form method='post' onSubmit={subscribeTopic}> | ||
<h4>Subscribe to a '{topicType}' Topic and Display Its Data:</h4> | ||
<form method='post' onSubmit={(e) => subscribeTopic(e, topicType)}> | ||
Topic Name: <input type='text' name='topicName' defaultValue={defaultTopicName} /> | ||
<button type='submit'>Subscribe</button> | ||
<br /> | ||
|
@@ -55,5 +60,8 @@ function TestROSSubscribe() { | |
</div> | ||
) | ||
} | ||
TestROSSubscribe.propTypes = { | ||
topicType: PropTypes.string.isRequired | ||
} | ||
|
||
export default TestROSSubscribe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return function gets called before useEffect gets called again. Why should we wait until them before checking whether the probability is in the range? This check should be in the subscriber's callback function.