'My turtlebot3 isn't moving / struggling to code a node to control turtlebot3
there.
I'm a student who just started learning ros from 2 weeks ago.
I've cloned following gits and made the map through SLAM.
https://github.com/ROBOTIS-GIT/turtlebot3.git
https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
https://github.com/ros-planning/navigation.git
Controlling turtlebot to move with gui was easy but when it comes to code an action node to control turtlebot it didn't work well.
My task is to let it move to a point that I want. Here is my codes. Somehow when I run this code with rosrun server immediately answers that got new plan and goal reached at the same time without any moving.
If anyone could help me, it will be great.
#include <iostream>
#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <geometry_msgs/PoseStamped.h>
int main(int argc, char** argv)
{
ros::init(argc, argv, "MBclient");
actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> client("move_base",true);
client.waitForServer();
move_base_msgs::MoveBaseGoal goal;
goal.target_pose.header.frame_id = "map";
goal.target_pose.pose.position.x = 8.954;
goal.target_pose.pose.position.y = -9.919;
goal.target_pose.pose.position.z = 0.0;
goal.target_pose.pose.orientation.x = 0.0;
goal.target_pose.pose.orientation.y = 0.0;
goal.target_pose.pose.orientation.z = 1.0;
goal.target_pose.pose.orientation.w = 1.0;
client.sendGoal(goal);
return 0;
}
Solution 1:[1]
It's tough to give an answer without more details but are you waiting for the actions before exiting?
client.sendGoal(goal);
client.waitForResult();
return 0;
Solution 2:[2]
Degrading scipy into 1.6.2 can solve the problem.
In order to downgrade you need to do conda install scipy=1.6.2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sharvil Patankar |
| Solution 2 | zoldxk |
