I am trying to do part III of ROS IN 5 DAYS project. I am unable to run the action server and service server simultaneously. I want to send the current total distance of the robot as feedback with the action server and simultaneously make the robot move using the service server. I also have been unable to send the result of the action server to the client. My client is shown below. Please how can I fix this?
#! /usr/bin/env python #Client import rospy import actionlib from geometry_msgs.msg import Twist from sensor_msgs.msg import LaserScan from nav_msgs.msg import Odometry from moveInSquare_srv.srv import MoveInSquare, MoveInSquareRequest from custom_action_pkg.msg import OdomRecordAction,OdomRecordFeedback,OdomRecordResult,OdomRecordGoal def feedback_callback(feedback): print('The total distance covered is '+str(feedback.current_total)) rospy.init_node("turtlebot3_node") action_server_name = '/record_odom' client = actionlib.SimpleActionClient(action_server_name, OdomRecordAction) # waits until the action server is up and running rospy.loginfo('Waiting for action Server '+action_server_name) client.wait_for_server() rospy.loginfo('Action Server Found...'+action_server_name) # creates a goal to send to the action server goal = OdomRecordGoal() client.send_goal(goal, feedback_cb=feedback_callback) rospy.wait_for_service('/move_bb8_in_square_custom') # Wait for the service rospy.loginfo("Service /move_bb8_in_square_custom Ready") turtle_service_client = rospy.ServiceProxy('/move_bb8_in_square_custom', MoveInSquare) # Create the connection to the service turtle_request_object = MoveInSquareRequest() # Create an object of type ExecTrajRequest result = turtle_service_client(turtle_request_object) # Send through the connection the path to the trajectory file to be executed client.cancel_goal() print(result) # Print the result type' client.wait_for_result() action_result = OdomRecordResult() rospy.loginfo("Odometer readings: "+str(action_result.list_of_odoms))