Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gen3.launch.py loading default end effector despite blank gripper argument #224

Open
keenan88 opened this issue Jun 13, 2024 · 4 comments
Open

Comments

@keenan88
Copy link

keenan88 commented Jun 13, 2024

Issue Description:
Hello everyone,

I'm currently working with the gen3 robot and facing an issue with the gen3.launch.py file. My objective is to run gen3.launch.py without loading any end effector (specifically, without a gripper). However, even when I set the gripper argument to a blank string in my launch file, the robot is still loaded with an end effector.

I am using a custom end effector setup and do not wish for any gripper to be loaded by default.

Steps Taken:
Installed ros2_kortex with binaries using:
apt install ros-humble-kortex-bringup -y
apt install ros-humble-kinova-gen3-7dof-robotiq-2f-85-moveit-config -y

Files and Resources:
kortex_interface_launch.txt (My launch file)
kortex_interface_output.txt (Output log detailing the issue)
Project repository: https://github.com/keenan88/isaacsim_ros2_greenhouse
Could someone please advise on how I can prevent gen3.launch.py from automatically loading a gripper? Your assistance would be greatly appreciated.

Thank you!

Keenan

@keenan88 keenan88 changed the title Issue with gen3.launch.py loading default end effector despite blank gripper argument gen3.launch.py loading default end effector despite blank gripper argument Jun 13, 2024
@aalmrad
Copy link
Collaborator

aalmrad commented Jun 14, 2024

Hello Keenan,
your question was well received and we are currently working on finding a solution :)

@aalmrad
Copy link
Collaborator

aalmrad commented Jun 17, 2024

After investigating the issue, it seems that our repository is not designed to work with a robotic arm without any gripper. However, we will push a new update to the repository very soon to address this request. In the meantime, we provide the option to build the ros2 packages for Gen3 from source, so feel free to apply the modifications yourself in the meantime.
Here is the modified "gen3.launch.py" file:

# Copyright (c) 2021 PickNik, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Denis Stogl

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir


def generate_launch_description():
    # Declare arguments
    declared_arguments = []
    declared_arguments.append(
        DeclareLaunchArgument(
            "robot_type",
            default_value="gen3",
            description="Type/series of robot.",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "robot_ip",
            description="IP address by which the robot can be reached.",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument("dof", default_value="7", description="DoF of robot.")
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "use_fake_hardware",
            default_value="false",
            description="Start robot with fake hardware mirroring command to its states.",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "fake_sensor_commands",
            default_value="false",
            description="Enable fake command interfaces for sensors used for simple simulations. \
            Used only if 'use_fake_hardware' parameter is true.",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "robot_controller",
            default_value="joint_trajectory_controller",
            description="Robot controller to start.",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "controllers_file",
            default_value="ros2_controllers.yaml",
            description="Robot controller to start.",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "gripper",
            default_value="robotiq_2f_85",
            description="Name of the gripper attached to the arm",
            #choices=["robotiq_2f_85", "robotiq_2f_140"],
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "gripper_joint_name",
            default_value="robotiq_85_left_knuckle_joint",
            description="Name of the gripper attached to the arm",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "use_internal_bus_gripper_comm",
            default_value="true",
            description="Use internal bus for gripper communication?",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "gripper_max_velocity",
            default_value="100.0",
            description="Max velocity for gripper commands",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "gripper_max_force",
            default_value="100.0",
            description="Max force for gripper commands",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument("launch_rviz", default_value="true", description="Launch RViz?")
    )

    # Initialize Arguments
    robot_type = LaunchConfiguration("robot_type")
    robot_ip = LaunchConfiguration("robot_ip")
    dof = LaunchConfiguration("dof")
    use_fake_hardware = LaunchConfiguration("use_fake_hardware")
    fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
    robot_controller = LaunchConfiguration("robot_controller")
    gripper = LaunchConfiguration("gripper")
    use_internal_bus_gripper_comm = LaunchConfiguration("use_internal_bus_gripper_comm")
    gripper_max_velocity = LaunchConfiguration("gripper_max_velocity")
    gripper_max_force = LaunchConfiguration("gripper_max_force")
    gripper_joint_name = LaunchConfiguration("gripper_joint_name")
    launch_rviz = LaunchConfiguration("launch_rviz")
    controllers_file = LaunchConfiguration("controllers_file")


    base_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/kortex_control.launch.py"]),
        launch_arguments={
            "robot_type": robot_type,
            "robot_ip": robot_ip,
            "dof": dof,
            "use_fake_hardware": use_fake_hardware,
            "fake_sensor_commands": fake_sensor_commands,
            "robot_controller": robot_controller,
            "gripper": gripper,
            "use_internal_bus_gripper_comm": use_internal_bus_gripper_comm,
            "gripper_max_velocity": gripper_max_velocity,
            "gripper_max_force": gripper_max_force,
            "gripper_joint_name": gripper_joint_name,
            "launch_rviz": launch_rviz,
            "controllers_file": controllers_file,
            "description_file": "gen3.xacro",
        }.items(),
    )

    return LaunchDescription(declared_arguments + [base_launch])

As you can see the choices=["robotiq_2f_85", "robotiq_2f_140"], line for the gripper argument was commented out and as such, you can now pass an empty value for the gripper argument from the terminal either as "" or '""' so the terminal command line would look like the following if you're not connected to a real-life Gen3:

ros2 launch kortex_bringup gen3.launch.py robot_ip:=yyy.yyy.yyy.yyy use_fake_hardware:=true gripper:='""'

Please make sure to remove your previous binary installation first and to build the corresponding packages after modifying any launch file. I hope this will help you out :)

@keenan88
Copy link
Author

keenan88 commented Jun 18, 2024

Hello,

Thank you for your response. I have installed and built the source code following the steps listed in the latest commit in main (33ec22c), and replaced gen3.launch.py.

ros2 launch kortex_bringup gen3.launch.py robot_ip:=yyy.yyy.yyy.yyy use_fake_hardware:=true gripper:='""'

launches without error, but the robot is stilled launched with the robotiq_85 gripper.

(v2_gen3_launch_output.txt)

image

I can confirm that the source code is installed properly and is the only installation of ros2_kortex, since

get_package_share_directory('kortex_bringup')

returns /home/kortex_ws/install/kortex_bringup/share/kortex_bringup', which is the install directory of the ros2_kortex source code.

Are there further edits required to the source code?

@keenan88
Copy link
Author

keenan88 commented Jun 18, 2024

I have made the following modifications:

gen3.xacro:
Changed the gripper in load_robot macro to be always set to "" instead of $(arg gripper).

kortex_control.launch.py:
Commented out the robot_hand_controller_spawner from nodes_to_launch list.

As a result, the arm is now visible in RVIZ without the end effector when running:

ros2 launch kortex_bringup gen3.launch.py robot_ip:=yyy.yyy.yyy.yyy use_fake_hardware:=true gripper:='""'

image

v3_gen3_launch_output.txt

I have not yet validated movement on the physical arm. This is a case-specific hotfix that solves my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants