Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bigprint
twins-planner
Commits
18cd4748
Commit
18cd4748
authored
Feb 18, 2021
by
Jayant Khatkar
Browse files
plot contours by arm assigned function (
#71
)
parent
0c7dac46
Changes
3
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
18cd4748
**/__pycache__/
.DS_Store
*.pyc
*.pkl
*.so
...
...
src/plan_watcher.py
View file @
18cd4748
...
...
@@ -17,9 +17,9 @@ if __name__ == "__main__":
# load plan address from args
parser
=
argparse
.
ArgumentParser
(
description
=
'to watch, visulise and inspect loaded plans'
)
parser
.
add_argument
(
'plan'
,
metavar
=
'plan'
,
help
=
'plan to read
'
)
parser
.
add_argument
(
'plan'
)
parser
.
add_argument
(
'--gcode
'
)
args
=
parser
.
parse_args
()
# load plan
...
...
@@ -28,3 +28,7 @@ if __name__ == "__main__":
print
(
"plan loaded, it is {}s long"
.
format
(
plan
.
len
()))
print
(
"use plan.watch(x) to watch the plan in 3D"
)
print
(
"use plan.visualise(x) to plot plan"
)
if
args
.
gcode
is
not
None
:
contours
=
gc
.
decode_gcode
(
args
.
gcode
)
print
(
"Contours loaded into variable contours"
)
src/utils/planning_tools.py
View file @
18cd4748
...
...
@@ -436,3 +436,21 @@ def get_tracker(model):
print
(
"Dependency graph completed and saved to "
+
pkl
)
return
tracker
def
plot_plan_contours
(
plan
,
contours
,
colors
=
[
'black'
,
'magenta'
],
style
=
'2d'
):
"""
wrapper for plotting contours
"""
sorted_contours
=
[]
for
r
in
plan
.
trajs
:
sorted_contours
.
append
([])
for
traj
in
plan
.
trajs
[
r
]:
if
traj
.
contour
is
not
None
:
sorted_contours
[
r
].
append
(
contours
[
traj
.
contour
])
if
style
==
'2d'
:
gc
.
plot_contours2d
(
*
sorted_contours
,
colors
=
colors
)
elif
style
==
'3d'
:
gc
.
plot_contours3d
(
*
sorted_contours
,
colors
=
colors
)
else
:
raise
Exception
(
"style must be '2d' or '3d'"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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