Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lrs_task_msgs_codegen
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
lrs
lrs_task_msgs_codegen
Commits
ce785407
Commit
ce785407
authored
4 years ago
by
Tommy Persson
Browse files
Options
Downloads
Patches
Plain Diff
Work on smarc interface.
parent
d25e5592
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package.xml
+1
-1
1 addition, 1 deletion
package.xml
src/gen_msgs_srvs_acions.py
+41
-6
41 additions, 6 deletions
src/gen_msgs_srvs_acions.py
with
42 additions
and
7 deletions
package.xml
+
1
−
1
View file @
ce785407
...
...
@@ -7,7 +7,7 @@
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer
email=
"tom
pe@todo.todo
"
>
tompe
</maintainer>
<maintainer
email=
"tom
my.persson@liu.se
"
>
tompe
</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
...
...
This diff is collapsed.
Click to expand it.
src/gen_msgs_srvs_acions.py
+
41
−
6
View file @
ce785407
...
...
@@ -32,6 +32,40 @@ def gen_task_params_msg(jobj, prefix):
s
+=
f
'
string
{
name
}
\n
'
return
s
def
gen_task_signal_service
(
prefix
):
s
=
""
s
+=
"
string uuid # uuid for the started task
\n
"
s
+=
"
string signal # Standard:
\"
$abort
\"
,
\"
$pause
\"
,
\"
$continue
\"
,
\"
$enough
\"\n
"
s
+=
"
---
\n
"
s
+=
"
bool success
\n
"
s
+=
"
int32 error
\n
"
s
+=
"
string reason
\n
"
return
s
def
gen_task_check_service
(
prefix
):
s
=
""
s
+=
f
'
lrs_task_msgs/
{
prefix
}
Task task
\n
'
s
+=
"
---
\n
"
s
+=
"
bool success
\n
"
s
+=
"
int32 error
\n
"
s
+=
"
string reason
\n
"
return
s
def
gen_task_start_action
(
prefix
):
s
=
""
s
+=
"
string uuid # uuid that are used in signal service call to send signals to the running action
\n
"
s
+=
f
'
lrs_task_msgs/
{
prefix
}
Task task
\n
'
s
+=
"
---
\n
"
s
+=
"
string signal_received
\n
"
s
+=
"
bool paused
\n
"
s
+=
"
---
\n
"
s
+=
"
bool success
\n
"
s
+=
"
string fail_reason
\n
"
s
+=
"
bool aborted
\n
"
s
+=
"
bool enoughed
"
return
s
def
get_msg_name_prefix
(
taskname
):
#print("TASKNAME:", taskname, taskname.split("-"))
lst
=
[
el
[
0
].
upper
()
+
el
[
1
:]
for
el
in
taskname
.
split
(
"
-
"
)]
...
...
@@ -50,14 +84,15 @@ if __name__ == '__main__':
print
(
"
TASK:
"
,
objstr
)
taskname
=
obj
[
"
key
"
]
msgprefix
=
get_msg_name_prefix
(
taskname
)
print
(
taskname
,
msgprefix
)
print
(
"
========================
"
)
# print(taskname, msgprefix)
tmsg
=
gen_task_msg
(
obj
,
msgprefix
)
print
(
tmsg
)
print
(
"
========================
"
)
tpmsg
=
gen_task_params_msg
(
obj
,
msgprefix
)
print
(
tpmsg
)
print
(
"
========================
"
)
tstartaction
=
gen_task_start_action
(
msgprefix
)
tsignalservice
=
gen_task_signal_service
(
msgprefix
)
tcheckservice
=
gen_task_check_service
(
msgprefix
)
open
(
f
'
{
options
.
outdir
}
/msg/
{
msgprefix
}
Task.msg
'
,
"
w
"
).
write
(
tmsg
)
open
(
f
'
{
options
.
outdir
}
/msg/
{
msgprefix
}
TaskParams.msg
'
,
"
w
"
).
write
(
tpmsg
)
open
(
f
'
{
options
.
outdir
}
/action/
{
msgprefix
}
Start.action
'
,
"
w
"
).
write
(
tstartaction
)
open
(
f
'
{
options
.
outdir
}
/srv/
{
msgprefix
}
Signal.srv
'
,
"
w
"
).
write
(
tsignalservice
)
open
(
f
'
{
options
.
outdir
}
/srv/
{
msgprefix
}
Check.srv
'
,
"
w
"
).
write
(
tcheckservice
)
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