Skip to content

Commit

Permalink
Remove rescaling of agent coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravpandya committed May 5, 2024
1 parent dd226e0 commit 814f44e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/level_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ static inline Entity createAgent(Engine &ctx, const MapObject &agentInit) {
// values are retained so that on an episode reset they can be restored to
// their initial values.
auto &trajectory = ctx.get<Trajectory>(agent);
auto length = agentInit.length/2;
auto width = agentInit.width/2;
for(CountT i = 0; i < agentInit.numPositions; i++)
{
trajectory.positions[i] = Vector2{.x = agentInit.position[i].x - ctx.data().mean.x + length, .y = agentInit.position[i].y - ctx.data().mean.y + width};
trajectory.positions[i] = Vector2{.x = agentInit.position[i].x - ctx.data().mean.x, .y = agentInit.position[i].y - ctx.data().mean.y};
trajectory.velocities[i] = Vector2{.x = agentInit.velocity[i].x, .y = agentInit.velocity[i].y};
trajectory.headings[i] = toRadians(agentInit.heading[i]);
trajectory.valids[i] = agentInit.valid[i];
Expand Down
7 changes: 2 additions & 5 deletions tests/bicyclemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ class BicycleKinematicModelTest : public ::testing::Test {
}
agent_length_map[n_agents] = (float)obj["length"];
agent_width_map[n_agents] = (float)obj["width"];
auto length = agent_length_map[n_agents] / 2;
auto width = agent_width_map[n_agents] / 2;
auto x = float(obj["position"][0]["x"]);
initialState.push_back(float(obj["position"][0]["x"]) - mean.first + length);
initialState.push_back(float(obj["position"][0]["y"]) - mean.second + width);
initialState.push_back(float(obj["position"][0]["x"]) - mean.first);
initialState.push_back(float(obj["position"][0]["y"]) - mean.second);
initialState.push_back(test_utils::degreesToRadians(obj["heading"][0]));
initialState.push_back(math::Vector2{.x = obj["velocity"][0]["x"], .y = obj["velocity"][0]["y"]}.length());
n_agents++;
Expand Down

0 comments on commit 814f44e

Please sign in to comment.