Use setJointPositions
to set joint target positions, and move to the target position gradually. Use setJointPositionsDirectly
to teleport joints. The joint positions are in degrees
. Use setJointPositionsContinue
if BioIK
is enabled.
The order of the list of positions starts from the root
of the articulation body. Take robots as an example, the 0-th element is its first movable joint from the base.
# Example:
# Have a robot object
my_robot = env.robot()
# Have a list of joint positions, in degrees
joint_positions = [0, 10, 10, 10, 10, 10, 100]
# Set joint positions
my_robot.setJointPositions(joint_positions = joint_positions)
# Teleport joint positions
my_robot.setJointPositionsDirectly(joint_positions = joint_positions)
There are two ways to move robots in the task space, and the difference is which IK to use.
Natively, RCareWorld uses the pybullet IK. To use this IK, you need to specify the robot’s name, base position and rotation.
In Unity, open load_robot
scene
In Python, run example_robot_move.py
. The red cube acts like a target. You can drag it to adjust the position of the end-effector of the robot.
Example scene in bio_ik
Initialize BioIK in Unity: In the inspector window, check the Init BioIK
and IK Target Orientation
box
In python, take example_bioik.py
as an example:
from pyrcareworld.envs import RCareWorld
env = RCareWorld()
franka = env.create_robot(id = 639787, gripper_list = ['6397870'], robot_name= 'franka_panda', base_pos=[0, 0, 0])
# move the robot to target pose
franka.BioIKMove(targetPose=[0,0,-0.5], duration=0.1, relative=True)
# move the robot to target euler angle
franka.BioIKRotateQua(taregetEuler=[90, 0, 0], duration=30, relative=True)
env.close()
<aside> đŸ’¡ Try moving other robots in the scene as well! Try adjusting the duration, target position. Is it possible to get the target position from some object?
</aside>