def save_checkpoint(simulator, root_directory):
    bullet_path = os.path.join(root_directory, ('%d.bullet' % simulator.frame_count))
    json_path = os.path.join(root_directory, ('%d.json' % simulator.frame_count))
    p.saveBullet(bullet_path)
    with open(json_path, 'w') as f:
        json.dump(save_internal_states(simulator), f)
    return simulator.frame_count
def save_checkpoint(simulator, root_directory):
    bullet_path = os.path.join(root_directory, ('%d.bullet' % simulator.frame_count))
    json_path = os.path.join(root_directory, ('%d.json' % simulator.frame_count))
    p.saveBullet(bullet_path)
    with open(json_path, 'w') as f:
        json.dump(save_internal_states(simulator), f)
    return simulator.frame_count