Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Trajektorien des menschlichen Aufstehens für die Entwicklung eines kooperativen Assistenzsystems
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ventsislav Dokusanski
Trajektorien des menschlichen Aufstehens für die Entwicklung eines kooperativen Assistenzsystems
Commits
b9a25190
Commit
b9a25190
authored
7 months ago
by
Ventsislav Dokusanski
Browse files
Options
Downloads
Patches
Plain Diff
Update forward_kinematics_node for the simple_robot simulation
parent
a7bb0117
No related branches found
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
ros2_ws/src/simple_robot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py
+47
-6
47 additions, 6 deletions
...ot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py
ros2_ws/src/simple_robot_1dof/urdf/simple_robot.urdf
+8
-0
8 additions, 0 deletions
ros2_ws/src/simple_robot_1dof/urdf/simple_robot.urdf
with
55 additions
and
6 deletions
ros2_ws/src/simple_robot_1dof/simple_robot_1dof/forward_kinematics_node_1dof.py
+
47
−
6
View file @
b9a25190
...
...
@@ -35,6 +35,16 @@ class Forward_Kinematics_Node_1Dof(Node):
self
.
Glist
=
self
.
robot_model
[
"
Glist
"
]
self
.
Blist
=
self
.
robot_model
[
"
Blist
"
]
urdf_file_path_simple_robot
=
os
.
path
.
join
(
get_package_share_directory
(
'
simple_robot_1dof
'
),
'
urdf
'
,
'
simple_robot.urdf
'
)
self
.
simple_robot_model
=
loadURDF
(
urdf_file_path_simple_robot
)
self
.
simple_robot_M
=
self
.
simple_robot_model
[
"
M
"
]
self
.
simple_robot_Slist
=
self
.
simple_robot_model
[
"
Slist
"
]
self
.
simple_robot_Mlist
=
self
.
simple_robot_model
[
"
Mlist
"
]
self
.
simple_robot_Glist
=
self
.
simple_robot_model
[
"
Glist
"
]
self
.
simple_robot_Blist
=
self
.
simple_robot_model
[
"
Blist
"
]
# create two publishers for the RViz simulation - one for the whole path and one for the marker
self
.
path_publisher_
=
self
.
create_publisher
(
Path
,
'
/simple_robot/visualization_path
'
,
10
)
self
.
point_publisher_
=
self
.
create_publisher
(
Marker
,
'
/simple_robot/visualization_marker
'
,
10
)
...
...
@@ -57,9 +67,10 @@ class Forward_Kinematics_Node_1Dof(Node):
if
self
.
phi
==
0
:
self
.
index
+=
1
self
.
transformation
()
self
.
transformation_kuka
()
self
.
transformation_simple_robot
()
def
transformation
(
self
):
def
transformation
_kuka
(
self
):
# Define the desired rotation here
theta
=
-
pi
/
1.8
# Split theta
...
...
@@ -92,13 +103,43 @@ class Forward_Kinematics_Node_1Dof(Node):
end_position
=
end_forward_kinematics
[:
4
,
3
]
end_orientation
=
Rotation
.
from_matrix
(
end_forward_kinematics
[:
3
,
:
3
]).
as_quat
()
self
.
publish_pose_simple_robot
(
end_position
,
end_orientation
)
if
self
.
index
==
2
:
self
.
publish_pose_target_pose
(
end_position
,
end_orientation
)
def
transformation_simple_robot
(
self
):
# Define the desired rotation here
theta
=
-
pi
/
1.8
# Split theta
theta_fraction
=
self
.
phi
*
theta
self
.
publish_angle
(
theta_fraction
)
# Define the matrix
intermediate_rotation
=
np
.
array
([
[
cos
(
theta_fraction
),
-
sin
(
theta_fraction
),
0
,
0
],
[
sin
(
theta_fraction
),
cos
(
theta_fraction
),
0
,
0
],
[
0
,
0
,
1
,
0
],
[
0
,
0
,
0
,
1
]
])
self
.
simple_robot_joint_angles
=
np
.
zeros
(
len
(
self
.
simple_robot_Slist
[
0
]))
# self.simple_robot_joint_angles[1] = np.pi / 2
start_forward_kinematics_simple
=
FKinBody
(
self
.
simple_robot_M
,
self
.
simple_robot_Blist
,
self
.
simple_robot_joint_angles
)
start_position_simple
=
start_forward_kinematics_simple
[:
4
,
3
]
start_orientation
=
Rotation
.
from_matrix
(
start_forward_kinematics_simple
[:
3
,
:
3
]).
as_quat
()
end_forward_kinematics_simple
=
np
.
matmul
(
intermediate_rotation
,
start_forward_kinematics_simple
)
end_position_simple
=
end_forward_kinematics_simple
[:
4
,
3
]
end_orientation_simple
=
Rotation
.
from_matrix
(
end_forward_kinematics_simple
[:
3
,
:
3
]).
as_quat
()
self
.
publish_pose_simple_robot
(
end_position_simple
,
end_orientation_simple
)
self
.
construct_path
(
end_position
)
self
.
construct_path
(
end_position
_simple
)
def
construct_path
(
self
,
vector
):
# RViz
...
...
This diff is collapsed.
Click to expand it.
ros2_ws/src/simple_robot_1dof/urdf/simple_robot.urdf
+
8
−
0
View file @
b9a25190
...
...
@@ -78,6 +78,14 @@
<limit
effort =
"300"
lower=
"-2.96705972839"
upper=
"2.96705972839"
velocity =
"10"
/>
</joint>
<link
name=
"ee_link"
/>
<joint
name=
"ee_joint"
type=
"fixed"
>
<parent
link=
"arm3"
/>
<child
link=
"ee_link"
/>
<origin
xyz=
"-0.3 0 0"
/>
</joint>
</robot>
...
...
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