Closed learningxiaobai closed 2 years ago
Actually, two joints are missing from JOINT_INDICES
: 7 and 8.
These joints are actually fixed: they are dummy joints that fix two links that are supposed to remain motionless relative to each other. If you are familiar with URDF, here are the lines in question.
Fixed joint between panda_link7
and panda_link7
Fixed joint between panda_link8
and panda_hand
Actually, two joints are missing from
JOINT_INDICES
: 7 and 8. These joints are actually fixed: they are dummy joints that fix two links that are supposed to remain motionless relative to each other. If you are familiar with URDF, here are the lines in question. Fixed joint betweenpanda_link7
andpanda_link7
Fixed joint betweenpanda_link8
andpanda_hand
thanks,I got it.
For you second question, here is a base of code that you can use.
class MyRobot(PyBulletRobot):
"""Base class for robot env.
Args:
sim (Any): The simulation engine.
body_name (str): The name of the robot within the simulation.
ee_link (int): Link index of the end-effector
file_name (str): Path of the urdf file.
base_position (x, y, z): Position of the base of the robot.
"""
JOINT_INDICES = # joints indices in your URDF file, eg, [0, 1, 2, 3, 4]
JOINT_FORCES = # joint forces, in Nm , eg, [87, 87, 87, 87, 32]
def __init__(self, sim, body_name, base_position):
file_name = "my_sdf_file_name"
super().__init__(self, sim, body_name, file_name, base_position)
def set_action(self, action):
"""Perform the action."""
# Some code using self.control_joints(target_angles)
def get_obs(self):
"""Return the observation associated to the robot."""
# build the obs vector, using for example
# self.sim.get_joint_angle(self.body_name, joint_idx) or self.sim.get_link_position(self.body_name, self.body_name, link_idx)
return obs
def reset(self):
"""Reset the robot."""
# Code executed when robot is reset.
# If you want to return to the neutral position for examples : self.set_joint_values(neutral_joint_values)
I cannot guaranty that it would work with an SDF file, but if you manage to convert your SDF into URDF, it could work.
1.hello,Why 'panda_joint8'(joint_indices=7) is disappeared in JOINT_INDICES = [0, 1, 2, 3, 4, 5, 6, 9, 10]? 2.I have a .sdf file robot,how can i change your code to input my robot? Thanks a lot!