Closed keanudicap closed 5 years ago
sorry for the confusion of the color above. Currently, the goal above is set to be mirror like. However, it should be a constant offset of the initial position.
As I look at your image, I believe that there is not currently a specific goal selector/goal set that will give you what you want.
In principle, the mirror goal selector will reflect the initial positions to the same relative configuration on the left. This assumes that these two configurations are centered on the simulation world's origin.
However, I also see a vertical offset. So, what it really looks like is that the initial position is mirrored over the y-axis around some point (which may or may not be the world origin) and then offset vertically in the +y direction.
As for the question of whether the simulator stops, have you set a goal for reaching that goal and set it to final="1"
?
Do I interpret that picture correctly?
Sorry for the confusion of the image.
Let's say we have a grid of agents, and their initial positions are listed below (I am using a XML notation here):
<Generator type="rect_grid" anchor_x="-5" anchor_y="-1" offset_x="0.75" offset_y="1" count_x="8" count_y="3" />
I want the corresponding goals to be like:
<Generator type="rect_grid" anchor_x="5" anchor_y="-1" offset_x="0.75" offset_y="1" count_x="8" count_y="3" />
Basically, the goal is a 10 offset of the initial position on x axis, and 0 offset on y axis.
as for the question of stop of the simulator: yes, the stop state is set to be final="1"
Sorry to make you repeat yourself -- I realized I'd focused on the picture and missed your follow-up comment about the misleading nature of the picture.
Fortunately, there is a very simple solution to your problem. There is an offset
goal selector type. In looking through the examples, I realize it is not included in any of the examples which is an oversight that needs to be addressed. However, it is exactly the functionality you want.
You can learn about the parameters here. Let me know if you have any questions.
Thanks for the quick reply. I also noticed this 'offset' function and it could solve the problem quite straightforward. The problem is I don't know how to write the actual XML code to implement it. Thanks.
For example, the mirror case, <GoalSelector type="mirror" mirror_x="1" mirror_y="0"/>
, the parameters and related values are not mentioned in the goalselectmirror function. How should we implement the offset goal?
It takes a "2D vector distribution" attribute. Essentially, you'll add a 2D vector to the initial position. What 2D vector gets added depends on the distribution. So, you can get the following:
Offset every agent by exactly <10, 0>
<GoalSelector type="offset" dist="c" x_value="10", y_value="0"/>
Create small box (with length of side = 1) centered at a location <10, 0>
away from the initial position and create the goal by offset the initial position a point drawn from this box with uniform probabilities.
<GoalSelector type="offset" dist="u" min_x="9.5" max_x="10.5" min_y="-0.5" max_y="0.5"/>
Oops -- forget the comma in the first example.
Thanks for the reply. It works!
Regarding the problem of "simulator does not stop", a similar problem is, when agent reaches the goal, it doesn't immediately stops, it looks like it travels ahead a bit and then come back to the goal which results in some oscillation as shown below:
I am using ORCA method. Is it because of some parameters in AgentProfile or somewhere I can tune to make agent stop immediately the first time it reaches the goal?
In its simplest configuration, there will be oscillation. This is due to a couple of reasons:
max_accel
value that means they may not be able to stop instantaneously.You could add a property setting action in the final state which increases the priority of a stopped agent. Then they'll be better able to ignore agents that haven't stopped yet.
Thanks. How do I set the priority in the stop state below in XML file? (there is no example)
`
<VelComponent type="goal" />
</State>`
You can see an example of it in the tradeshow example. In that example, when the agents reach the "Arrive" state, they temporarily set their priority to 1 (with the understanding that everyone defaults to zero).
Curiously, the action has exit_reset="0"
which surprises me. I'll have to look into why that is. For your purposes, it doesn't matter since you'd be doing this in a state with no outward transitions.
Addendum: technically, the tradeshow doesn't set the priority, it adds 1 to the priority. If you want to set it to a specific value, you'd use type="set_property"
instead of type="offset_property"
.
I've set the max_accel
to be large (=10), and also set priority to the stop state to be 10. The oscillation still happens as when these parameters were not set before.
max_accel
has an effect which lower value has larger oscillation, but 5 and 10 makes no big difference. And priority has no effect to oscillation.
Oops. It won't affect ORCA. But if you run it with the pedvo model instead, it should make a difference. PedVO is a derivative of ORCA which includes, among other things, respect for priority.
You can set priority just to 1. Given two agents with priority a
and b
, the different in their priority is always clamped to a maximum value of 1. So, if you have 0 and 10 or 0 and 1, you'll get the same effect.
In this case, it looks like ORCA is not good at stopping at a goal immediately.
~Quick test -- if there's only one agent, does it stop?~
Quick test - Set the final goal to be non final (i.e., final="0"
) and then set it to one agent, does it stop?
Stopped right away.
And using -m pedvo
in conjunction with the Action
in the final state doesn't cause them to behave any differently?
In pedvo method, priority makes difference that in some case, the stopped agent will never be pushed by moving agents, and agents can always stop immediately once reaches the goal no matter this priority is enabled or not. However, in ORCA case. the agents always move overhead a bit, and then go back to goal in multi-agent case.
Yeah. ORCA doesn't understand priority. It always assumes that agents are equal and they all have to share to avoid perceived collisions. PedVO is a variant of ORCA that understands priority and reapportions the responsibility for avoiding collision based on relative priority.
I do have to admit to some surprise that the stopped agents get pushed sometimes. I'll have to look into that.
Thanks for your reply! I will close this issue.
Look through all the examples, the goals have been set as AABB, mirror, point. However, I want to set the goal as a offset of the initial position. like this
I've check the source code and found that there is a goalselectoffset file. I was wondering how I could add that into xml file?
Now, I am using AABB, however, the simulator will never stop. `