Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TicTacToe-Robot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lukas Hoffleit
TicTacToe-Robot
Commits
7b873fdd
Commit
7b873fdd
authored
2 months ago
by
Lukas Hoffleit
Browse files
Options
Downloads
Patches
Plain Diff
Formatierung und Gerade bewegung
parent
1750cc72
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
phantomController.py
+18
-30
18 additions, 30 deletions
phantomController.py
with
18 additions
and
30 deletions
phantomController.py
+
18
−
30
View file @
7b873fdd
...
@@ -9,7 +9,7 @@ def connect():
...
@@ -9,7 +9,7 @@ def connect():
ser
.
readline
().
decode
()
ser
.
readline
().
decode
()
return
ser
return
ser
def
move_pose
(
ser
,
w
,
gripServo
,
duration
):
def
move_pose
(
ser
,
w
,
gripServo
,
duration
,
straight
):
BASE_MIN
=
-
2.6112
BASE_MIN
=
-
2.6112
BASE_MAX
=
2.6061
BASE_MAX
=
2.6061
SHOULDER_MIN
=
-
1.5708
SHOULDER_MIN
=
-
1.5708
...
@@ -44,37 +44,24 @@ def move_pose(ser,w,gripServo,duration):
...
@@ -44,37 +44,24 @@ def move_pose(ser,w,gripServo,duration):
v
[
2
]
=
v
[
2
]
-
1.314998850007427
v
[
2
]
=
v
[
2
]
-
1.314998850007427
v
[
3
]
=
v
[
3
]
+
1.570781108285199
v
[
3
]
=
v
[
3
]
+
1.570781108285199
######################
if
straight
:
v
[
4
]
=
v
[
0
]
# Überprüfung der zulässigen Werte
# Überprüfung der zulässigen Werte
if
v
[
0
]
<
BASE_MIN
:
if
v
[
0
]
<
BASE_MIN
:
return
"
False
"
return
"
False
"
if
v
[
0
]
>
BASE_MAX
:
return
"
False
"
if
v
[
0
]
>
BASE_MAX
:
if
v
[
1
]
<
SHOULDER_MIN
:
return
"
False
"
return
"
False
"
if
v
[
1
]
>
SHOULDER_MAX
:
return
"
False
"
if
v
[
1
]
<
SHOULDER_MIN
:
if
v
[
2
]
<
ELBOW_MIN
:
return
"
False
"
return
"
False
"
if
v
[
2
]
>
ELBOW_MAX
:
return
"
False
"
if
v
[
1
]
>
SHOULDER_MAX
:
if
v
[
3
]
<
WRIST_MIN
:
return
"
False
"
return
"
False
"
if
v
[
3
]
>
WRIST_MAX
:
return
"
False
"
if
v
[
2
]
<
ELBOW_MIN
:
if
v
[
4
]
<
WROT_MIN
:
return
"
False
"
return
"
False
"
if
v
[
4
]
>
WROT_MAX
:
return
"
False
"
if
v
[
2
]
>
ELBOW_MAX
:
if
gripServo
<
GRIP_MIN
:
return
"
False
"
return
"
False
"
if
gripServo
>
GRIP_MAX
:
return
"
False
"
if
v
[
3
]
<
WRIST_MIN
:
if
duration
<
DURATION_MIN
:
return
"
False
"
return
"
False
"
if
duration
>
DURATION_MAX
:
return
"
False
"
if
v
[
3
]
>
WRIST_MAX
:
return
"
False
"
if
v
[
4
]
<
WROT_MIN
:
return
"
False
"
if
v
[
4
]
>
WROT_MAX
:
return
"
False
"
if
gripServo
<
GRIP_MIN
:
return
"
False
"
if
gripServo
>
GRIP_MAX
:
return
"
False
"
if
duration
<
DURATION_MIN
:
return
"
False
"
if
duration
>
DURATION_MAX
:
return
"
False
"
if
np
.
any
(
np
.
isinf
(
v
))
or
np
.
any
(
np
.
isnan
(
v
)):
# Probe auf Inf und NaN
if
np
.
any
(
np
.
isinf
(
v
))
or
np
.
any
(
np
.
isnan
(
v
)):
# Probe auf Inf und NaN
return
"
False
"
return
"
False
"
...
@@ -82,6 +69,7 @@ def move_pose(ser,w,gripServo,duration):
...
@@ -82,6 +69,7 @@ def move_pose(ser,w,gripServo,duration):
resp
=
set_joint_angles
(
ser
,
v
[
0
],
v
[
1
],
v
[
2
],
v
[
3
],
v
[
4
],
gripServo
,
duration
)
resp
=
set_joint_angles
(
ser
,
v
[
0
],
v
[
1
],
v
[
2
],
v
[
3
],
v
[
4
],
gripServo
,
duration
)
return
resp
return
resp
def
set_joint_angles
(
ser
,
baseServo
,
shoulderServo
,
elbowServo
,
wristServo
,
wristRotServo
,
gripServo
,
duration
):
def
set_joint_angles
(
ser
,
baseServo
,
shoulderServo
,
elbowServo
,
wristServo
,
wristRotServo
,
gripServo
,
duration
):
msg
=
(
f
"
move
{
baseServo
:
.
4
f
}
{
shoulderServo
:
.
4
f
}
{
elbowServo
:
.
4
f
}
{
wristServo
:
.
4
f
}
{
wristRotServo
:
.
4
f
}
{
int
(
gripServo
)
}
{
int
(
duration
)
}
\n
"
)
msg
=
(
f
"
move
{
baseServo
:
.
4
f
}
{
shoulderServo
:
.
4
f
}
{
elbowServo
:
.
4
f
}
{
wristServo
:
.
4
f
}
{
wristRotServo
:
.
4
f
}
{
int
(
gripServo
)
}
{
int
(
duration
)
}
\n
"
)
ser
.
write
(
msg
.
encode
())
ser
.
write
(
msg
.
encode
())
...
...
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