Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ros
TeSSLaROSBridge
Commits
650b83b8
Commit
650b83b8
authored
Sep 21, 2022
by
Marian Begemann
Browse files
Adjusted counter example to use given ROS value for counting
parent
f1ec9d1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
config_tessla/counter_with_reset.json
View file @
650b83b8
...
...
@@ -22,18 +22,6 @@
"type"
:
"Events[Int]"
}],
"outputs"
:
[{
"annotations"
:
[{
"args"
:
{
"value"
:
{
"type"
:
"String"
,
"value"
:
"counter"
}
},
"name"
:
"$name"
}],
"name"
:
"$903"
,
"type"
:
"Events[Int]"
},
{
"annotations"
:
[{
"args"
:
{
"name"
:
{
...
...
@@ -59,7 +47,7 @@
},
"name"
:
"$name"
}],
"name"
:
"reset$
905
"
,
"name"
:
"reset$
899
"
,
"type"
:
"Events[Bool]"
}]
}
\ No newline at end of file
config_tessla/counter_with_reset.tessla
View file @
650b83b8
...
...
@@ -6,10 +6,13 @@ def @RosPublisher(name: String, ros_type: String, qos_profile: String)
@RosSubscription("/counter", "int64", "10")
in x: Events[Int]
def counter = count(x)
def reset = counter > 10
# Version 2 - if once reset true then forever
# def counter = count(x)
# def reset = counter > 10
# out counter
out counter
# Version 1 - every time reset if counter is bigger then 10
def reset = x > 10
@RosPublisher("/reset_counter", "bool", "10")
out reset
...
...
src/tesslabridge/tesslabridge/examples/counter_with_reset.py
View file @
650b83b8
...
...
@@ -52,7 +52,9 @@ class CounterWithReset(Node):
"""If event of type bool is true reset counter to zero, else do nothing."""
if
msg
.
data
:
self
.
counter
=
0
self
.
get_logger
().
debug
(
'Received on reset topic:"{}"'
.
format
(
msg
.
data
))
self
.
get_logger
().
warn
(
'Counter Node: Reset Counter to zero, after receiving on reset topic:"{}"'
.
format
(
msg
.
data
))
self
.
get_logger
().
debug
(
'Counter Node: Received on reset topic:"{}"'
.
format
(
msg
.
data
))
def
main
(
args
=
None
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment