Skip to content

Commit 4004357

Browse files
277 make a ros wrapper (#285)
* Make a ros wrapper. Signed-off-by: Jelmer de Wolde <[email protected]> * Undo unnecessary changes. Signed-off-by: Jelmer de Wolde <[email protected]> * Introduce gui. Signed-off-by: Jelmer de Wolde <[email protected]> * Visualize gripper pose in Rviz. Signed-off-by: Jelmer de Wolde <[email protected]> * Correct gripper visualization with offset between wrist and tcp. Signed-off-by: Jelmer de Wolde <[email protected]> * Add animated visualization of plan. Signed-off-by: Jelmer de Wolde <[email protected]> * Clean up code. Signed-off-by: Jelmer de Wolde <[email protected]> --------- Signed-off-by: Jelmer de Wolde <[email protected]> Co-authored-by: Jelmer de Wolde <[email protected]>
1 parent 104c3f3 commit 4004357

File tree

26 files changed

+1538
-25
lines changed

26 files changed

+1538
-25
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies = [
4747
"xmltodict>=1.0.2",
4848
"pandas>=2.2.0",
4949
"trimesh>=4.8.2",
50+
"nicegui>=3.0.4",
5051
]
5152

5253
[dependency-groups]
@@ -104,4 +105,4 @@ select = "DOC"
104105
style = "google"
105106
skip-checking-short-docstrings = false
106107
allow-init-docstring = true
107-
check-style-mismatch = true
108+
check-style-mismatch = true

ros2_ws/src/rcdt_franka_moveit_config/config/fr3.srdf

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ are defined
2828
group-->
2929
<!--SUBGROUPS:
3030
Groups can also be formed by referencing to already defined group names-->
31-
<group name="fr3_arm">
31+
<group name="arm">
3232
<joint name="fr3_joint1" />
3333
<joint name="fr3_joint2" />
3434
<joint name="fr3_joint3" />
@@ -37,10 +37,20 @@ are defined
3737
<joint name="fr3_joint6" />
3838
<joint name="fr3_joint7" />
3939
</group>
40+
<group name="hand">
41+
<joint name="fr3_joint8" />
42+
<joint name="fr3_hand_joint" />
43+
<joint name="fr3_hand_tcp_joint" />
44+
<joint name="fr3_finger_joint1" />
45+
<joint name="fr3_finger_joint2" />
46+
</group>
47+
<group name="tcp">
48+
<link name="fr3_hand_tcp" />
49+
</group>
4050
<!--GROUP_STATES:
4151
Purpose: Define a named state for a particular group, in terms of joint values. This is
4252
useful to define states like 'folded arms'-->
43-
<group_state name="home" group="fr3_arm">
53+
<group_state name="home" group="arm">
4454
<joint name="fr3_joint1" value="0" />
4555
<joint name="fr3_joint2" value="-0.78539816339" />
4656
<joint name="fr3_joint3" value="0" />
@@ -49,7 +59,7 @@ are defined
4959
<joint name="fr3_joint6" value="1.57079632679" />
5060
<joint name="fr3_joint7" value="0.78539816339" />
5161
</group_state>
52-
<group_state name="drop" group="fr3_arm">
62+
<group_state name="drop" group="arm">
5363
<joint name="fr3_joint1" value="-1.57079632679" />
5464
<joint name="fr3_joint2" value="-0.65" />
5565
<joint name="fr3_joint3" value="0" />
@@ -61,6 +71,7 @@ are defined
6171

6272
<!--END_EFFECTOR:
6373
Purpose: Represent information about an end effector.-->
74+
<end_effector name="hand" parent_link="fr3_link7" group="hand" parent_group="arm" />
6475
<!--DISABLE_COLLISIONS:
6576
By default it is assumed that any link of the robot could potentially come into
6677
collision with any other link in the robot. This tag disables collision checking between a

ros2_ws/src/rcdt_franka_moveit_config/config/kinematics.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
fr3_arm:
5+
arm:
66
kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin
77
kinematics_solver_search_resolution: 0.0050000000000000001
88
kinematics_solver_timeout: 0.0050000000000000001

ros2_ws/src/rcdt_franka_moveit_config/config/servo_params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
thread_priority: 40
88
publish_period: 0.001
99
max_expected_latency: 0.1
10-
move_group_name: fr3_arm
10+
move_group_name: arm
1111
active_subgroup: ""
1212

1313
############################# INCOMING COMMAND SETTINGS ########################

ros2_ws/src/rcdt_gazebo/launch/gazebo_robot.launch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def generate_launch_description() -> LaunchDescription:
123123
world_arg.declaration,
124124
platforms_arg.declaration,
125125
positions_arg.declaration,
126+
orientations_arg.declaration,
126127
bridge_topics_arg.declaration,
127128
OpaqueFunction(function=launch_setup),
128129
]

ros2_ws/src/rcdt_gazebo/worlds/table_with_1_brick.sdf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ SPDX-License-Identifier: Apache-2.0
6969
</model>
7070

7171
<model name='brick0'>
72-
<pose>0.5 0 0 0 0 0</pose>
72+
<pose>0.5 0 0.03 0 0 0</pose>
7373
<include>
7474
<uri>model://rcdt_gazebo/models/brick</uri>
7575
</include>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-FileCopyrightText: Alliander N. V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
cmake_minimum_required(VERSION 3.5)
6+
project(rcdt_grasping)
7+
8+
# CMake dependencies:
9+
find_package(ament_cmake REQUIRED)
10+
find_package(ament_cmake_python REQUIRED)
11+
12+
# Other dependencies:
13+
find_package(rclpy REQUIRED)
14+
find_package(rcdt_utilities REQUIRED)
15+
16+
ament_python_install_package(${PROJECT_NAME})
17+
18+
# Python executables:
19+
install(
20+
DIRECTORY src_py/
21+
DESTINATION lib/${PROJECT_NAME}
22+
)
23+
24+
# Shared folders:
25+
install(
26+
DIRECTORY launch
27+
DESTINATION share/${PROJECT_NAME}
28+
)
29+
30+
# Default test:
31+
if(BUILD_TESTING)
32+
find_package(ament_lint_auto REQUIRED)
33+
ament_lint_auto_find_test_dependencies()
34+
endif()
35+
36+
ament_package()
11.9 MB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Alliander N. V.
2+
3+
SPDX-License-Identifier: Apache-2.0
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-FileCopyrightText: Alliander N. V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
from launch import LaunchContext, LaunchDescription
6+
from launch.actions import OpaqueFunction
7+
from launch_ros.actions import Node
8+
from rcdt_utilities.register import Register
9+
10+
11+
def launch_setup(context: LaunchContext) -> list:
12+
"""Setup the launch description for the node.
13+
14+
Args:
15+
context (LaunchContext): The launch context.
16+
17+
Returns:
18+
list: A list of actions to be executed in the launch description.
19+
"""
20+
graspnet_node = Node(
21+
package="rcdt_grasping",
22+
executable="generate_grasp.py",
23+
)
24+
25+
return [
26+
Register.on_log(
27+
graspnet_node, "GraspNet model initialized and weights loaded", context
28+
),
29+
]
30+
31+
32+
def generate_launch_description() -> LaunchDescription:
33+
"""Generate the launch description for the grasping node.
34+
35+
Returns:
36+
LaunchDescription: The launch description containing the grasping node.
37+
"""
38+
return LaunchDescription(
39+
[
40+
OpaqueFunction(function=launch_setup),
41+
]
42+
)

0 commit comments

Comments
 (0)