Skip to content
Snippets Groups Projects
Commit 0a35c496 authored by cs-99's avatar cs-99
Browse files

No commit message

No commit message
parent adb353ba
Branches
No related tags found
No related merge requests found
......@@ -145,6 +145,7 @@ include_directories(
# add_executable(${PROJECT_NAME}_node src/actionlib_example_node.cpp)
add_executable(${PROJECT_NAME}_garage_server src/garage_server.cpp)
add_executable(${PROJECT_NAME}_garage_client src/garage_client.cpp)
add_executable(${PROJECT_NAME}_tron_adapter src/tron_adapter.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
......@@ -163,6 +164,9 @@ target_link_libraries(
target_link_libraries(
${PROJECT_NAME}_garage_client ${catkin_LIBRARIES}
)
target_link_libraries(
${PROJECT_NAME}_tron_adapter ${catkin_LIBRARIES}
)
#############
## Install ##
......
bool open #goal
---
bool open #result
int32 position
---
int32 position #feedback
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
<nta>
<declaration>// Place global declarations here
chan oeffnen, schliessen;
broadcast chan position;
broadcast chan fertig;
int akt_position = 0;</declaration>
<template>
<name x="5" y="5">Tor</name>
<declaration>// Place local declarations here.
clock zeit;
int lokal;</declaration>
<location id="id0" x="-144" y="-76">
<name x="-212" y="-127">geschlossen</name>
<label kind="invariant" x="-238" y="-110">akt_position == 0</label>
</location>
<location id="id1" x="195" y="-229">
<name x="110" y="-246">oeffnend</name>
</location>
<location id="id2" x="510" y="-51">
<name x="476" y="-110">offen</name>
<label kind="invariant" x="476" y="-93">akt_position == 1000</label>
</location>
<location id="id3" x="204" y="85">
<name x="102" y="85">schliessend</name>
</location>
<init ref="id0"/>
<transition>
<source ref="id0"/>
<target ref="id3"/>
<label kind="synchronisation" x="-391" y="0">schliessen?</label>
<nail x="-280" y="-76"/>
<nail x="-280" y="93"/>
</transition>
<transition>
<source ref="id2"/>
<target ref="id1"/>
<label kind="synchronisation" x="663" y="-195">oeffnen?</label>
<nail x="646" y="-51"/>
<nail x="646" y="-238"/>
</transition>
<transition>
<source ref="id3"/>
<target ref="id1"/>
<label kind="synchronisation" x="280" y="-85">oeffnen?</label>
<nail x="280" y="-68"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id3"/>
<label kind="synchronisation" x="34" y="-110">schliessen?</label>
<nail x="119" y="-68"/>
</transition>
<transition>
<source ref="id3"/>
<target ref="id3"/>
<label kind="select" x="59" y="170">i : int[0,1000]</label>
<label kind="guard" x="59" y="187">akt_position - i &gt;= 0</label>
<label kind="synchronisation" x="59" y="153">position!</label>
<label kind="assignment" x="59" y="204">akt_position = akt_position - i</label>
<nail x="280" y="178"/>
<nail x="144" y="178"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="select" x="305" y="-356">i : int[0,1000]</label>
<label kind="guard" x="305" y="-339">akt_position + i &lt;= 1000</label>
<label kind="synchronisation" x="305" y="-373">position!</label>
<label kind="assignment" x="305" y="-322">akt_position = akt_position +i</label>
<nail x="126" y="-335"/>
<nail x="126" y="-335"/>
<nail x="270" y="-335"/>
</transition>
<transition>
<source ref="id3"/>
<target ref="id0"/>
<label kind="synchronisation" x="-143" y="0">fertig!</label>
</transition>
<transition>
<source ref="id2"/>
<target ref="id3"/>
<label kind="synchronisation" x="331" y="25">schliessen?</label>
</transition>
<transition>
<source ref="id1"/>
<target ref="id2"/>
<label kind="synchronisation" x="289" y="-195">fertig!</label>
</transition>
<transition>
<source ref="id0"/>
<target ref="id1"/>
<label kind="synchronisation" x="-76" y="-187">oeffnen?</label>
</transition>
</template>
<template>
<name>Schluessel</name>
<declaration>clock zeit;</declaration>
<location id="id4" x="-1045" y="-722">
</location>
<init ref="id4"/>
<transition>
<source ref="id4"/>
<target ref="id4"/>
<label kind="guard" x="-1215" y="-765">zeit &gt; 10</label>
<label kind="synchronisation" x="-1207" y="-739">schliessen!</label>
<label kind="assignment" x="-1224" y="-714">zeit = 0</label>
<nail x="-1215" y="-688"/>
<nail x="-1045" y="-578"/>
<nail x="-1045" y="-578"/>
</transition>
<transition>
<source ref="id4"/>
<target ref="id4"/>
<label kind="guard" x="-935" y="-850">zeit &gt; 10</label>
<label kind="synchronisation" x="-977" y="-867">oeffnen!</label>
<label kind="assignment" x="-909" y="-824">zeit = 0</label>
<nail x="-1038" y="-863"/>
<nail x="-860" y="-769"/>
</transition>
</template>
<system>// Place template instantiations here.
// List one or more processes to be composed into a system.
system Tor, Schluessel;
</system>
<queries>
<query>
<formula>A[] not deadlock
</formula>
<comment></comment>
</query>
<query>
<formula>A[] (akt_position &gt; -1)</formula>
<comment></comment>
</query>
<query>
<formula>A[] (akt_position &lt; 1001)</formula>
<comment></comment>
</query>
<query>
<formula>E&lt;&gt; Tor.offen</formula>
<comment></comment>
</query>
<query>
<formula>E&lt;&gt; Tor.geschlossen</formula>
<comment></comment>
</query>
<query>
<formula>E&lt;&gt; Tor.oeffnend</formula>
<comment></comment>
</query>
<query>
<formula>E&lt;&gt; Tor.schliessend</formula>
<comment></comment>
</query>
</queries>
</nta>
<launch>
<node name="tron_adapter" pkg="actionlib_example" type="actionlib_example_tron_adapter" respawn="false" output="screen"/>
<node name="actionlib_server" pkg="actionlib_example" type="actionlib_example_garage_server" respawn="false" output="screen"/>
</launch>
......@@ -39,11 +39,12 @@ class Garage {
rate.sleep();
if (as.isPreemptRequested() || !ros::ok() || as.isNewGoalAvailable()) {
ROS_INFO("server preempted");
as.setPreempted();
as.setPreempted(res, "preempted");
return;
}
if (current_position == to_reach) {
res.open = to_reach == OPEN;
res.position = current_position;
ROS_INFO("server goal reached");
as.setSucceeded(res);
return;
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment