Ask Your Question
0

Husky A200 and simple navigation goal

asked 2015-07-20 10:59:04 -0500

rohit.ros gravatar image

Hello ,

I am a student pursuing master's degree.My mentor wants me to configure clearpath husky for indoor and outdoor navigation using ROS. I am fairly new to ROS. I read about packages topics nodes etc. Now i am trying this code below to make an action client which lead my robot to move 1 meter.

#include <ros/ros.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <actionlib/client/simple_action_client.h>
#include <queue>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <stdlib.h>

 typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;

 int main(int argc, char** argv){
   ros::init(argc, argv, "simple_navigation_goals");

   //tell the action client that we want to spin a thread by default
   MoveBaseClient ac("/move_base/cmd_vel", true);

   //wait for the action server to come up
   while(!ac.waitForServer(ros::Duration(5.0))){
     ROS_INFO("Waiting for the move_base action server to come up");
   }

   move_base_msgs::MoveBaseGoal goal;

   //we'll send a goal to the robot to move 1 meter forward
   goal.target_pose.header.frame_id = "base_link";
   goal.target_pose.header.stamp = ros::Time::now();

   goal.target_pose.pose.position.x = 1.0;
   goal.target_pose.pose.orientation.w = 1.0;

   ROS_INFO("Sending goal");
   ac.sendGoal(goal);

   ac.waitForResult();

   if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
     ROS_INFO("Hooray, the base moved 1 meter forward");
   else
     ROS_INFO("The base failed to move forward 1 meter for some reason");

   return 0;
}

But i am not able to move it. It wait for action server response and stuck on that. Any help ?

As far as i read for indoor localization i need to use SLAM and gmapping lauch files and for outdoor locatlization i need to convert x y to GPS. Any help in that matter will be appreciated as well.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-21 00:55:11 -0500

mgruhler gravatar image

You are waiting for the action server /move_base/cmd_vel. If you haven't reconfigured move_base somehow, the right action server name would be /move_base (see the move_base documentation, as well as the actionlib documentation on how to use the action interface.

For indoor localization, SLAM or gmapping is only required if you want to create a map. If you already have a map, you can also use amcl in combination with the map_server.

edit flag offensive delete link more

Comments

yes i changed it to /cmd_vel and it is start working. For the SLAM part i am trying to make a map but haven't figured it out. So i am trying this tutorial :-http://wiki.ros.org/husky_navigation/Tutorials/Husky%20Gmapping%20Demo and i see laser scan on rviz but couldn'tmove my husky using joystick.

rohit.ros gravatar imagerohit.ros ( 2015-07-21 12:09:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-20 10:59:04 -0500

Seen: 396 times

Last updated: Jul 21 '15