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

Segmentation fault when ros2_control tag has no gazebo description #125

Open
delipl opened this issue May 13, 2022 · 0 comments
Open

Segmentation fault when ros2_control tag has no gazebo description #125

delipl opened this issue May 13, 2022 · 0 comments

Comments

@delipl
Copy link
Contributor

delipl commented May 13, 2022

Hello,
I have found an interesting bug during switching between the simulation and the real robot.

This is the error:

[gzserver-1] [INFO] [1651705814.192470228] [gazebo_ros2_control]: Loading joint: id_3
[gzserver-1] [INFO] [1651705814.192480124] [gazebo_ros2_control]:       Command:
[gzserver-1] [INFO] [1651705814.192489733] [gazebo_ros2_control]:                position
[gzserver-1] [INFO] [1651705814.192499904] [gazebo_ros2_control]:       State:
[gzserver-1] [INFO] [1651705814.192510058] [gazebo_ros2_control]:                position
[gzserver-1] [INFO] [1651705814.192520313] [gazebo_ros2_control]:                velocity
[gzserver-1] [INFO] [1651705814.192530941] [gazebo_ros2_control]:                effort
[gzserver-1] Segmentation fault (core dumped)
[ERROR] [gzserver-1]: process has died [pid 32467, exit code 139, ...]

This is my ros2_control.xacro description what throws segmentation fault

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

    <xacro:macro name="ariadna_system_position_only" params="name use_sim use_hw_stubs">

        <ros2_control name="${name}" type="system">

            <xacro:if value="${use_sim}">
                <hardware>
                    <plugin>gazebo_ros2_control/GazeboSystem</plugin>
                </hardware>
                <joint name="right_wheel_0_joint">
                    <command_interface name="velocity">
                        <param name="min">-1</param>
                        <param name="max">1</param>
                    </command_interface>
                    <state_interface name="position" />
                    <state_interface name="velocity" />
                </joint>
                <joint name="left_wheel_0_joint">
                    <command_interface name="velocity">
                        <param name="min">-1</param>
                        <param name="max">1</param>
                    </command_interface>
                    <state_interface name="position" />
                    <state_interface name="velocity" />
                </joint>
            </xacro:if>

            <xacro:unless value="${use_sim}">
                <hardware>
                    <plugin>ariadna_manipulator_hardware/AriadnaManipulatorHardware</plugin>
                    <param name="usb_port">/dev/ttyUSB0</param>
                    <param name="baud_rate">57600</param>
                    <param name="joint_ids">1,2,3</param>
                    <xacro:if value="${use_hw_stubs}">
                        <param name="use_stub">true</param>
                    </xacro:if>
                </hardware>
            </xacro:unless>

            <joint name="id_1">
                <param name="id">1</param>
                <param name="Return_Delay_Time">0</param>
                <param name="CW_Angle_Limit">0</param>
                <param name="CCW_Angle_Limit">1023</param>
                <param name="Moving_Speed">1023</param>
                <command_interface name="position" />
                <state_interface name="position" />
                <state_interface name="velocity" />
                <state_interface name="effort" />
            </joint>
            <joint name="id_2">
                <param name="id">2</param>
                <param name="Return_Delay_Time">0</param>
                <param name="CW_Angle_Limit">0</param>
                <param name="CCW_Angle_Limit">1023</param>
                <param name="Moving_Speed">1023</param>
                <command_interface name="position" />
                <state_interface name="position" />
                <state_interface name="velocity" />
                <state_interface name="effort" />
            </joint>
            <joint name="id_3">
                <param name="id">3</param>
                <param name="Return_Delay_Time">0</param>
                <param name="CW_Angle_Limit">0</param>
                <param name="CCW_Angle_Limit">1023</param>
                <param name="Moving_Speed">1023</param>
                <command_interface name="position" />
                <state_interface name="position" />
                <state_interface name="velocity" />
                <state_interface name="effort" />
            </joint>
        </ros2_control>

        <ros2_control name="${name}_odrive" type="system">
            <xacro:unless value="$(arg use_sim)">
                <hardware>
                    <plugin>ariadna_odrive_hardware/AriadnaOdriveHardware</plugin>
                    <param name="velocity_limit">5</param>
                     <xacro:if value="${use_hw_stubs}">
                        <param name="use_stub">true</param>
                    </xacro:if>
                </hardware>
            </xacro:unless>

            <joint name="back_left_gear_joint">
                <param name="id">-1</param>
                <command_interface name="velocity" />
                <state_interface name="position" />
                <state_interface name="velocity" />
            </joint>
            
            <joint name="back_right_gear_joint">
                <param name="id">1</param>
                <command_interface name="velocity" />
                <state_interface name="position" />
                <state_interface name="velocity" />
            </joint>
        </ros2_control>

        <ros2_control name="AriadnaGripper" type="actuator">
            <xacro:if value="${use_sim}">
                <hardware>
                    <plugin>gazebo_ros2_control/GazeboSystem</plugin>
                </hardware>
            </xacro:if>
            <xacro:unless value="${use_sim}">
                <hardware>
                    <plugin>ariadna_electromagnet_hardware/AriadnaElectromagnetHardware</plugin>
                    <xacro:if value="${use_hw_stubs}">
                        <param name="use_stub">true</param>
                    </xacro:if>
                </hardware>
            </xacro:unless>
            <joint name="gripper_tool_joint">
                <command_interface name="effort"/>
                <state_interface name="effort" />
                <state_interface name="position" />
            </joint>
        </ros2_control>
    </xacro:macro>

</robot>

In tag <ros2_control name="${name}_odrive" type="system"> there is no <plugin>gazebo_ros2_control/GazeboSystem</plugin>.

When I split the motors and manipulator like below and now the <plugin>gazebo_ros2_control/GazeboSystem</plugin> tag existis in the ros2_control tag and error don't pops up.

 <ros2_control name="${name}_motors" type="system">
            <xacro:if value="${use_sim}">
                <hardware>
                    <plugin>gazebo_ros2_control/GazeboSystem</plugin>
                </hardware>
                <joint name="right_wheel_0_joint">
                    <command_interface name="velocity">
                        <param name="min">-1</param>
                        <param name="max">1</param>
                    </command_interface>
                    <state_interface name="position" />
                    <state_interface name="velocity" />
                </joint>
                <joint name="left_wheel_0_joint">
                    <command_interface name="velocity">
                        <param name="min">-1</param>
                        <param name="max">1</param>
                    </command_interface>
                    <state_interface name="position" />
                    <state_interface name="velocity" />
                </joint>
            </xacro:if>

I know this is my mistake in the description but the error could be described.
It would be great if this segmentation was fixed.

Regards,
Deli

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

1 participant