Publishing to action server Attribute Error

I’m trying to publish goal values to an action server via a client.I keep on getting attribute errors. This is the line giving me issues.

agoal = MoveBaseActionGoal()
agoal.goal.target_pose.header.frame_id = 'map'

here is the message format.

std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
actionlib_msgs/GoalID goal_id
  time stamp
  string id
move_base_msgs/MoveBaseGoal goal
  geometry_msgs/PoseStamped target_pose
    std_msgs/Header header
      uint32 seq
      time stamp
      string frame_id
    geometry_msgs/Pose pose
      geometry_msgs/Point position
        float64 x
        float64 y
        float64 z
      geometry_msgs/Quaternion orientation
        float64 x
        float64 y
        float64 z
        float64 w

What am i doing wrong?

I am instantiating the wrong class.
agoal = MoveBaseActionGoal()
should be
agoal = MoveBaseGoal()

1 Like