Client code
#!/usr/bin/env python from service_tutorial.srv import * import rospy import sys def concat_things_client(string1, string2, num1, num2): rospy.wait_for_service('concat_things') try: concat_things = rospy.ServiceProxy('concat_things', ConcatThings) resp = concat_things(string1, string2, num1, num2) return resp.result except rospy.ServiceException, e: print "Service call failed: %s" % e if __name__ == "__main__": if len(sys.argv) == 5: string1 = sys.argv[1] string2 = sys.argv[2] num1 = int(sys.argv[3]) num2 = int(sys.argv[4]) else: print "Please provide all args" sys.exit(1) print "Requesting service" print "%s" % concat_things_client(string1, string2, num1, num2)
/etc/hosts on the client
127.0.0.1 localhost comp1 127.0.1.1 guest 10.99.0.12 server # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.0.1 vultr.guest ::1 vultr.guest
/etc/hosts on the server
127.0.0.1 localhost server 127.0.1.1 guest 10.99.0.10 comp1 10.99.0.11 comp2 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
#!/usr/bin/env python from service_tutorial.srv import * import rospy import sys
Commands to debug
Are all the network ports necessary to communicate open?
On server – netcat -l 1234
: echo all things received from port 1234
On client – netcat server 1234
: send input to server through port 1234
Can I connect to ROS core through network?
Try running ROS commands, like rostopic
Am I even connected to the server?
ping server
Is the service available?
rossrv list
Is my environmental variables set to what I think they should be?
echo $ROS_MASTER_URI
or ${Environmental variable name}
What is my IP?
ifconfig
and check under wlan0 and wlan1.