Adjusting cmd_vel linear.y value published by move_base
I have the following action-client code which I use to send a pose to move_base which inturn moves my robot model.
def move(self, goal):
rospy.loginfo(goal)
client_mb = actionlib.SimpleActionClient('move_base', MoveBaseAction)
client_mb.wait_for_server()
pose = Pose(Point(goal.x, goal.y, goal.z), Quaternion(0.000, 0.000, 0.0, 1.0))
# Set up the next goal location
self.goal = MoveBaseGoal()
self.goal.target_pose.pose = pose
self.goal.target_pose.header.frame_id = 'map'
self.goal.target_pose.header.stamp = rospy.Time.now()
# Let the user know where the robot is going next
rospy.loginfo("Going to: " + str(goal))
feedback_obj = TakePositionFeedback()
feedback_obj.report = 'Moving to: ' + str(goal.position)
self._as.publish_feedback(feedback_obj)
# Start the robot toward the next location
client_mb.send_goal(self.goal)
client_mb.wait_for_result()
The robot successfully moves to the specified destination.
But, I'm looking for a means of instructing the robot to move on the left or righ hand side of a corridor while travelling to the destination. The idea is to read the laser sensors on the right side of the robot, determin the distance to the wall and get the robot to drive parrallel to the wall maintaining a specified maximum distance. The same would apply to the left.
I can see data being published to /cmd_vel but I'm not sure how or if it's possible to preempt the linear.y value on the fly.
Any help please ?