spear-sim / spear

SPEAR: A Simulator for Photorealistic Embodied AI Research
MIT License
243 stars 18 forks source link

MuJoCo co-sim example #283

Closed RachithP closed 6 months ago

RachithP commented 7 months ago
mikeroberts3000 commented 6 months ago

@RachithP Let's make this include_super_flag=1 cast operation more explicit. Please make a Python enum that matches the C++ enum, similar to how we do this (including comments) in the legacy env.py.

    # before
    unreal_set_actor_location_and_rotation_func = spear_instance.game_world_service.find_function_by_name(
        uclass=unreal_actor_class, name="K2_SetActorLocationAndRotation", include_super_flag=1)

    # after
    unreal_set_actor_location_and_rotation_func = spear_instance.game_world_service.find_function_by_name(
        uclass=unreal_actor_class, name="K2_SetActorLocationAndRotation", include_super_flag=EIncludeSuperFlag.IncludeSuper.value)
mikeroberts3000 commented 6 months ago

@RachithP Let's also include that game_world_service.get_static_class(class_name) in a follow-up PR too. (In conversation recently, we agreed that get_class and get_static_class would both be good to have.) Then we could clean up this code.

    # before
    unreal_actor_classes = list(set([ spear_instance.game_world_service.get_class(unreal_actor) for unreal_actor in unreal_actors.values() ]))
    assert len(unreal_actor_classes) == 1
    unreal_actor_class = unreal_actor_classes[0]

    # after
    unreal_actor_static_class = spear_instance.game_world_service.get_static_class("AActor")
    assert unreal_actor_static_class