Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG REVIEW: SMARTS segfault #745

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions examples/low_level.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import logging

from envision.client import Client as Envision
from examples import default_argument_parser
from smarts.core.agent import AgentSpec
from smarts.core.agent_interface import AgentInterface, AgentType
from smarts.core.scenario import Scenario
from smarts.core.smarts import SMARTS
from smarts.core.sumo_traffic_simulation import SumoTrafficSimulation

logging.basicConfig(level=logging.INFO)


def main(scenarios, headless, seed):
agent_spec = AgentSpec(
interface=AgentInterface.from_type(AgentType.Laner, max_episode_steps=None),
agent_builder=None,
observation_adapter=None,
)

smarts = SMARTS(
agent_interfaces={},
traffic_sim=SumoTrafficSimulation(headless=True, auto_start=True),
)
smarts2 = SMARTS(
agent_interfaces={},
traffic_sim=SumoTrafficSimulation(headless=True, auto_start=True),
)

scenarios_iterator = Scenario.scenario_variations(
scenarios,
list([]),
)

smarts.reset(next(scenarios_iterator))

for _ in range(80):
smarts.step({})
smarts.attach_sensors_to_vehicles(
agent_spec, smarts.vehicle_index.social_vehicle_ids()
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a social vehicle enters a bubble, sensors are also added to the vehicle, which causes this test to be non-deterministic -- it will sometimes assert from trying to add a sensor twice because of that.

Copy link
Collaborator Author

@Gamenot Gamenot Apr 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two things I could note here:

It is disconcerting that this is non-deterministic, I am unsure what the cause is here but we should get to the bottom of it. I think I will want to merge in the crash generator from #619 and create a variation to try testing for crashes and general determinism.

And the other is that the sensor replacement problem seems to relate to #411.

obs, _, _, _ = smarts.observe_from(smarts.vehicle_index.social_vehicle_ids())

smarts.destroy()
smarts2.destroy()

print("success")


if __name__ == "__main__":
parser = default_argument_parser("observation-collection-example")
args = parser.parse_args()

main(
scenarios=args.scenarios,
headless=args.headless,
seed=args.seed,
)