ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Unable to load panda.urdf.xacro in gazebo fortress

asked 2023-05-25 11:42:16 -0500

benthebear93 gravatar image

updated 2023-05-25 11:45:47 -0500

Ubuntu : 22.04 Ros version : Rolling gazebo : fortress

i am trying to load a panda robot in gazebo fortress but couldn't really find any basic tutorial.

so i tried to write some launch files but couldn't really load a robot in to gazebo.

def generate_launch_description(): pkg_panda= get_package_share_directory('moveit_resources_panda_moveit_config')

moveit_config = (
    MoveItConfigsBuilder(
        robot_name="panda", package_name="moveit_resources_panda_moveit_config"
    )
    .robot_description(file_path="config/panda.urdf.xacro")
    .trajectory_execution(file_path="config/gripper_moveit_controllers.yaml")
    .moveit_cpp(
        file_path=get_package_share_directory("get_antipodal")
        + "/config/panda_test.yaml"
    )
    .to_moveit_configs()
)

xacro_file = os.path.join(pkg_panda,
                          'config',
                          'panda.urdf.xacro')

doc = xacro.parse(open(xacro_file))
xacro.process_doc(doc)
params = {'robot_description': doc.toxml()}

rviz_config_file = os.path.join(
    get_package_share_directory("get_antipodal"),
    "config",
    "panda_test.rviz",
)

rviz_node = Node(
    package="rviz2",
    executable="rviz2",
    name="rviz2",
    output="log",
    arguments=["-d", rviz_config_file],
    parameters=[
        moveit_config.robot_description,
        moveit_config.robot_description_semantic,
    ],
)

spawn_entity_node = Node(
    package='ros_gz_sim', 
    executable='create',
    arguments=[
        '-name', 'panda',
        '-string', doc.toxml(),
        '-x', '0',
        '-y', '0',
        '-z', '0.025',
        '-R', '0',
        '-P', '0',
        '-Y', '0'
    ],
    output='screen'
)

#robot state publisher
robot_state_publisher = Node(
    package="robot_state_publisher",
    executable="robot_state_publisher",
    name="robot_state_publisher",
    output="log",
    parameters=[moveit_config.robot_description],
)

# Gazebo Sim
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')

gazebo = IncludeLaunchDescription(
    PythonLaunchDescriptionSource(
        os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')
    ),
    launch_arguments={'gz_args': '-r empty.sdf'}.items(),
)   

ros2_controllers_path = os.path.join(
    get_package_share_directory("moveit_resources_panda_moveit_config"),
    "config",
    "ros2_controllers.yaml",
)

ros2_control_node = Node(
    package="controller_manager",
    executable="ros2_control_node",
    parameters=[moveit_config.robot_description, ros2_controllers_path],
    output="log",
)

load_controllers = []
for controller in [
    "panda_arm_controller",
    "panda_hand_controller",
    "joint_state_broadcaster",
]:
    load_controllers += [
        ExecuteProcess(
            cmd=["ros2 run controller_manager spawner {}".format(controller)],
            shell=True,
            output="log",
        )
    ]
return LaunchDescription(
    [
        robot_state_publisher,
        ros2_control_node,
        rviz_node,
        gazebo,
        spawn_entity_node,
    ]
    + load_controllers
)

and these error keep shows.

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 16: Msg: A model must have at least one link.

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 16: Msg: A model must have at least one link.

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 24: Msg: FrameAttachedToGraph error: scope context name[] does not match __model__ or world.

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 22: Msg: attached_to name[panda_link7] specified by frame with name[panda_joint8] does not match a nested model, link, joint, or frame name in model with name[panda].

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 27: Msg: PoseRelativeToGraph error, Vertex with name [panda::panda_joint8] is disconnected; it should have 1 incoming edge in MODEL relative_to graph.

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 27: Msg: PoseRelativeToGraph unable to find path to source vertex when starting from vertex with id [4].

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 27: Msg: PoseRelativeToGraph unable to find path to source vertex when starting from vertex with id [3].

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 27: Msg: PoseRelativeToGraph unable to find path to source vertex when starting from vertex with id [5].

[ruby $(which ign) gazebo-4] [Err] [UserCommands.cc:1138] Error Code 27: Msg: PoseRelativeToGraph unable to find path to source vertex when starting from vertex with id [6].

Any other simple example, such as gz_ros2_control_demos works fine. even copy paste launch file from gz_ros2_control_demos to my launch ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-26 06:49:41 -0500

benthebear93 gravatar image

I was able to resolve this error by adding inertia to URDF file.

check this issue : https://github.com/gazebosim/gazebo-c...

from https://answers.gazebosim.org//questi...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-05-25 11:42:16 -0500

Seen: 169 times

Last updated: May 26 '23