<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Thanks.
I did try to create a client inside the server. For some reason I thought
it didn’t work. But maybe I messed something up. I think it would
hang when I called tempclient.waitForServer().<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Vijay: I
don’t want the server to be active on a null goal. I do want a
goal. I want to provide the goal from inside the client. This is to
simplify testing and debugging. <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>This is the
pattern I am looking for:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>void MyActionServer::goalCallback()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
// accept goal from client<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
goal_ = *server_.acceptNewGoal();<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
this->performAction(goal_);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>void MyActionServer::triggerGoalInternallyCallback()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
// create a goal for internal testing<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
MyActionServerGoal tempGoal;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
tempGoal.foo = “bar”;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
this->performAction(tempGoal);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>However, I have
no performAction() method. And because the service routine uses a timer,
and relies on the server being active, it is not so easy to split out.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>So, ideally,
I would have this:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>void MyActionServer::triggerGoalInternallyCallback()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>{<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
// create a goal for internal testing<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
MyActionServerGoal tempGoal;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
tempGoal.foo = “bar”;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>
this->server_->setGoal(tempGoal);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Which would
then trigger the MyActionServer::goalCallback().<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
ros-users-bounces@code.ros.org [mailto:ros-users-bounces@code.ros.org] <b>On
Behalf Of </b>Vijay Pradeep<br>
<b>Sent:</b> Monday, October 18, 2010 1:21 PM<br>
<b>To:</b> User discussions<br>
<b>Subject:</b> Re: [ros-users] trigger goal from inside actionlib server<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>Hi Ben,<br>
<br>
If this is what you want to do, I would go with Blaise's suggestion and send a
goal using the action client with no callbacks registered.<br>
<br>
However, I'm not really sure why you would want to have the SimpleActionServer
be active on null goal. Understanding your use case would help us get a
feel for exactly what functionality you need.<br>
<br>
Vijay<o:p></o:p></p>
<div>
<p class=MsoNormal>On Mon, Oct 18, 2010 at 9:44 AM, Blaise Gassend <<a
href="mailto:blaise@willowgarage.com">blaise@willowgarage.com</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal>Hi Ben,<o:p></o:p></p>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
On Mon, Oct 18, 2010 at 9:06 AM, Axelrod, Benjamin <<a
href="mailto:baxelrod@irobot.com">baxelrod@irobot.com</a>> wrote:<br>
> I have an actionlib server and I would like to be able to trigger its own<br>
> goal. I don’t need any callbacks for goal accepted, feedback,
or even<br>
> result. I just want to manually set the server to be active.
Is this<br>
> possible? I can’t figure out a way to do this.<o:p></o:p></p>
</div>
<p class=MsoNormal>Why don't you use a SimpleActionClient to set the goal? If
you don't<br>
specify the callbacks when setting you call sendGoal, those callbacks<br>
default to being null. Is that not what you want?<br>
<br>
<a
href="http://www.ros.org/doc/api/actionlib/html/classactionlib_1_1SimpleActionClient.html#ae6a2e6904495e7c20c59e96af0d86801"
target="_blank">http://www.ros.org/doc/api/actionlib/html/classactionlib_1_1SimpleActionClient.html#ae6a2e6904495e7c20c59e96af0d86801</a><o:p></o:p></p>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
> It might be nice if actionlib::SimpleActionServer::acceptNewGoal()
was<br>
> overloaded to accept a goal parameter. That would set the server
active,<br>
> but with NULL callbacks.<o:p></o:p></p>
</div>
<p class=MsoNormal>Is there a strong reason for wanting to do this without
explicitly<br>
having a client?<br>
<br>
Blaise<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><o:p></o:p></p>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br clear=all>
<br>
-- <br>
Vijay Pradeep<br>
Systems Engineer<br>
Willow Garage, Inc.<br>
<a href="mailto:vpradeep@willowgarage.com" target="_blank">vpradeep@willowgarage.com</a><o:p></o:p></p>
</div>
</body>
</html>