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

Reset/Delete services crash when spawning model with ackermann plugin #1904

Open
retinfai opened this issue Feb 20, 2023 · 4 comments
Open
Assignees
Labels
bug Something isn't working help wanted We accept pull requests!

Comments

@retinfai
Copy link
Contributor

retinfai commented Feb 20, 2023

Environment

  • OS Version: Ubuntu 22.04
  • Source or binary build? Binary Garden

Description

  • Expected behavior:
    Resetting or Deleting a model does so gracefully

  • Actual behavior:
    When spawning a model with the ackermann steering plugin after already starting the simulation, then resetting/deleting the model, results in crash.

Resetting simulation results in segmentation fault
Deleting model causes error spams

Steps to reproduce

Prereq:
extract the ackermann_steering example car into it's own sdf, so we can spawn after starting the simulation. For this purpose, this file is referred to as car.sdf

# Start Simulation
gz sim empty.sdf
# Spawn Model
gz service -s /world/empty/create --reqtype gz.msgs.EntityFactory --reptype gz.msgs.Boolean --timeout 1000 --req 'sdf_filename: "path/to/car.sdf", name: "blue-car"'
# ResetWorld
gz service -s /world/empty/control --reqtype gz.msgs.WorldControl --reptype gz.msgs.Boolean --timeout 3000 --req 'reset: {all: true}'

or

# Delete Model
gz service -s world/empty/remove --reqtype gz.msgs.Entity --reptype gz.msgs.Boolean --timeout 1000 --req 'type: 2, name: "blue-car"'

Output

For resetting simulation:

Stack trace (most recent call last) in thread 1493792:
#6    Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in 
#5    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6b89c2a9ff, in 
#4    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6b89b98b42, in 
#3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f6b8538d2b2, in 
#2    Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7f6b8474c82d, in 
#1    Object "/usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/libgz-sim-ackermann-steering-system.so", at 0x7f6b550d391d, in non-virtual thunk to gz::sim::v7::systems::AckermannSteering::PostUpdate(gz::sim::v7::UpdateInfo const&, gz::sim::v7::EntityComponentManager const&)
#0    Object "/usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/libgz-sim-ackermann-steering-system.so", at 0x7f6b550cac4c, in gz::sim::v7::systems::AckermannSteeringPrivate::UpdateVelocity(gz::sim::v7::UpdateInfo const&, gz::sim::v7::EntityComponentManager const&)
Segmentation fault (Address not mapped to object [(nil)])

For deleting the model:
Identical errors to previous issue #1107

[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [32], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [34], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [33], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [35], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [30], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [31], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [8319580315957903596] attached to entity [32], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [8319580315957903596] attached to entity [33], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [8319580315957903596] attached to entity [30], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [8319580315957903596] attached to entity [31], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [32], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [34], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [33], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [35], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [30], but this entity does not exist. This create component request will be ignored.
[Err] [EntityComponentManager.cc:1047] Trying to create a component of type [10078773228734069488] attached to entity [31], but this entity does not exist. This create component request will be ignored.
@retinfai retinfai added the bug Something isn't working label Feb 20, 2023
@azeey azeey added the help wanted We accept pull requests! label Feb 27, 2023
@bperseghetti
Copy link
Member

bperseghetti commented Feb 27, 2023

@retinfai can you include your "blue car" model or your "car.sdf" ?
Also please provide the current version of garden that you are on from the output of gz sim --version.

@retinfai
Copy link
Contributor Author

Sorry for not putting this in the issue.

Here iscar.sdf. Taken from ackermann steering gazebo examples

<?xml version="1.0" ?>

<sdf version="1.6">
	<model name='vehicle_blue'>
	<pose>0 2 0.325 0 -0 0</pose>

      <link name='chassis'>
        <pose>-0.151427 -0 0.175 0 -0 0</pose>
        <inertial>
          <mass>1.14395</mass>
          <inertia>
            <ixx>0.126164</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.416519</iyy>
            <iyz>0</iyz>
            <izz>0.481014</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <geometry>
            <box>
              <size>2.01142 1 0.568726</size>
            </box>
          </geometry>
          <material>
            <ambient>0.5 0.5 1.0 1</ambient>
            <diffuse>0.5 0.5 1.0 1</diffuse>
            <specular>0.0 0.0 1.0 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <box>
              <size>2.01142 1 0.568726</size>
            </box>
          </geometry>
        </collision>
      </link>

      <link name='front_left_wheel'>
        <pose>0.554283 0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>0.5</mu>
                <mu2>1.0</mu2>
                <fdir1>0 0 1</fdir1>
              </ode>
              <bullet>
                <friction>0.5</friction>
                <friction2>1</friction2>
                <rolling_friction>0.1</rolling_friction>
              </bullet>
            </friction>
          </surface>
        </collision>
      </link>

      <link name='rear_left_wheel'>
        <pose>-0.957138 0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>0.5</mu>
                <mu2>1.0</mu2>
                <fdir1>0 0 1</fdir1>
              </ode>
              <bullet>
                <friction>0.5</friction>
                <friction2>1</friction2>
                <rolling_friction>0.5</rolling_friction>
              </bullet>
            </friction>
          </surface>
        </collision>
      </link>

      <link name='front_right_wheel'>
        <pose>0.554282 -0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
           <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>0.5</mu>
                <mu2>1.0</mu2>
                <fdir1>0 0 1</fdir1>
              </ode>
              <bullet>
                <friction>0.5</friction>
                <friction2>1</friction2>
                <rolling_friction>0.1</rolling_friction>
              </bullet>
            </friction>
          </surface>
        </collision>
      </link>

      <link name='rear_right_wheel'>
        <pose>-0.957138 -0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <cylinder>
              <length>0.15</length>
              <radius>0.3</radius>
            </cylinder>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>0.5</mu>
                <mu2>1.0</mu2>
                <fdir1>0 0 1</fdir1>
              </ode>
              <bullet>
                <friction>0.5</friction>
                <friction2>1</friction2>
                <rolling_friction>0.5</rolling_friction>
              </bullet>
            </friction>
          </surface>
        </collision>
      </link>

      <link name="front_left_wheel_steering_link">
        <pose>0.554283 0.5 0.02 0 0 0</pose>
        <inertial>
          <mass>0.5</mass>
          <inertia>
            <ixx>0.0153</ixx>
            <iyy>0.025</iyy>
            <izz>0.0153</izz>
          </inertia>
        </inertial>
        <visual name="steering_link_visual">
          <pose>0 0 0 0 0 0</pose>
          <geometry>
            <cylinder>
              <length>0.1</length>
              <radius>0.03</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>1 1 1</ambient>
            <diffuse>1 1 1</diffuse>
          </material>
        </visual>
      </link>

      <link name="front_right_wheel_steering_link">
        <pose>0.554283 -0.5 0.02 0 0 0</pose>
        <inertial>
          <mass>0.5</mass>
          <inertia>
            <ixx>0.0153</ixx>
            <iyy>0.025</iyy>
            <izz>0.0153</izz>
          </inertia>
        </inertial>
        <visual name="steering_link_visual">
          <pose>0 0 0 0 0 0</pose>
          <geometry>
            <cylinder>
              <length>0.1</length>
              <radius>0.03</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>1 1 1</ambient>
            <diffuse>1 1 1</diffuse>
          </material>
        </visual>
      </link>

      <joint name="front_left_wheel_steering_joint" type="revolute">
        <child>front_left_wheel_steering_link</child>
        <parent>chassis</parent>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-0.6</lower>
            <upper>+0.6</upper>
            <velocity>1.0</velocity>
            <effort>25</effort>
          </limit>
          <use_parent_model_frame>1</use_parent_model_frame>
        </axis>
      </joint>

      <joint name="front_right_wheel_steering_joint" type="revolute">
        <parent>chassis</parent>
        <child>front_right_wheel_steering_link</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-0.6</lower>
            <upper>+0.6</upper>
            <velocity>1.0</velocity>
            <effort>25</effort>
          </limit>
        </axis>
      </joint>

      <joint name='front_left_wheel_joint' type='revolute'>
        <parent>front_left_wheel_steering_link</parent>
        <child>front_left_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <joint name='front_right_wheel_joint' type='revolute'>
        <parent>front_right_wheel_steering_link</parent>
        <child>front_right_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <joint name='rear_left_wheel_joint' type='revolute'>
        <parent>chassis</parent>
        <child>rear_left_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <joint name='rear_right_wheel_joint' type='revolute'>
        <parent>chassis</parent>
        <child>rear_right_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <plugin
        filename="gz-sim-ackermann-steering-system"
        name="gz::sim::systems::AckermannSteering">
        <left_joint>front_left_wheel_joint</left_joint>
        <left_joint>rear_left_wheel_joint</left_joint>
        <right_joint>front_right_wheel_joint</right_joint>
        <right_joint>rear_right_wheel_joint</right_joint>
        <left_steering_joint>front_left_wheel_steering_joint</left_steering_joint>
        <right_steering_joint>front_right_wheel_steering_joint</right_steering_joint>
        <kingpin_width>1.0</kingpin_width>
        <steering_limit>0.5</steering_limit>
        <wheel_base>1.0</wheel_base>
        <wheel_separation>1.25</wheel_separation>
        <wheel_radius>0.3</wheel_radius>
        <min_velocity>-1</min_velocity>
        <max_velocity>3</max_velocity>
        <min_acceleration>-3</min_acceleration>
        <max_acceleration>3</max_acceleration>
      </plugin>
      
      <plugin
        filename="gz-sim-pose-publisher-system"
        name="gz::sim::systems::PosePublisher">
        <publish_link_pose>false</publish_link_pose>
        <publish_collision_pose>false</publish_collision_pose>
        <publish_visual_pose>false</publish_visual_pose>
        <publish_nested_model_pose>true</publish_nested_model_pose>
      </plugin>

    </model> 


</sdf>

The gazebo version is 7.3.0

@retinfai
Copy link
Contributor Author

I found this in the System Manager:

  /// \brief Perform a reset on all systems
  ///
  /// If a system implements the ISystemReset interface, it will be called.
  //
  /// Otherwise, if a system does not have the ISystemReset interface
  /// implemented, and was created via loading a plugin,
  /// that plugin will be reloaded.
  ///
  /// Otherwise, if a system is created from in-memory rather than a plugin,
  /// that system will remain unaffected.

Just wanted to ask what the last part is talking about. If you spawn an entity, is this creating the systems that the entity has from in-memory?

@azeey
Copy link
Contributor

azeey commented May 3, 2023

I found this in the System Manager:

  /// \brief Perform a reset on all systems
  ///
  /// If a system implements the ISystemReset interface, it will be called.
  //
  /// Otherwise, if a system does not have the ISystemReset interface
  /// implemented, and was created via loading a plugin,
  /// that plugin will be reloaded.
  ///
  /// Otherwise, if a system is created from in-memory rather than a plugin,
  /// that system will remain unaffected.

Just wanted to ask what the last part is talking about. If you spawn an entity, is this creating the systems that the entity has from in-memory?

It's possible to add systems from shared_ptr instances of a class that implements the System interfaces as opposed to being loaded from a shared library (plugin). This was added in #936 for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted We accept pull requests!
Projects
Status: To do
Development

No branches or pull requests

3 participants