Hello All, I am not sure how to implement the side request to my Move_BB8 function. I am thinking of that the side = move_square.linear.x * move time (displacement = velocity * time). But I am not positive toward my thought. Here is my code shown below without the implementation of side. Appreciate anyone who could help me out!
def Move_BB8(request) :
#repeat the robot movement for request.repetitions times i = 0 while i < request.repetitions : #move the robot in square j = 0 while j < 4: #(j=0,1,2,3) move_square.linear.x = 0.2 #go straight rate.sleep() move_square.linear.x = 0.0 #stop to attenuate the inertia effect rate.sleep() move_square.angular.z = 0.1 #make a turn rate.sleep() move_square.angular.z = 0.0 #stop to attenuate the inertia effect rate.sleep() my_pub.publish(move_square) rate.sleep() j+=1 i+=1 rospy.loginfo("Finished service move_bb8_in_square_custom") response = BB8CustomServiceMessageResponse() response.success = True return response