[actionlib] Problems when try to connect client <=> server
Hi Guys, since 2 day working with my code I found what is causing troubles. I cannot establish a working connection between a client and move_base server. Since my code is really huge I m going to report here just the interesting part which is a sintetic version of my code.
#include <actionlib/client/simple_action_client.h>
#include <actionlib/client/terminal_state.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <move_base_msgs/MoveBaseGoal.h>
//######################## ACTIONLIB #################################################
/* Here the function used to reach the and keep track of the goals */
typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;
/* Definitions of variables for the goal positions */
move_base_msgs::MoveBaseGoal goal_;
int main( int argc, char **argv ) {
ros::init( argc, argv, "pelican_driver" );
ros::NodeHandle nh;
ros::NodeHandle nh_private( "~" );
MoveBaseClient ac_( "move_base", true );
//######################## ACTIONLIB #################################################
/* The server connection for the actionlib must be checked for 60 [sec] before going on... */
ROS_INFO( "Checking the reply from the server..." );
if( ac_.isServerConnected() )
ROS_INFO( "Connected!" );
if( !ac_.isServerConnected( ) )
ROS_INFO( "Not connected" ); <= I GET ALL THE TIME "NOT CONNECTED"
ros::spin();
return 0;
}
2 Words more: my code works perfectly when I uncomment the line with waitForServer
and I play with the whole code since weeks. Uncommenting that line it stucks literally on the above line and doesn't work anymore. It stops the created classes (which have a timer inside to run some program at a given loop), resulting in the fatidic
[ WARN] [1412682893.011742911]: Waiting on transform from base_link to map to become available before running costmap, tf error: Could not find a connection between 'map' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.
(furthermore this is interesting for all the people looking for the reason they get that error. In my case the reason is quite simple: stucking at that point my code is not able to publish the transformation odom => base_link. So check this if you have to deal with).
Again: commenting that single line of code, my code works like a charm and all tf transformations/trees are identified as you can see in the following figure:
Since my code is really quite a copy of this tutorial, I cannot find any solution to get rid of this problem. In my launch file I start at first the driver of my robot (the code above honestly speaking), then the map_server and then the move_base
<launch>
<!-- Launch the driver of the robot -->
<include file="$(find quadrotor)/launch/robot_driver.launch" />
<!-- Launch map_server with a blank map -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find quadrotor)/maps/blank_map.yaml" />
<!-- Launch move_base and load all navigation parameters -->
<include file="$(find quadrotor)/launch/move_base.launch" />
<!-- Run a static transform between /odom and /map -->
<node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 /map /odom 100" />
</launch>
I ve tried to invert the order without success. What should I now do?