Joint_spherical

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
VedantFNO
Posts: 1
Joined: Mon Nov 05, 2018 9:16 pm

Joint_spherical

Post by VedantFNO »

New to Pybullet.

I am trying to make a Satellite model with solar panels that have spherical joints between them. I use the createemultibody function for this. Currently I have revolute joints between each panel, but I want to replace each revolute joint with a spherical. What would be the best way of doing this?

Current Code:

Code: Select all

import pybullet as p
import time
import numpy as np
    

p.connect(p.GUI)
p.createCollisionShape(p.GEOM_PLANE)
p.createMultiBody(0,0)


#Sat part shapes
Sat_body = p.createCollisionShape(p.GEOM_BOX,halfExtents=[2.0  , 2.3, 3.0])
Panel_right = p.createCollisionShape(p.GEOM_BOX,halfExtents=[2, 0.2, 3])
Panel_left = p.createCollisionShape(p.GEOM_BOX,halfExtents=[2, 0.2, 3])

#The with other shapes linked to it
body_Mass = 500
visualShapeId = -1
link_Masses=[10, 10, 10, 10]



linkCollisionShapeIndices=[Panel_right, Panel_right, Panel_left, Panel_left]
nlnk=len(link_Masses)
linkVisualShapeIndices=[-1]*nlnk    #=[-1,-1,-1, ... , -1]
#link positions wrt the link they are attached to
BasePositionR_body = [4.2,0,0]
BasePositionR_panel = [4.2,0,0]
BasePositionL_body = [-4.2,0,0]
BasePositionL_panel = [-4.2,0,0]

linkPositions=[BasePositionR_body, BasePositionR_panel, BasePositionL_body, BasePositionL_panel,]
linkOrientations=[[0,0,0,1]]*nlnk
linkInertialFramePositions=[[0,0,0]]*nlnk

#linkInertialFramePositions = [BasePositionR_body, BasePositionR_body+BasePositionR_panel, BasePositionL_body, BasePositionL_body+BasePositionL_panel,]

print(linkInertialFramePositions)
#Note the orientations are given in quaternions (4 params). There are function to convert of Euler angles and back
linkInertialFrameOrientations=[[0,0,0,1]]*nlnk
#indices determine for each link which other link it is attached to
# for example 3rd index = 2 means that the front left knee jjoint is attached to the front left hip
indices=[0, 1, 0, 3]
#Most joint are revolving. The prismatic joints are kept fixed for now
jointTypes=[p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_REVOLUTE, p.JOINT_REVOLUTE]# JOINT_SPHERICAL,JOINT_REVOLUTE
#revolution axis for each revolving joint
axis=[[0,0,1], [0,0,1], [0,0,1], [0,0,1]]

#Drop the body in the scene at the following body coordinates
basePosition = [0,0,0]
baseOrientation = [0,0,0,1]
#Main function that creates the dog
sat = p.createMultiBody(body_Mass,Sat_body,visualShapeId,basePosition,baseOrientation,
                        linkMasses=link_Masses,
                        linkCollisionShapeIndices=linkCollisionShapeIndices,
                        linkVisualShapeIndices=linkVisualShapeIndices,
                        linkPositions=linkPositions,
                        linkOrientations=linkOrientations,
                        linkInertialFramePositions=linkInertialFramePositions,
                        linkInertialFrameOrientations=linkInertialFrameOrientations,
                        linkParentIndices=indices,
                        linkJointTypes=jointTypes,
                        linkJointAxis=axis		)#	

#Add earth like gravity
p.setGravity(0,0,0)
[/size]
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Joint_spherical

Post by Erwin Coumans »

The spherical joint is not exposed yet in PyBullet, we haven't had a robot using them. Also we don't have a motor for the spherical joint yet.

If we would expose the spherical joint, how would you actuate it?
Post Reply