Problem with execise 4.4

Hi I wrote the class sendgoalsclass as follow

#! /usr/bin/env python

import rospy

import actionlib

from move_base_msgs.msg import MoveBaseAction, MoveBaseActionGoal, MoveBaseActionFeedback, MoveBaseActionResult

class SendGoalsClient(object):

def __init__(self):

    self.send_goal_client = actionlib.SimpleActionClient(

        "/move_base", MoveBaseAction)

    rospy.loginfo("Waiting for /move_base Action Server")


    rospy.loginfo("connected with /move_base Action Server") = MoveBaseActionGoal()

def feedback_callback(self, feedback):

    rospy.loginfo("I am in feedback_callback function...")

def send(self, msg):

    rospy.loginfo("I am in send function...")


        msg, feedback_cb=self.feedback_callback)

if name == “main”:


rospy.loginfo("creating send_goals_node")

send_goals_obj = SendGoalsClient() = "map"

while True:

    rospy.loginfo("I am in the while...") = 2 = 1


    """ = 4 = 2

    send_goals_obj.send( = 5 = 3





user:~$ rosmsg info move_base_msgs/MoveBaseActionGoal

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


I execute
launch roslaunch husky_navigation move_base_demo.launch
and after I running rosrun send_goals I get this error

user:~$ rosrun send_goals
[INFO] [1646573889.597408, 0.000000]: creating send_goals_node
[INFO] [1646573889.613600, 181.635000]: Waiting for /move_base Action Server
[INFO] [1646573889.849724, 181.871000]: connected with /move_base Action Server[INFO] [1646573889.851347, 181.872000]: I am in the while…
[INFO] [1646573889.852715, 181.874000]: I am in send function…Traceback (most recent call last):
File “/home/user/catkin_ws/src/send_goals/src/scripts/”, line 37, in
File “/home/user/catkin_ws/src/send_goals/src/scripts/”, line 22, in send
File “/opt/ros/noetic/lib/python3/dist-packages/actionlib/”, line 92, in send_goal = self.action_client.send_goal(goal, self._handle_transition, self._handle_feedback)
File “/opt/ros/noetic/lib/python3/dist-packages/actionlib/”, line 561, in send_goal
return self.manager.init_goal(goal, transition_cb, feedback_cb)
File “/opt/ros/noetic/lib/python3/dist-packages/actionlib/”, line 466, in init_goal
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/”, line 882, in publish
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/”, line 1066, in publish
serialize_message(b, self.seq, message)
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/”, line 152, in serialize_message
File “/opt/ros/noetic/lib/python3/dist-packages/move_base_msgs/msg/”, line 147, in serialize
buff.write(_get_struct_3I().pack(_x.goal.target_pose.header.seq, _x.goal.target_pose.header.stamp.secs, _x.goal.target_pose.header.stamp.nsecs))
AttributeError: ‘MoveBaseActionGoal’ object has no attribute 'target_pose’

I am trying to do the debug but I have not found the error yet
thanks for any suggestions


I think instead of these:

you should write these:

from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal = MoveBaseGoal()

because MoveBaseActionGoal is the type of the topic related to this action, not the message you are using here.

1 Like

Hi hag,
thanks I resoved

This topic was automatically closed after 21 hours. New replies are no longer allowed.