Skip to content

bug calling callback #38

@nashmit

Description

@nashmit

When you define your "callback" function the desired behavior is to get it triggered once every "callback_period" times.
What happens instead is that it also gets triggered by any control applied in the window ( e.g. mouse pressed, key pressed, etc ) hence, the "callback" function gets activated more times than it should be.

urdf_path = "robot-assets/urdfs/robots/franka_panda/panda.urdf"


class Viewer(viewer.windowed.SceneViewer):
    def __init__(self, scene, callback, callback_period, start_loop, profile):
        super().__init__(scene,
                         callback=callback,
                         callback_period=callback_period,
                         start_loop=start_loop,
                         profile=profile)

Scene=yourdfpy.URDF.load(
    urdf_path,
    load_meshes=True,
    #load_collision_meshes=True,
    #build_collision_scene_graph=True,
    build_scene_graph=True
)

def updateScene(scene):
    cfg = Scene.cfg
    cfg[1]=cfg[1]+3.14/32
    Scene.update_cfg(cfg)
    scene = Scene.scene
    pass

view = Viewer(Scene.scene,
              callback=updateScene,
              callback_period=5,
              start_loop=True,
              profile=False)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions