No subject


Tue Sep 21 18:39:23 UTC 2010


Let me know and hope all is well,

Eitan

On Sat, Oct 9, 2010 at 5:26 PM, Dejan Pangercic
<dejan.pangercic at gmail.com>wrote:

> Hi there,
>
> I am using "move_base" SimpleActionClient and I have a problem that it
> sort of randomly fails (due to unstable/hallucinated percepts).
> Using below code I wanted to make it retry 5 times. It however does
> not do so (It was supposed to be retrying for 15 seconds each time, it
> however does so only in the first go). What am I doing wrong?
> CODE:
> void moveRobot(geometry_msgs::Pose goal_pose)
> {
>  int count =3D 0;
>  while (count < 5)
>    {
>      actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction>
> ac("move_base", 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;
>      goal.target_pose.header.frame_id =3D "/map";
>      goal.target_pose.header.stamp =3D ros::Time::now();
>
>      if (count =3D=3D 0)
>        goal.target_pose.pose =3D goal_pose;
>      else
>        {
>          goal_pose.orientation.z =3D  goal_pose.orientation.z + 0.01;
>          goal.target_pose.pose =3D goal_pose;
>        }
>      ROS_INFO("Sending goal");
>      ac.sendGoal(goal);
>      ac.waitForResult();
>
>      ROS_INFO("Pose Position x: %f, y:%f, z:%f Orientation x:%f,
> y:%f, z:%f, w:%f", goal.target_pose.pose.position.x,
>               goal.target_pose.pose.position.y,
> goal.target_pose.pose.position.z, goal.target_pose.pose.orientation.x,
>               goal.target_pose.pose.orientation.y,
> goal.target_pose.pose.orientation.z,
> goal.target_pose.pose.orientation.w);
>
>      actionlib::SimpleClientGoalState state =3D ac.getState();
>      if(state =3D=3D actionlib::SimpleClientGoalState::SUCCEEDED)
>        {
>          ROS_INFO("Robot has moved to the goal pose");
>          count =3D 10;
>        }
>      else
>        {
>          count++;
>          ROS_ERROR("Error in moving robot to goal pose: %s. Retrying
> %d time", state.toString().c_str(), count);
>          sleep(1);
>        }
>    }
>  if (count =3D=3D 5)
>    {
>      ROS_ERROR("Plan aborted, exiting!!!");
>      exit(1);
>    }
> }
>
>
> cheers, d.
>
> --
> MSc. Dejan Pangercic
> PhD Student/Researcher
> Intelligent Autonomous Systems Group
> Technische Universit=E4t M=FCnchen
> Telephone: +49 (89) 289-26908
> E-Mail: dejan.pangercic at cs.tum.edu
> WWW: http://ias.cs.tum.edu/people/pangercic
> _______________________________________________
> PR2-users mailing list
> PR2-users at lists.willowgarage.com
> http://lists.willowgarage.com/cgi-bin/mailman/listinfo/pr2-users
>

--001636498d0dff802904925f2e0f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Dejan,<div><br></div><div>I&#39;m not sure I quite understood the question.=
 Are you seeing the message &quot;Error in moving to goal pose...&quot; 5 t=
imes, just that the first time takes 15 seconds and the others happen back-=
to-back? If so, that may be a bug in move_base and I&#39;ll have a look. If=
 you&#39;re not seeing that message print 5 times then it could be a proble=
m in actionlib, which I can also look at. From glancing briefly at your cod=
e, I&#39;d expect things to work.</div>
<div><br></div><div>Let me know and hope all is well,</div><div><br></div><=
div>Eitan<br><br><div class=3D"gmail_quote">On Sat, Oct 9, 2010 at 5:26 PM,=
 Dejan Pangercic <span dir=3D"ltr">&lt;<a href=3D"mailto:dejan.pangercic at gm=
ail.com">dejan.pangercic at gmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;">Hi there,<br>
<br>
I am using &quot;move_base&quot; SimpleActionClient and I have a problem th=
at it<br>
sort of randomly fails (due to unstable/hallucinated percepts).<br>
Using below code I wanted to make it retry 5 times. It however does<br>
not do so (It was supposed to be retrying for 15 seconds each time, it<br>
however does so only in the first go). What am I doing wrong?<br>
CODE:<br>
void moveRobot(geometry_msgs::Pose goal_pose)<br>
{<br>
 =A0int count =3D 0;<br>
 =A0while (count &lt; 5)<br>
 =A0 =A0{<br>
 =A0 =A0 =A0actionlib::SimpleActionClient&lt;move_base_msgs::MoveBaseAction=
&gt;<br>
ac(&quot;move_base&quot;, true);<br>
<br>
 =A0 =A0 =A0//wait for the action server to come up<br>
 =A0 =A0 =A0while(!ac.waitForServer(ros::Duration(5.0)))<br>
 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0ROS_INFO(&quot;Waiting for the move_base action server =
to come up&quot;);<br>
 =A0 =A0 =A0 =A0}<br>
 =A0 =A0 =A0move_base_msgs::MoveBaseGoal goal;<br>
 =A0 =A0 =A0goal.target_pose.header.frame_id =3D &quot;/map&quot;;<br>
 =A0 =A0 =A0goal.target_pose.header.stamp =3D ros::Time::now();<br>
<br>
 =A0 =A0 =A0if (count =3D=3D 0)<br>
 =A0 =A0 =A0 =A0goal.target_pose.pose =3D goal_pose;<br>
 =A0 =A0 =A0else<br>
 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0goal_pose.orientation.z =3D =A0goal_pose.orientation.z =
+ 0.01;<br>
 =A0 =A0 =A0 =A0 =A0goal.target_pose.pose =3D goal_pose;<br>
 =A0 =A0 =A0 =A0}<br>
 =A0 =A0 =A0ROS_INFO(&quot;Sending goal&quot;);<br>
 =A0 =A0 =A0ac.sendGoal(goal);<br>
 =A0 =A0 =A0ac.waitForResult();<br>
<br>
 =A0 =A0 =A0ROS_INFO(&quot;Pose Position x: %f, y:%f, z:%f Orientation x:%f=
,<br>
y:%f, z:%f, w:%f&quot;, goal.target_pose.pose.position.x,<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goal.target_pose.pose.position.y,<br>
goal.target_pose.pose.position.z, goal.target_pose.pose.orientation.x,<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goal.target_pose.pose.orientation.y,<br>
goal.target_pose.pose.orientation.z,<br>
goal.target_pose.pose.orientation.w);<br>
<br>
 =A0 =A0 =A0actionlib::SimpleClientGoalState state =3D ac.getState();<br>
 =A0 =A0 =A0if(state =3D=3D actionlib::SimpleClientGoalState::SUCCEEDED)<br=
>
 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0ROS_INFO(&quot;Robot has moved to the goal pose&quot;);=
<br>
 =A0 =A0 =A0 =A0 =A0count =3D 10;<br>
 =A0 =A0 =A0 =A0}<br>
 =A0 =A0 =A0else<br>
 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0count++;<br>
 =A0 =A0 =A0 =A0 =A0ROS_ERROR(&quot;Error in moving robot to goal pose: %s.=
 Retrying<br>
%d time&quot;, state.toString().c_str(), count);<br>
 =A0 =A0 =A0 =A0 =A0sleep(1);<br>
 =A0 =A0 =A0 =A0}<br>
 =A0 =A0}<br>
 =A0if (count =3D=3D 5)<br>
 =A0 =A0{<br>
 =A0 =A0 =A0ROS_ERROR(&quot;Plan aborted, exiting!!!&quot;);<br>
 =A0 =A0 =A0exit(1);<br>
 =A0 =A0}<br>
}<br>
<br>
<br>
cheers, d.<br>
<br>
--<br>
MSc. Dejan Pangercic<br>
PhD Student/Researcher<br>
Intelligent Autonomous Systems Group<br>
Technische Universit=E4t M=FCnchen<br>
Telephone: +49 (89) 289-26908<br>
E-Mail: <a href=3D"mailto:dejan.pangercic at cs.tum.edu">dejan.pangercic at cs.tu=
m.edu</a><br>
WWW: <a href=3D"http://ias.cs.tum.edu/people/pangercic" target=3D"_blank">h=
ttp://ias.cs.tum.edu/people/pangercic</a><br>
_______________________________________________<br>
PR2-users mailing list<br>
<a href=3D"mailto:PR2-users at lists.willowgarage.com">PR2-users at lists.willowg=
arage.com</a><br>
<a href=3D"http://lists.willowgarage.com/cgi-bin/mailman/listinfo/pr2-users=
" target=3D"_blank">http://lists.willowgarage.com/cgi-bin/mailman/listinfo/=
pr2-users</a><br>
</blockquote></div><br></div>

--001636498d0dff802904925f2e0f--


More information about the ros-users mailing list