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

Weird & Unwanted Behavior to Singular Input Action #237

Open
behradkhadem opened this issue Nov 1, 2023 · 1 comment
Open

Weird & Unwanted Behavior to Singular Input Action #237

behradkhadem opened this issue Nov 1, 2023 · 1 comment

Comments

@behradkhadem
Copy link
Collaborator

Hello @maxspahn, I've come across some hurdles in my project and this is a weird one. We know that joints can get actuated and actuated joints move links (dah!) but we expect that whenever a single joint is actuated, only links connected to that joint move, right?
This is the issue I've come across while I was testing stuff. We have an issue on this matter.
Given these samples:

from urdfenvs.robots.generic_urdf import GenericUrdfReacher
from urdfenvs.urdf_common import UrdfEnv
import numpy as np


robots = [
    GenericUrdfReacher(urdf='mobilePandaWithGripper.urdf', mode="vel"),
]

render: bool = True

roboticEnv = UrdfEnv(render=render, robots=robots)

roboticEnv.set_spaces()

ob, *_ = roboticEnv.reset()

roboticEnv.reset()
while True:
    action = np.array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
    obs, reward, done, truncated, info = roboticEnv.step(action)

and

from urdfenvs.robots.generic_urdf import GenericUrdfReacher
from urdfenvs.urdf_common import UrdfEnv
import numpy as np


robots = [
    GenericUrdfReacher(urdf='panda_with_gripper.urdf', mode="vel"),
]

render: bool = True

roboticEnv = UrdfEnv(render=render, robots=robots)

roboticEnv.set_spaces()

ob, *_ = roboticEnv.reset()

roboticEnv.reset()
while True:
    action = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0])
    obs, reward, done, truncated, info = roboticEnv.step(action)

we clearly see that the input action is intended to move one joint. But after a while, some other joints start moving. And I think this can cause some issues. Is this us or pyBullet? Because code is solid and I don't see any case that our input violate something in pyBullet's documentation.
Or have I gone mad? 😅Can you check this one? I can't find a logical explanation for this.

@maxspahn
Copy link
Owner

maxspahn commented Nov 7, 2023

The moment you are trying to exceed the joint limits, the behavior become weird in pybullet. The PID controller for velocities is probably saturating the torques too much. You should stop your while loop as soon as done becomes true, in your cases around step 300.

If you do so, you can plot the velocities, see below and you observe nothing weird about it.

MobilePandaWithGripper
mobilePandaWithGripper_velocities

PandaWithGripper
pandaWithGripper_velocities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants