Skip to content

Commit

Permalink
Rename static agents param (#185)
Browse files Browse the repository at this point in the history
* Rename and flip condition

* Flip condition in test
  • Loading branch information
aaravpandya authored Jun 12, 2024
1 parent baf86f8 commit 48a1f96
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace gpudrive
.def_rw("useWayMaxModel", &Parameters::useWayMaxModel)
.def_rw("enableLidar", &Parameters::enableLidar)
.def_rw("disableClassicalObs", &Parameters::disableClassicalObs)
.def_rw("initAgentsAsStatic", &Parameters::initAgentsAsStatic);
.def_rw("isStaticAgentControlled", &Parameters::isStaticAgentControlled);

// Define CollisionBehaviour enum
nb::enum_<CollisionBehaviour>(m, "CollisionBehaviour")
Expand Down
2 changes: 1 addition & 1 deletion src/init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace gpudrive
FindRoadObservationsWith roadObservationAlgorithm{
FindRoadObservationsWith::KNearestEntitiesWithRadiusFiltering};
bool initOnlyValidAgentsAtFirstStep = true; // Default: true
bool initAgentsAsStatic = false; // Default: false
bool isStaticAgentControlled = false; // Default: false
bool enableLidar = false;
bool disableClassicalObs = false;
bool useWayMaxModel = false; // Default: false
Expand Down
2 changes: 1 addition & 1 deletion src/level_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static inline Entity createAgent(Engine &ctx, const MapObject &agentInit) {

populateExpertTrajectory(ctx, agent, agentInit);

if(ctx.data().params.initAgentsAsStatic && (ctx.get<Goal>(agent).position - ctx.get<Trajectory>(agent).positions[0]).length() < consts::staticThreshold)
if(!ctx.data().params.isStaticAgentControlled && (ctx.get<Goal>(agent).position - ctx.get<Trajectory>(agent).positions[0]).length() < consts::staticThreshold)
{
ctx.get<ResponseType>(agent) = ResponseType::Static;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ inline void movementSystem(Engine &e,
if(responseType == ResponseType::Static)
{
// Do nothing. The agent is static.
// Agent can only be static if initAgentsAsStatic is set to true.
// Agent can only be static if isStaticAgentControlled is set to true.
return;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def simulation_results():
params.rewardParams = reward_params # Set the rewardParams attribute to the instance created above
params.maxNumControlledVehicles = 0
params.IgnoreNonVehicles = True
params.initAgentsAsStatic = True
params.isStaticAgentControlled = False

# Now use the 'params' instance when creating SimManager
sim = gpudrive.SimManager(
Expand Down

0 comments on commit 48a1f96

Please sign in to comment.