Problem with navigation move_base [closed]
Hello, I have a problem with navigation in rviz. I have a model P3dx, I want to set goal on the map and my model have to move to this point. I am newbie in ROS, and tutorials don't hel me :/
I use Ubuntu 18.04 and ROS Melodic
I describe, what I done.
- I done a map thanks gmapping. I have my map in .yaml and png.
- Run the map -
rosrun map_server map_server src/PioneerModel/map.yaml
- I Open rviz and load the map on topic
/map
- Open node move_base and amcl
rosrun move_base move_base / rosrun amcl amcl
After open amcl I got a warning:
[ WARN] [1557425810.906842985, 3433.961000000]: No laser scan received (and thus no pose updates have been published) for 3433.961000 seconds. Verify that data is being published on the /scan topic.
In rviz I can't load laserscan - error:
Transform [sender=unknown_publisher]
For frame [lms100]: No transform to fixed frame [map]. TF error: [Lookup would require extrapolation into the future. Requested time 4097.345000000 but the latest data is at time 2376.773000000, when looking up transform from frame [lms100] to frame [map]]
I tried to open my navigation node:
#include <ros/ros.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <actionlib/client/simple_action_client.h>
typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;
int main(int argc, char **argv)
{
ros::init(argc, argv, "navigation_goals");
MoveBaseClient ac("move_base", true);
while (!ac.waitForServer(ros::Duration(5.0)))
{
ROS_INFO("Waiting for the move_base action server");
}
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 = 9.8;
goal.target_pose.pose.position.y = -16.8;
goal.target_pose.pose.orientation.w = 1.0;
ROS_INFO("Sending goal: base");
ac.sendGoal(goal);
ac.waitForResult();
if (ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("You have arrived to the charging base");
else
{
ROS_INFO("The base failed for some reason");
}
return 0;
}
But I only have Waiting for the move_base action server
I know, that better is use launch file, but now, I want to move my model, next I will be "cleaning".
I Think that error is from load map.yaml on topic /map, but my knowledge about ROS is low and I can't handle with it :/
Thanks in advance!
#EDIT
I had wrong topic send to amcl, so now, amcl node is correct and I have answer:
[ INFO] [1557695476.070436657]: Requesting the map...
[ INFO] [1557695476.079127924]: Received a 312 X 536 map @ 0.050 m/pix
[ INFO] [1557695476.099264435]: Initializing likelihood field model; this can take some time on large maps...
[ INFO] [1557695476.181160845]: Done initializing likelihood field model.
topic tf:
Type: tf2_msgs/TFMessage
Publishers:
* /gazebo (http://pawel-X550LC:44491/)
* /robot_state_publisher (http://pawel-X550LC:42323/)
* /amcl (http://pawel-X550LC:34617/)
* /slam_gmapping (http://pawel-X550LC:40877/)
Subscribers:
* /rviz_1557694756783817626 (http://pawel-X550LC:44329/)
* /amcl (http://pawel-X550LC:34617/)
* /slam_gmapping (http://pawel-X550LC:40877/)
* /move_base_node (http://pawel-X550LC:44079/)
* /rviz_1557695649952641928 (http://pawel-X550LC:45149/)
scan:
Type: sensor_msgs/LaserScan
Publishers:
* /gazebo (http://pawel-X550LC:44491/)
Subscribers:
* /rostopic_11205_1557695085155 (http://pawel-X550LC:34697/)
* /amcl (http://pawel-X550LC:34617/)
* /slam_gmapping (http://pawel-X550LC:40877/)
* /rviz_1557695649952641928 ...
movebase action server will not start until movebase has received a laser scan (among other things). So you need to address the laser scan problem first.
http://wiki.ros.org/amcl
Check those topics and make sure they all have data being sent to them
Sory for late answear, but I don't have access to my project in the weekend. I edited my post, I understand that amcl node was looking for in wrong topic and I correct this.
Tyrel - I checked this topics, and they are subscribers.
Now, I have in rviz my static map( but have wrong orientaion), I can see laser scan, but when I run my navigation node, I still have Waiting for the move_base action server
anyone know how the quarterion/orientation in send goal navigation code works?