Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lrs_doc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lrs2
lrs_doc
Commits
8c18fa98
Commit
8c18fa98
authored
2 years ago
by
Tommy Persson
Browse files
Options
Downloads
Patches
Plain Diff
Work on ardupilot
parent
fcd856fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+12
-49
12 additions, 49 deletions
README.md
with
12 additions
and
49 deletions
README.md
+
12
−
49
View file @
8c18fa98
...
...
@@ -236,72 +236,35 @@ like fly-to, move-to, look-at-position and so on are robot/agent
specific. Common types are things like seq (S), conc (S), wait,
send-signal and so on and are implemented in the system (in lrs_exec).
Here is how the
[
wait
executor
](
https://gitlab.liu.se/lrs2/lrs_exec/-/blob/main/lrs_exec/executors/
wait
.py
)
is implemented in Py
h
ton:
Here is how the
[
noop
executor
](
https://gitlab.liu.se/lrs2/lrs_exec/-/blob/main/lrs_exec/executors/
noop
.py
)
is implemented in Pyt
h
on:
```
python
import
time
import
rclpy
from
rclpy.executors
import
MultiThreadedExecutor
from
lrs_exec.executor
import
Executor
from
lrs_exec.executor_factory
import
ExecutorFactory
from
lrs_exec.
ticked_
executor
import
Ticked
Executor
from
lrs_exec.
ticked_
executor_factory
import
Ticked
ExecutorFactory
class
Wait
Executor
(
Executor
):
class
Noop
Executor
(
Ticked
Executor
):
def
__init__
(
self
,
node
,
id
):
super
().
__init__
(
node
,
id
)
self
.
set_signals
([
"
$abort
"
,
"
$pause
"
,
"
$continue
"
,
"
$enough
"
,
"
$finished
"
])
def
do_work
(
self
):
return
def
start
(
self
):
try
:
self
.
node
.
get_logger
().
info
(
"
WaitExecutor start
"
)
# self.params.print()
index
=
0
paused
=
False
duration
=
self
.
params
.
get_value
(
"
duration
"
)
if
not
duration
:
self
.
fail
(
"
duration param must be specified
"
)
return
self
.
node
.
get_logger
().
error
(
f
'
Duration:
{
duration
}
'
)
finished_flag
=
False
while
not
finished_flag
and
0.1
*
index
<
duration
:
if
self
.
have_signal
():
signal
=
self
.
pop_signal
()
self
.
node
.
get_logger
().
info
(
f
'
WaitExecutor got signal:
{
signal
}
'
)
if
signal
==
"
$finished
"
:
self
.
signal_finish
()
finished_flag
=
True
if
signal
==
"
$enough
"
:
finished_flag
=
True
if
signal
==
"
$abort
"
:
self
.
abort_fail
(
"
Got abort signal
"
)
finished_flag
=
True
if
signal
==
"
$pause
"
:
paused
=
True
if
signal
==
"
$continue
"
:
self
.
dji
.
mission_continue
()
paused
=
False
if
not
paused
:
index
+=
1
time
.
sleep
(
0.1
)
self
.
node
.
get_logger
().
error
(
f
'
Wait finished.
'
)
except
Exception
as
exc
:
self
.
node
.
get_logger
().
error
(
f
'
EXCEPTION start:
{
type
(
exc
)
}
-
{
exc
}
'
)
self
.
fail
(
f
'
Exception:
{
exc
}
'
)
## self.node.get_logger().info("WaitExecutor end")
class
WaitExecutorFactory
(
ExecutorFactory
):
class
NoopExecutorFactory
(
TickedExecutorFactory
):
def
__init__
(
self
):
super
().
__init__
(
"
wait
"
)
super
().
__init__
(
"
no-op
"
)
def
get_executor
(
self
,
node
,
id
):
return
WaitExecutor
(
node
,
id
)
return
self
.
add_executor
(
NoopExecutor
(
node
,
id
))
def
main
(
args
=
None
):
rclpy
.
init
(
args
=
args
)
executor
=
MultiThreadedExecutor
(
num_threads
=
8
)
node
=
Wait
ExecutorFactory
()
node
=
Noop
ExecutorFactory
()
executor
.
add_node
(
node
)
print
(
f
"
Spinning
{
__name__
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment