Ask Your Question

Issue for Moving base with leg tracker msgs

asked 2018-11-22 15:15:46 -0500

malav bateriwala gravatar image

updated 2018-11-22 18:23:48 -0500

I am trying to run my script to send pose to my move_base from msgs. But it runs the code and waits without throwing any error. My tracker is leg running is running and providing me a People_tracked msg of PeopleArray(Person[] people) Person (geometry_msgs/Pose pose uint32 id). Can't figure out the problem as there is no error.

 class move_base_goal:
   def __init__(self):
      self.goal_pose = PersonArray()

  self.new_person = Person()

  if not self.goal_pose.people:
         return move_base_goal()
  rospy.Subscriber("people_tracked", PersonArray, self.callback )

  def callback(self,msg):
    self.goal_pose.people[0].pose.position.x = msg.people[0].pose.position.x
    self.goal_pose.people[0].pose.position.y = msg.people[0].pose.position.y

  def movebase_goal(msg):   

    move = actionlib.SimpleActionClient('move_base',MoveBaseAction)

    goal = MoveBaseGoal()
    goal.target_pose.header.frame_id = "base_link"
    goal.target_pose.header.stamp =
    goal.target_pose.pose.position.x = self.goal_pose.people[0].pose.x
    goal.target_pose.pose.position.y = self.goal_pose.people[0].pose.y
    goal.target_pose.pose.orientation.w = 1.0


if __name__ == '__main__':

    x = move_base_goal()
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2018-11-23 04:28:07 -0500

Procópio gravatar image

updated 2018-11-23 04:29:09 -0500

You are not calling your movebase_goal method anywhere, so you are not sending the goal to move_base.

Besides that, if you send a new goal each time you have a people_tracked callback, you will be constantly cancelling/sending new goals, which would result in a very erratic behaviour.

For more info on that, check this question:

edit flag offensive delete link more

answered 2018-11-23 04:37:54 -0500

Victor Lopez gravatar image

There are several issues with your code, that if haven't failed yet, will fail when you execute it.

For instance the move_base_goal function requires the self argument, but you are not providing, and are providing an unused argument.

You have code within your class (call to init_node and Subscriber) that doesn't belong there, you should move it at least to your "main".

I suggest you go through the ROS tutorials again, you will find there tools to help you diagnose better what is happening.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-11-22 15:15:46 -0500

Seen: 145 times

Last updated: Nov 23 '18