Open fverdoja opened 3 years ago
I think you forget to add the type parameter in agent tag
<agent dx="0.5" dy="0.5" n="1" x="18" y="7" type="1">
Also you should add the robot to the scene by adding type="2". Here is the scene file I have created before:
<?xml version="1.0" encoding="UTF-8"?>
<scenario>
<!--Obstacles-->
<waypoint id="start1" x="10" y="4" />
<waypoint id="goal1" x="10" y="4" />
<agent x="10" y="4" n="1" dx="0" dy="0" type="1">
<addwaypoint id="goal1"/>
<addwaypoint id="start1"/>
</agent>
<waypoint id="start8" x="40" y="1" />
<waypoint id="goal8" x="4" y="1" />
<!--robot-->
<agent x="1" y="4" n="1" dx="0" dy="0" type="2">
<addwaypoint id="goal8"/>
<addwaypoint id="start8"/>
</agent>
</scenario>
Hi, thanks for your answer.
Thanks for pointing out I was missing the type
tag.
The example you provided works, however, if I remove any of the two agents (so only the robot or only the human is left) no agent gets spawn, regardless of if they have type
tag 1 or 2, or no type
tag at all.
Is that an intended behaviour?
I have the same problem.
Hello @fverdoja and @fagnerpimentel,
As far as I experience, the robot is spawned even you remove any of the two agent. If you can give precise information about what you want to do then maybe we can solve it.
Hi, I am trying to run the simulator without the robot present to record people movement tracks. I would like to be able to spawn different amounts of (non robot) agents each time, but when I try to spawn one, no agent is spawn instead.
Hi, @kivrakh thank you for the help. I just put a type 2 agent in my XML scenario as you show.
<agent x="0" y="0" n="1" dx="0" dy="0" type="2"/>
But I agree with the @fverdoja. This may be not the intended behavior.
This works: (1 person and 1 robot)
<scenario>
<agent x="0" y="0" n="1" dx="0" dy="0" type="2"/>
<agent dx="2" dy="2" n="1" x="0" y="0" type="0"/>
</scenario>
This works: (2 persons)
<scenario>
<agent dx="2" dy="2" n="2" x="0" y="0" type="0"/>
</scenario>
This not works: (1 person)
<scenario>
<agent dx="2" dy="2" n="1" x="0" y="0" type="0"/>
</scenario>
Hi guys, I think I found the problem.
In this file, at lines 291-293: https://github.com/srl-freiburg/pedsim_ros/blob/master/pedsim_simulator/src/simulator.cpp
there is this condition:
if (SCENE.getAgents().size() < 2) {
return;
}
I don't know why this is there but seems there is no problem if you remove it since this function is just to publish the agents.
Just comment or delete these lines, run catkin_make and it is done. It should work for only one person now.
<scenario>
<agent dx="2" dy="2" n="1" x="0" y="0" type="0"/>
</scenario>
Yep, that works @fagnerpimentel. Nice job!
Hi, I was trying to create a scenario where a single agent was defined. Something like:
However, having agent with property
n="1"
doesn't actually spawn any agent. None is shown in rviz, and no pose is published in the corresponding topic. I tried also omitting then
property, or setting it ton="0"
andn="-1"
but it achieves the same effect. I tried also playing around withdx
anddy
to no avail.Is this a bug? From the pedsim documentation it seems it should be possible:
If it is working as intended, is there any way to define a single agent instead of a group?