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

Pepper robot suddenly disappears #84

Closed
johann-petrak opened this issue Nov 11, 2022 · 5 comments
Closed

Pepper robot suddenly disappears #84

johann-petrak opened this issue Nov 11, 2022 · 5 comments
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@johann-petrak
Copy link

I have written a simple program which receives joint and speed data and sends it to the VirtualPepper robot using the
pepper.setAngles(names, angles, speeds) method.

This works quite well for a while but suddenly the robot just disappears from the simulation in the GUI. However now exception is thrown and nothing is shown on the console.

When would this happen? How is it possible to debug what could cause this?

This is what the GUI looks before the error:
qi01

This is what the GUI looks after the error:
qi02

@johann-petrak
Copy link
Author

I am pretty sure this happens if one of the angles values is float("nan")

It may be useful for the library to either ignore any NaN value or throw an exception giving the reason.

@mbusy
Copy link
Member

mbusy commented Dec 24, 2022

@johann-petrak I can't reproduce that behaviour using float("nan"), can you post the script you used for reproducibility?

@mbusy mbusy added bug Something isn't working question Further information is requested labels Dec 24, 2022
@johann-petrak
Copy link
Author

#!/usr/bin/env python

"""
Module for debugging the robot disappears bug (qibullet #84)
"""
import qibullet
from qibullet import SimulationManager
import time
import numpy as np

PEPPER_ANGLES=dict(
    HeadYaw=(-2.0857, 2.0857),
    HeadPitch=(-0.7068, 0.4451),
    RShoulderPitch=(-2.0857, 2.0857),
    RShoulderRoll=(-1.5620, -0.0087),
    RElbowYaw=(-2.0857, 2.0857),
    RElbowRoll=(0.0087, 1.5620),
    RHand=(0.0, 1.0),
    LShoulderPitch=(-2.0857, 2.0857),
    LShoulderRoll=(0.0087, 1.5620),
    LElbowYaw=(-2.0857, 2.0857),
    LElbowRoll=(-1.5620, -0.0087),
    LHand=(0.0, 1.0),
    KneePitch=(-0.5149, 0.5149),
    HipPitch=(-1.0385, 1.0385),
    HipRoll=(-0.5149, 0.5149),
)



if __name__ == "__main__":

    print("qibullet version:", qibullet.__version__)
    simulation_manager = SimulationManager()
    client_id = simulation_manager.launchSimulation(gui=True, auto_step=False)
    pepper = simulation_manager.spawnPepper(
          client_id,
          translation=[0, 0, 0],
          quaternion=[0, 0, 0, 1],
          spawn_ground_plane=True)

    print("Pepper spawned:", pepper, type(pepper))

    names = [n for n in PEPPER_ANGLES.keys()]
    angles = [0.0 for n in names]
    speeds = [1.0 for n in names]
    pepper.setAngles(names, angles, speeds)
    simulation_manager.stepSimulation(client_id)
    time.sleep(5.0)

    iteration = 0
    while True:
        iteration += 1
        angles = [np.random.uniform(PEPPER_ANGLES[a][0], PEPPER_ANGLES[a][1]) for a in PEPPER_ANGLES.keys()]
        time.sleep(0.10)
        if iteration % 5:
            angleidx = np.random.randint(0, len(PEPPER_ANGLES))
            angles[angleidx] = float("nan")
            print(f"Setting angle {names[angleidx]} to NaN")
        try:
            pepper.setAngles(names, angles, speeds)
            simulation_manager.stepSimulation(client_id)
        except Exception as ex:
            print("Exception from setAngles: ", ex)
            print("Angles:", angles)

With qibullet version: 1.4.5 reproduces the problem every time.

@mbusy
Copy link
Member

mbusy commented Dec 30, 2022

This should now be prevented on develop, the 1.4.6 version of qibullet will raise a pybullet error when a NaN is specified

@mbusy mbusy added this to the 1.4.6 milestone Dec 30, 2022
@mbusy mbusy closed this as completed Dec 30, 2022
@johann-petrak
Copy link
Author

Tested and works for me, throws an exception of type pybullet.error now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants