robotology / icub-models-generator

Resources and programs to generated models (URDF, SDF) of the iCub robot
14 stars 23 forks source link

icub3: add xml files for running mc and ft ros2 nws #228

Closed Nicogene closed 1 year ago

Nicogene commented 1 year ago

This PR adds the xml files for running the controlboard ros2 nws for icub3.

I edited the urdf in order to use icub_ROS2.xml file and I run:

ros2 launch robot_state_publisher.py

Where robot_state_publisher.py is

import os
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node

def generate_launch_description():

    use_sim_time = LaunchConfiguration('use_sim_time', default='false')

    #urdf = os.path.abspath("/home/ngenesio/icub-tech-iit/ergocub-gazebo-simulations/models/stickBot/model.urdf")
    urdf = os.path.abspath("/home/ngenesio/robotology/icub-models-generator/build/iCub/robots/iCubGazeboV3/model.urdf")
    with open(urdf, 'r') as infp:
        robot_desc = infp.read()

    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),
        Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            name='robot_state_publisher',
            output='screen',
            parameters=[{'use_sim_time': use_sim_time, 'robot_description': robot_desc}],
            arguments=[urdf])
    ])

Then we can decide how to run the robot_state_publisher in a more elegant way.

immagine

cc @traversaro @maggia80 @randaz81 @elandini84 @pattacini

Nicogene commented 1 year ago

I could not visualize the meshes for this issue: https://github.com/robotology/icub-models-generator/issues/229

Nicogene commented 1 year ago

With https://github.com/robotology/simmechanics-to-urdf/pull/53 I was able to correctly export the ft frames and then visualize the measurements in rviz

immagine

cc @maggia80 @pattacini @traversaro @randaz81 @elandini84

Nicogene commented 1 year ago

The PR is ready to be merged, I removed icub_ROS2.xml from the urdf.

Moreover this PR fixes this failure https://github.com/robotology/icub-models-generator/actions/runs/3754390994

traversaro commented 1 year ago

Should we write (even a brief) piece of documentation somewere on how to use this configuration files?

Nicogene commented 1 year ago

Should we write (even a brief) piece of documentation somewere on how to use this configuration files?

Right now it is in a sort of hacky state, I could not keep icub_ROS2.xml in the generation of the urdf otherwise who don't have the ros2 nws won't be able to run the model, if someone want to use it has to manually change this line:

https://github.com/robotology/icub-models-generator/blob/3e86dd0d904c01ae5eb225955cb5571c6a9731f3/simmechanics/data/icub3/ICUB_3_all_options_gazebo.yaml.in#L934

Or change it directly in the generated urdf.

Then run robot_state_publisher as you prefer, from command line or launch file like https://github.com/robotology/icub-models-generator/pull/228#issue-1482170790

If you want I can write these steps, but they are not very "clean"

traversaro commented 1 year ago

If you want I can write these steps, but they are not very "clean"

Yes, I agree that they are not clean (idealy, we should not touch files installed by icub-models) but I think that we should document this, otherwise the files can't be used.

Can you open a PR on icub-models to document this? Thanks! Note that I would just keep the description of the modification of the generated file, as tipically users of the models do not interact with icub-model-generator at all. Then we can probably open an issue to track how to handle this in a clean way.

Nicogene commented 1 year ago

PR in icub-models opened: https://github.com/robotology/icub-models/pull/184

We need first merge this PR.

traversaro commented 1 year ago

Thanks!