Skip to content

Instantly share code, notes, and snippets.

@bayodesegun
Last active August 11, 2018 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayodesegun/341e53cbc7771345c556197d806315cb to your computer and use it in GitHub Desktop.
Save bayodesegun/341e53cbc7771345c556197d806315cb to your computer and use it in GitHub Desktop.
A sample ROS Service (Server)
#! /usr/bin/env python
# remember to make this file executable (`chmod +x`) before trying to run it
import rospy
from std_srvs.srv import Trigger, TriggerResponse
def trigger_response(request):
return TriggerResponse(
success=True,
message="Hey, roger that; we'll be right there!"
)
rospy.init_node('sos_service')
my_service = rospy.Service('/fake_911', Trigger, trigger_response)
rospy.spin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment