Hi,
I’ve tried looking for the solution online and browsing the actions document but I can’t seem to get the action service running by sending the goal through the terminal. Everythings compiled succesfully, and action is running alright, but when I send the goal it just spouts errors.
The custom interface:
# no goal/ request
---
geometry_msgs/msg/Point32[] list_of_odoms
---
float32 current_total
Compiling the package I get the warning that the goal is unused…
/home/user/ros2_ws/src/wall_follower_pkg/src/odomrecord_server.cpp: In member function 'rclcpp_action::GoalResponse OdomRecordActionServer::handle_goal(const GoalUUID&, std::shared_ptr<const custom_interfaces::action::OdomRecord_Goal_<std::allocator<void> > >)':
/home/user/ros2_ws/src/wall_follower_pkg/src/odomrecord_server.cpp:54:62: warning: unused parameter 'goal' [-Wunused-parameter]
54 | std::shared_ptr<const OdomRecord_Action::Goal> goal) {
so I’ve tried removing it and playing around with it but still couldn’t get it right:
private:
rclcpp_action::GoalResponse
handle_goal(const rclcpp_action::GoalUUID &uuid,
std::shared_ptr<const OdomRecord_Action::Goal> goal) {
// response to receiving goal
RCLCPP_INFO(this->get_logger(), "Received goal: Record Odometry");
(void)uuid;
return rclcpp_action::GoalResponse::ACCEPT_AND_EXECUTE;
}
and
private:
rclcpp_action::GoalResponse
handle_goal(const rclcpp_action::GoalUUID &uuid) {
// response to receiving goal
RCLCPP_INFO(this->get_logger(), "Received goal: Record Odometry");
(void)uuid;
return rclcpp_action::GoalResponse::ACCEPT_AND_EXECUTE;
}
I havent created a client yet because I want to test that this is working as I expected through the terminal first so I have sent the goal using:
ros2 action send_goal /record_odom custom_interfaces/action/OdomRecord
and
ros2 action send_goal /record_odom custom_interfaces/action/OdomRecord "{ }"
but it’s saying it AttributeError: 'ActionClient' object has no attribute '_client_handle'
. Does this mean i need to create the client and sending an empty goal through the terminal won’t work but through the client it will?
I’m not looking for the complete answer but can I get some hints for this part of the project please?
***EDIT: I found out you can use axclient to test the server? but I don’t find any methods for running this axclient stuff for ROS2 in the terminal. Are there no examples?
Many Thanks for the help,
William