Skip to content

Parameters support #7

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ catkin_python_setup()

add_service_files(
FILES
Scan.srv
GetROSModel.srv
GetROSSystemModel.srv
)

generate_messages()
Expand All @@ -18,10 +19,6 @@ catkin_package(
CATKIN_DEPENDS message_runtime
)

install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

catkin_install_python(PROGRAMS scripts/ros_node
scripts/print_snapshot
scripts/java_snapshot
Expand Down
30 changes: 14 additions & 16 deletions scripts/ros_node
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@ import rospy
class RosGraphNode():

def __init__(self):
rospy.Service('scan_ros_graph', rg_srv.Scan, self.create_snapshot)

def create_snapshot(self, request):
answer = rg_srv.ScanResponse()
answer.success, answer.message, answer.rosgraph = self._create_snapshot()
rospy.Service('get_ros_model', rg_srv.GetROSModel,
self.get_ros_model)

rospy.Service('get_rossystem_model', rg_srv.GetROSSystemModel,
self.get_rossystem_model)

def get_ros_model(self, request):
answer = rg_srv.GetROSModelResponse()
answer.success, answer.message, answer.model = rg.create_java_ros_model()
return answer

def _create_snapshot(self):
try:
snapshot = rg.create_ros_graph_snapshot()
dump = dict()
dump['nodes']=dict()
for node in snapshot:
dump['nodes'][node.name] = node.dump_yaml()
return True, "Scanning Succeeded", str(dump)
except:
return False, "Scanning Failed", ""
def get_rossystem_model(self, request):
answer = rg_srv.GetROSSystemModelResponse()
answer.success, answer.message, answer.model = rg.create_java_system_model()
return answer


if __name__ == "__main__":
rospy.init_node("ros_graph_parser_node")
RosGraphNode()
rospy.spin()
rospy.spin()
Loading