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

URDFSpawner <device reference=”link”> does not work when the link is defined in the urdf and not in an existing PROTO #200

Closed
PymZoR opened this issue Dec 13, 2022 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@PymZoR
Copy link
Member

PymZoR commented Dec 13, 2022

Describe the Bug
When defining a robot using only one URDF and no existing PROTO, reference property of the device tag does not work.
In the turtlebot example, it works because the turtlebot already exists in the world file and the urdf is only used for defining webots plugins : https://github.com/cyberbotics/webots_ros2/blob/master/webots_ros2_turtlebot/resource/turtlebot_webots.urdf#L4

Steps to Reproduce
Consider the following urdf :

<?xml version="1.0"?>
<robot name="myrobot"
    xmlns:xacro="http://ros.org/wiki/xacro">

    <!-- Webots -->
    <webots>
        <device reference="laser_link" type="Lidar">
            <ros>
                <enabled>true</enabled>
                <updateRate>5</updateRate>
                <topicName>/scan</topicName>
                <alwaysOn>true</alwaysOn>
                <frameName>laser_link</frameName>
            </ros>
        </device>

        <plugin type="webots_ros2_control::Ros2Control" />
    </webots>

    <!-- BASE LINK -->
    <link name="base_link">
        <visual>
            <origin xyz="0 0 0.075" />
            <geometry>
                <box size="0.3 0.3 0.15" />
            </geometry>
        </visual>
        <collision>
            <origin xyz="0 0 0.075" />
            <geometry>
                <box size="0.3 0.3 0.15" />
            </geometry>
        </collision>
    </link>

    <joint name="laser_link_joint" type="fixed">
        <parent link="base_link" />
        <child link="laser_link" />
        <origin xyz="0 0 1" />
    </joint>

    <!-- LINK2 -->
    <link name="laser_link">
        <!-- Here the link could be empty resulting in only a Transform Node with a Lidar object, but due to issue cyberbotics/urdf2webots#201
        a <collision> tag is required in order for the link to exists in webots -->
        <visual>
            <origin xyz="0 0 0.075" />
            <geometry>
                <box size="0.3 0.3 0.15" />
            </geometry>
        </visual>
        <collision>
            <origin xyz="0 0 0.075" />
            <geometry>
                <box size="0.3 0.3 0.15" />
            </geometry>
        </collision>
    </link>
</robot>

NOTE : I added <collision> and <visual> tags to the laser_link otherwise it is not created in webots. Probably linked to the issue : #201

The laser_link is not created, nor the Lidar object.

Expected behavior
A Lidar object should exist in Webots and the ROS ropic /scan should be advertised.

Affected Packages
List of affected packages:

  • webots_ros2_driver

System

  • Webots Version: R2023a for macOS
  • ROS Version: Humble
  • Operating System: Ubuntu jammy in docker, host macOS Monterey 12.2.1, using local_simulation_server.py
@CraigMS-dev
Copy link

Was this ever solved? I have the same issue at the moment and I still haven't figured out how to get a Lidar (from any device) created from a pure urdf robot.

@ygoumaz
Copy link
Contributor

ygoumaz commented Apr 4, 2023

I am transferring this issue to Urdf2Webots repository, as it directly concerns the importer. The way to import a Lidar has been answered here: https://robotics.stackexchange.com/questions/24596/how-do-i-integrate-webots-sensor-plugins-into-a-ros2-urdf-xacro-file. The combination of gazebo and sensor tags allows to import Webots devices from URDFs and to use them with webots_ros2 plugins.

@ygoumaz ygoumaz transferred this issue from cyberbotics/webots_ros2 Apr 4, 2023
@ygoumaz ygoumaz self-assigned this Apr 4, 2023
@ygoumaz ygoumaz added the question Further information is requested label Apr 4, 2023
@ygoumaz
Copy link
Contributor

ygoumaz commented Apr 4, 2023

@omichel Is there a reason why the <gazebo> tag is mandatory to import sensors? Is it because urdf2webots was first (and only?) intended to convert gazebo URDFs to Webots PROTOs? If this is the case we may extend it to single <sensor> tags, as URDFs may be used in webots_ros2 and created from scratch. On another hand, it may be good to encourage users to create their robots in PROTO format. Any thoughts?

@omichel
Copy link
Member

omichel commented Apr 11, 2023

Yes, this <gazebo> tag was supported to ease the Webots conversion from URDF files designed for Gazebo.
I agree it is way better to create and maintain a robot model as a Webots PROTO file and use Webots to export the corresponding URDF model for use with ROS nodes.

@ygoumaz ygoumaz closed this as completed Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

4 participants