ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

problem when publishing to /move_base/goal

asked 2019-02-25 07:48:21 -0500

arminkazim7 gravatar image

updated 2020-12-15 20:57:07 -0500

jayess gravatar image

When i run the following python code the robot will not move:

publisher = rospy.Publisher('/move_base/goal', MoveBaseActionGoal, queue_size=1,latch=True)
move_base_goal = MoveBaseGoal()

move_base_goal.target_pose.pose.position.x = 0.7

move_base_goal.target_pose.pose.orientation.w =1.0

move_base_goal.target_pose.header.frame_id = '/map' 

goal = MoveBaseActionGoal()

goal.goal = move_base_goal

publisher.publish(goal)

But publishing directly to the topic from cmd is working

rostopic pub  /move_base/goal move_base_msgs/MoveBaseActionGoal "header: 
  seq: 2
  stamp: 
    secs: 5727
    nsecs: 677000000
  frame_id: ''
goal_id: 
  stamp: 
    secs: 0
    nsecs:         0
  id: ''
goal: 
  target_pose: 
    header: 
      seq: 2
      stamp: 
        secs: 5727
        nsecs: 677000000
      frame_id: "map"
    pose: 
      position: 
        x: 1.73762495518
        y: -0.54209536314
        z: 0.0
w: 1.0ion:

Can somone explain what i am doing wrong?

edit retag flag offensive close merge delete

Comments

Can i see your full code please

hiep127 gravatar image hiep127  ( 2020-12-15 20:55:10 -0500 )edit

@hiep127 please don't post a comment as an answer

jayess gravatar image jayess  ( 2020-12-15 20:58:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-25 07:55:44 -0500

arminkazim7 gravatar image

I found out the solution it seems like it is necessary to have rospy.spin() in the file or the publish will not take place.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-02-25 07:48:21 -0500

Seen: 719 times

Last updated: Dec 15 '20