-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import rospy | ||
from avatar_locomanipulation.srv import * | ||
|
||
def add_two_ints_client(x, y): | ||
rospy.wait_for_service('add_two_ints') | ||
try: | ||
add_two_ints = rospy.ServiceProxy('add_two_ints', AddTwoInts) | ||
resp1 = add_two_ints(x, y) | ||
return resp1.sum | ||
except rospy.ServiceException, e: | ||
print "Service call failed: %s"%e | ||
|
||
def usage(): | ||
return "%s [x y]"%sys.argv[0] | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) == 3: | ||
x = int(sys.argv[1]) | ||
y = int(sys.argv[2]) | ||
else: | ||
print usage() | ||
sys.exit(1) | ||
print "Requesting %s+%s"%(x, y) | ||
print "%s + %s = %s"%(x, y, add_two_ints_client(x, y)) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python | ||
|
||
from avatar_locomanipulation.srv import * | ||
import rospy | ||
|
||
def handle_add_two_ints(req): | ||
print "Returning [%s + %s = %s]"%(req.a, req.b, (req.a + req.b)) | ||
return AddTwoIntsResponse(req.a + req.b) | ||
|
||
def add_two_ints_server(): | ||
rospy.init_node('add_two_ints_server') | ||
s = rospy.Service('add_two_ints', AddTwoInts, handle_add_two_ints) | ||
print "Ready to add two ints." | ||
rospy.spin() | ||
|
||
if __name__ == "__main__": | ||
add_two_ints_server() |
28 changes: 28 additions & 0 deletions
28
src/python_src/locomanipulation_feasibility_classifier_service.py
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
|
||
from avatar_locomanipulation.srv import * | ||
import rospy | ||
|
||
import numpy as np | ||
import tensorflow as tf | ||
|
||
class LocomanipulationFeasibilityClassifier: | ||
def __init__(self): | ||
self.x = [] | ||
|
||
def perform_binary_classification(self, req): | ||
print "Input Vector:", np.array(req.x) | ||
res = BinaryClassifierQueryResponse() | ||
res.y = 0.75 | ||
print "Returning:", res.y | ||
return res | ||
|
||
def start_classifier_server(self): | ||
rospy.init_node('locomanipulation_feasibility_classifier_server') | ||
s = rospy.Service('locomanipulation_feasibility_classifier', BinaryClassifierQuery, self.perform_binary_classification) | ||
print "Locomanipulation Feasibility Classifier Server Started." | ||
rospy.spin() | ||
|
||
if __name__ == "__main__": | ||
classifier = LocomanipulationFeasibilityClassifier() | ||
classifier.start_classifier_server() |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int64 a | ||
int64 b | ||
--- | ||
int64 sum |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
float64[] x | ||
--- | ||
float64 y |