Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 398

Robot rotates around a point instead of navigating to Goal Position when working with amcl

$
0
0
Hello, I have a custom robot with 2 wheels, a camera, and a laser rangefinder. I am trying to localize the robot using amcl. I had everything set up. When rviz was launched I would define the initial 2D pose estimate and the used to define the 2d Nav Goal in RViz as well. However, I implemented a basic node to publish to the topic so that I could have the robot move to the goal directly. When I run that node, RViz displays the correct path to the goal. But the robot starts moving forward and after a while (usually around the same spot) it starts to rotate around a single point for some reason. I am not sure why that's the case. It works fine when I try to run it via RViz but not via the node. The code I am working with for the node - #include #include #include #include typedef actionlib::SimpleActionClient MoveBaseClient; int main(int argc, char** argv) { ros::init(argc, argv, node_name); // create the action client // true causes the client to spin its own thread MoveBaseClient ac("move_base", true); // Wait 60 seconds for the action server to become available ROS_INFO("Waiting for the move_base action server"); ac.waitForServer(ros::Duration(5)); ROS_INFO("Connected to move base server"); // Send a goal to move_base move_base_msgs::MoveBaseGoal goal; goal.target_pose.header.frame_id = "map"; goal.target_pose.header.stamp = ros::Time::now(); goal.target_pose.pose.position.x = 0.995; goal.target_pose.pose.position.y = -2.996; goal.target_pose.pose.orientation.w = 1; ac.sendGoal(goal); // Wait for the action to return ac.waitForResult(); if (ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) ROS_INFO("You have reached the goal!"); else ROS_INFO("The base failed for some reason"); return 0; } I run the above using `rosrun package_name node_name` This is what it looks like right now. The robot started to rotate instead of following the green path. ![image description](/upfiles/15106129894124305.png)

Viewing all articles
Browse latest Browse all 398

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>