Dynamically attached fixed joint is not fix

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
kapsl
Posts: 4
Joined: Thu May 16, 2019 1:49 pm

Dynamically attached fixed joint is not fix

Post by kapsl »

Till now we loaded our robot model through urdf. In the same urdf file we had also the gripper and a peg attached to the gripper. This worked fine, everything was rigid.
Now we want to change the size of the peg (the tool in the gripper) for every reset. The way we tried this by removing the thing from urdf and dynamically attaching it to the robot with this code:

Code: Select all

width = 0.025
        depth = 0.025
        height = 0.085

        csId = self._p.createCollisionShape(shapeType=pybullet.GEOM_BOX,
                                            halfExtents=[width, depth, height],
                                            )

        vsId = self._p.createVisualShape(shapeType=pybullet.GEOM_BOX,
                                         halfExtents=[width, depth, height])

        pegId = self._p.createMultiBody(baseMass=0.01,
                                        baseCollisionShapeIndex=csId,
                                        baseVisualShapeIndex=vsId,
                                        flags=pybullet.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS,)
                                        )

        constId = self._p.createConstraint(parentBodyUniqueId=self.robot_uid,
                                           parentLinkIndex=self._motor_indices[-1],
                                           childBodyUniqueId=pegId,
                                           childLinkIndex=-1,
                                           jointType=pybullet.JOINT_FIXED,
                                           jointAxis=[0, 0, 0],
                                           parentFramePosition=[0, 0, 0],
                                           childFramePosition=[0.1, 0.1, 0.3])
        self._p.changeConstraint(userConstraintUniqueId=constId,
                                 maxForce=9e20,
                                 erp=1e-20)
the problem is the peg is there but it is not rigidly/fixed connected to the robot. If i take the mouse and pull on it, it acts like a spring. The same happens if the peg e.g. colides with the floor. I played around with the changeConstraint function. But no success, so far.

Does anybody have an idea how to attacht the thing completely rigidly?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Dynamically attached fixed joint is not fix

Post by Erwin Coumans »

Mouse forces are very strong and possibly stronger than the fixed joint constraint forces. It is better to attach a fixed joint as part of the urdf instead of using a constraint.
FredP
Posts: 3
Joined: Wed Sep 30, 2020 6:36 am

Re: Dynamically attached fixed joint is not fix

Post by FredP »

It's a really old question but I had the same problem and was able to solve it by increasing the number of solver iterations and the number of substeps.

See message from Erwin
Erwin Coumans wrote: Tue Jun 16, 2020 5:49 pm Increasing the number of solver iterations, or using a smaller time step, or increase the number of substeps.
You can also improve convergence by making the masses more similar, if possible (PGS solver converges slower when large mass differences are present, such as 100 kg and 0.1 kg etc)

Another option is using a direct solver, but it may have its own issues. See https://github.com/bulletphysics/bullet ... tSolver.py
viewtopic.php?f=24&t=12985&p=42901
Post Reply