robotics-upo / hunav_gazebo_wrapper

A ROS2 wrapper to use the HuNavSim with the Gazebo Simulator
MIT License
18 stars 12 forks source link

Agent's z and h values are ignored #2

Closed sskorol closed 2 years ago

sskorol commented 2 years ago

Hi @noeperez @roberottt,

I use the following agent config for simulation:

hunav_loader:
  ros__parameters:
    map: small_house
    publish_people: true
    agents:
      - agent1
    agent1:
      id: 1
      skin: 3
      behavior: 1
      group_id: -1
      max_vel: 1.5
      radius: 0.5
      init_pose:
        x: 1.866144
        y: 0.323669
        z: 1.250000
        h: 0.0
      goal_radius: 0.3
      cyclic_goals: true
      goals:
        - g0
        - g1
        - g2
        - g3
      g0:
        x: 3.629330
        y: -0.875358
        h: 1.250000
      g1:
        x: 2.938339
        y: -3.290771
        h: 1.250000
      g2:
        x: -0.968620
        y: -3.867865
        h: 1.250000
      g3:
        x: -1.914606
        y: -0.930699
        h: 1.250000

The problem I noticed is that the spawned human doesn't touch the floor and just walks in the air.

flying_model

I tried to set different z and h values. But it doesn't seem to have any effect in Gazebo at all.

Could you please advise what I'm missing here?

sskorol commented 2 years ago

BTW, just noticed in logs:

Screenshot from 2022-11-15 23-33-17

So it seems like some params are ignored. Will double-check the yaml. Maybe it's broken after copy-pasting.

sskorol commented 2 years ago

Nope, we just don't print that info.

Screenshot from 2022-11-16 11-18-04

So the question is still actual: why does the human fly?

sskorol commented 2 years ago

Also checked agent_manager and it seems like z is not used at all. There are 2d vectors everywhere. So how can we correctly position a human in a 3d space?

noeperez commented 2 years ago

Hi,

the z value is just the initial height of the model. It is used to put the model initially in a higher position than the floor or the surface in which the model should walk on. Once the simulation is started, the models fall on the floor/surface (because of the gravity). So, then, the z is not used to navigate anymore.

Regarding the "flying humans", you are right, in the "small_house" and "warehouse" scenarios the humans does not fall properly on the floor and stay a bit higher. We are looking into it and trying to fix it as soon as possible.

sskorol commented 2 years ago

The root cause is here. Z=1.0 works for the small_house. But ideally, it should be taken from z position instead.

noeperez commented 2 years ago

We have fixed the problem. Please, pull the changes. The human agents do not have collisions, and when the simulation starts, they fall to zero height (in the middle of their bodies approximately). So, we need to add an extra height (Z) according to the height of each model in order to put them on the floor (the floor of all the scenarios must be at zero height).

sskorol commented 2 years ago

It's fixed. However, it'd probably make sense to move that magic numbers to some config files instead of hardcoding them in code. As any custom model would require extending this switch, which is not good from a design perspective. Do you agree with that?