Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
34f26fc
Robot position
NikolaRaicevic2001 Sep 23, 2024
5e6ac77
_robot_joint_state.launch.py fixed
NikolaRaicevic2001 Sep 25, 2024
e509cd3
moveit
NikolaRaicevic2001 Sep 26, 2024
55636ba
fix control launch
Sep 26, 2024
1c152a0
Merge pull request #8 from ExistentialRobotics/fix-control-launch
lkm1321 Sep 26, 2024
52aea05
propagate changes to gazebo
Sep 26, 2024
4f51fc3
Incorporating moveit in xarm6
NikolaRaicevic2001 Sep 26, 2024
efe8bb7
Merge branch 'cleanup' of github.com:ExistentialRobotics/xarm_ros2 in…
NikolaRaicevic2001 Sep 26, 2024
b7ff270
Moveit in besides_table world
NikolaRaicevic2001 Sep 26, 2024
ffd0489
Incorporating moveit
NikolaRaicevic2001 Sep 26, 2024
1153608
trying to revert namespacing
NikolaRaicevic2001 Oct 2, 2024
95d612b
works without namespace
Oct 2, 2024
e5b5a97
make single robot planning work
Oct 2, 2024
c3f273e
Merge pull request #9 from ExistentialRobotics/gazebo_control
lkm1321 Oct 2, 2024
b66c85e
Added camera and ros_gz_bridge node
NikolaRaicevic2001 Oct 3, 2024
80e3660
minor
NikolaRaicevic2001 Oct 3, 2024
1be6be9
minor
NikolaRaicevic2001 Oct 4, 2024
bb109f2
correct camera orientation
NikolaRaicevic2001 Oct 4, 2024
c58fd82
Adding gripper
NikolaRaicevic2001 Oct 4, 2024
eec73b1
minor
NikolaRaicevic2001 Oct 14, 2024
1138958
octomap
NikolaRaicevic2001 Oct 16, 2024
28a0b68
Fix TF tree (#10)
lkm1321 Oct 30, 2024
3361a3d
world_table.sdf changed
NikolaRaicevic2001 Oct 31, 2024
b2307cb
Added [200~# Software License Agreement (BSD License)
NikolaRaicevic2001 Nov 1, 2024
98462cb
use a simple timer for the moment
Nov 1, 2024
83236c0
minor
NikolaRaicevic2001 Nov 18, 2024
0766c78
updated real robot_ip
Niyas-A Jan 3, 2025
9dea4a8
Gazebo velocity controller
dwaitbhatt Jan 15, 2025
bb8783d
Velocity controller
dwaitbhatt Jan 15, 2025
5f8fcd9
Controller specifing robot description
NikolaRaicevic2001 Jan 22, 2025
2394a45
use different kinematics yaml between sim and real
NikolaRaicevic2001 Jan 23, 2025
02187cb
Offset handling
NikolaRaicevic2001 Jan 23, 2025
1c7f8df
add user/xarm6_kinematics_sim.yaml
Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions xarm_controller/config/xarm6_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ controller_manager:
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

position_controller:
type: position_controllers/JointGroupPositionController

velocity_controller:
type: velocity_controllers/JointGroupVelocityController

effort_controller:
type: effort_controllers/JointGroupEffortController

traj_controller:
type: joint_trajectory_controller/JointTrajectoryController

# Original comment: only for fake control (?)
gripper_traj_controller:
type: joint_trajectory_controller/JointTrajectoryController
Expand All @@ -14,6 +24,42 @@ controller_manager:
bio_gripper_traj_controller:
type: joint_trajectory_controller/JointTrajectoryController

position_controller:
ros__parameters:
joints:
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6

velocity_controller:
ros__parameters:
joints:
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6
interface_name: velocity
command_interfaces:
- velocity
state_interfaces:
- position
- velocity

effort_controller:
ros__parameters:
joints:
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6

traj_controller:
ros__parameters:
command_interfaces:
Expand Down
40 changes: 28 additions & 12 deletions xarm_controller/launch/_ros2_control.launch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2021, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>

import os
from ament_index_python import get_package_share_directory
Expand All @@ -19,21 +14,21 @@
def launch_setup(context, *args, **kwargs):
prefix = LaunchConfiguration('prefix', default='')
hw_ns = LaunchConfiguration('hw_ns', default='xarm')
kinematics_suffix = LaunchConfiguration('hw_ns', default='')

ros2_control_plugin = LaunchConfiguration('ros2_control_plugin', default='uf_robot_hardware/UFRobotSystemHardware')
xacro_file = LaunchConfiguration('xacro_file', default=PathJoinSubstitution([FindPackageShare('xarm_description'), 'urdf', 'xarm_device.urdf.xacro']))

xarm_type = 'xarm6' #TODO - fix

# ros2 control params
# xarm_controller/launch/lib/robot_controller_lib.py
mod = load_python_launch_file_as_module(os.path.join(get_package_share_directory('xarm_controller'), 'launch', 'lib', 'robot_controller_lib.py'))
generate_ros2_control_params_temp_file = getattr(mod, 'generate_ros2_control_params_temp_file')
ros2_control_params = generate_ros2_control_params_temp_file(
os.path.join(get_package_share_directory('xarm_controller'), 'config', '{}{}_controllers.yaml'.format(robot_type.perform(context), dof.perform(context) if robot_type.perform(context) in ('xarm', 'lite') else '')),
os.path.join(get_package_share_directory('xarm_controller'), 'config', f'{xarm_type}_controllers.yaml'),
prefix=prefix.perform(context),
add_gripper=False,
add_bio_gripper=False,
ros_namespace=LaunchConfiguration('ros_namespace', default='').perform(context),
robot_type='xarm'
)

# robot_description
Expand All @@ -46,10 +41,27 @@ def launch_setup(context, *args, **kwargs):
'hw_ns': hw_ns.perform(context).strip('/'),
'ros2_control_plugin': ros2_control_plugin,
'ros2_control_params': ros2_control_params,
'kinematics_suffix': kinematics_suffix,
}
)
}

robot_state_publisher_node = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[robot_description],
# BL: don't remap /tf to custom topics.
# I.e., multiple robots publish to same /tf topic
# Instead, use prefix to distinguish different robots
# remappings=[
# ('/tf', 'tf'),
# ('/tf_static', 'tf_static'),
# ]
# namespace=this_robot_namespace
)


mod = load_python_launch_file_as_module(os.path.join(get_package_share_directory('xarm_api'), 'launch', 'lib', 'robot_api_lib.py'))
generate_robot_api_params = getattr(mod, 'generate_robot_api_params')
robot_params = generate_robot_api_params(
Expand All @@ -63,19 +75,23 @@ def launch_setup(context, *args, **kwargs):
package='controller_manager',
executable='ros2_control_node',
parameters=[
robot_description,
ros2_control_params,
robot_params,
],
remappings=[
('~/robot_description', '/robot_description'),
],
output='screen',
)

return [
ros2_control_node
ros2_control_node,
robot_state_publisher_node
]


def generate_launch_description():
return LaunchDescription([
OpaqueFunction(function=launch_setup)
])


11 changes: 2 additions & 9 deletions xarm_controller/launch/lib/robot_controller_lib.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2021, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>

import os
import yaml
from tempfile import NamedTemporaryFile
from ament_index_python import get_package_share_directory


def add_prefix_to_ros2_control_params(prefix, ros2_control_params):
if not prefix:
return
Expand All @@ -33,9 +27,8 @@ def add_prefix_to_ros2_control_params(prefix, ros2_control_params):
if name in controller_manager_ros__parameters:
controller_manager_ros__parameters[new_name] = controller_manager_ros__parameters.pop(name)


def generate_ros2_control_params_temp_file(ros2_control_params_path, prefix='', add_gripper=False, add_bio_gripper=False, ros_namespace='', update_rate=None, robot_type='xarm'):
if ros_namespace or prefix or add_gripper or add_bio_gripper or update_rate:
if ros_namespace or prefix or update_rate:
with open(ros2_control_params_path, 'r') as f:
ros2_control_params_yaml = yaml.safe_load(f)
if update_rate is not None:
Expand Down Expand Up @@ -63,7 +56,7 @@ def generate_ros2_control_params_temp_file(ros2_control_params_path, prefix='',

add_prefix_to_ros2_control_params(prefix, ros2_control_params_yaml)

if not ros_namespace.startswith('/'):
if ros_namespace and not ros_namespace.startswith('/'):
ros_namespace = f'/{ros_namespace}'

# add namespace, possibly just slash to all nodes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# end-effector
gripper: false
gripper: true
vacuum_gripper: false
bio_gripper: false
realsense_d435i: false
Expand Down
6 changes: 3 additions & 3 deletions xarm_description/config/default_urdf_arguments/xarm6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# hw_ns: 'xarm' # changes at runtime
# ros2_control_plugin: 'uf_robot_hardware/UFRobotSystemHardware' # changes at runtime
# ros2_control_params: '' # changes at runtime
robot_ip: ''
robot_ip: '192.168.1.242'
dof: 6
robot_type: 'xarm'
report_type: 'normal'
Expand All @@ -13,9 +13,9 @@ robot_sn: ''
# control-related
limited: false
effort_control: false
velocity_control: false
velocity_control: true
# urdf-related
attach_to: 'world'
attach_to: 'xarm_device' #TODO: this currently has to match the robot name in the URDF. Fix in gazebo to change frame id.
attach_xyz: '0 0 0'
attach_rpy: '0 0 0'
create_attach_link: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ kinematics:
y: 0
z: 0
roll: -1.5708
pitch: 0
pitch: 0.1
yaw: 0
joint3:
x: 0.0535
y: -0.2845
z: 0
roll: 0
pitch: 0
yaw: 0
yaw: -0.1
joint4:
x: 0.0775
y: 0.3425
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
kinematics:
joint1:
x: 0
y: 0
z: 0.267
roll: 0
pitch: 0
yaw: 0
joint2:
x: 0
y: 0
z: 0
roll: -1.5708
pitch: -0.5
yaw: 0
joint3:
x: 0.0535
y: -0.2845
z: 0
roll: 0
pitch: 0
yaw: -0.5
joint4:
x: 0.0775
y: 0.3425
z: 0
roll: -1.5708
pitch: 0
yaw: 0
joint5:
x: 0
y: 0
z: 0
roll: 1.5708
pitch: -0.95
yaw: 0
joint6:
x: 0.076
y: 0.097
z: 0
roll: -1.5708
pitch: 0
yaw: 0
43 changes: 43 additions & 0 deletions xarm_description/config/kinematics/user/xarm6_kinematics_sim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
kinematics:
joint1:
x: 0
y: 0
z: 0.267
roll: 0
pitch: 0
yaw: 0
joint2:
x: 0
y: 0
z: 0
roll: -1.5708
pitch: -0.5
yaw: 0
joint3:
x: 0.0535
y: -0.2845
z: 0
roll: 0
pitch: 0
yaw: -0.5
joint4:
x: 0.0775
y: 0.3425
z: 0
roll: -1.5708
pitch: 0
yaw: 0
joint5:
x: 0
y: 0
z: 0
roll: 1.5708
pitch: -0.95
yaw: 0
joint6:
x: 0.076
y: 0.097
z: 0
roll: -1.5708
pitch: 0
yaw: 0
5 changes: 0 additions & 5 deletions xarm_description/launch/_robot_description.launch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2021, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>

import os
import sys
Expand Down
27 changes: 14 additions & 13 deletions xarm_description/launch/_robot_joint_state.launch.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2021, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>

from launch import LaunchDescription
from launch.actions import OpaqueFunction, IncludeLaunchDescription, DeclareLaunchArgument
from launch.actions import OpaqueFunction, IncludeLaunchDescription
from launch_ros.actions import Node
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare


def generate_launch_description(context, *args, **kwargs):
def launch_setup(context, *args, **kwargs):
prefix = LaunchConfiguration('prefix', default='')
hw_ns = LaunchConfiguration('hw_ns', default='xarm')
ros2_control_plugin = LaunchConfiguration('ros2_control_plugin', default='uf_robot_hardware/UFRobotSystemHardware')

# robot description launch
# xarm_description/launch/_robot_description.launch.py
robot_description_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(PathJoinSubstitution([FindPackageShare('xarm_description'), 'launch', '_robot_description.launch.py'])),
launch_arguments={
Expand All @@ -39,7 +32,15 @@ def generate_launch_description(context, *args, **kwargs):
parameters=[{'source_list': ['{}{}/joint_states'.format(prefix.perform(context), hw_ns.perform(context))]}],
)

return LaunchDescription([
return [
robot_description_launch,
joint_state_publisher_node,
])
joint_state_publisher_node
]

def generate_launch_description():
return LaunchDescription([
OpaqueFunction(function=launch_setup)
])



Loading