16-264: Humanoids
- Abstract
- This is a support page of 16-264: Humanoids class (especially Akihiko Yamaguchi's projects).
- Table of contents
Questions and Answers †
Baxter †
How to teach poses (joint angles) of the robot? †
A simple way is: move a robot arm(s) by pressing the cuss switch to a pose, and then investigate the current joint angles by:
Baxter:trick or quit|L> q
then the joint angles of left arms are displayed (L> denotes the current arm is Left). To check the joint angles of the right arm:
Baxter:trick or quit|L> r Baxter:trick or quit|R> q
Is there a Baxter simulator? †
Yes. There is a Baxter simulator on Gazebo. The instruction is here:
http://sdk.rethinkrobotics.com/wiki/Simulator_Installation
lfd_trick †
https://github.com/akihikoy/lfd_trick
Is inverse kinematics implemented? †
Yes.
In a script in scripts/motions/, t.robot provides basic functions of the robot such as kinematics, joint controls, gripper controls, etc. t.robot is an instance of TRobotBaxter (defined in src/base/ros_rbt_bxtr.py), which is an subclass of an interface class TDualArmRobot (defined in src/base/ros_robot.py). Read the comments of the methods.
e.g.
'''Compute an inverse kinematics of an arm.
Return joint angles for a target self.EndLink(arm) pose on self.BaseFrame.
return: q, res; q: joint angles (None if failure), res: IK status.
arm: LEFT, RIGHT, or None (==currarm).
x_trg: target pose.
x_ext: a local pose on self.EndLink(arm) frame.
If not None, the returned q satisfies self.FK(q,x_ext,arm)==x_trg.
start_angles: initial joint angles for IK solver, or None (==self.Q(arm)).
with_st: whether return IK status. '''
def IK(self, x_trg, x_ext=None, start_angles=None, arm=None, with_st=False):
'''Follow a self.EndLink(arm)-pose trajectory.
arm: LEFT, RIGHT, or None (==currarm).
x_traj: self.EndLink(arm)-pose trajectory [x,y,z,qx,qy,qz,qw]*N.
t_traj: corresponding times in seconds from start [t1,t2,...,tN].
blocking: False: move background, True: wait until motion ends, 'time': wait until tN.
x_ext: a local pose on the self.EndLink(arm) frame.
If not None, the final joint angles q satisfies self.FK(q,x_ext,arm)==x_trg. '''
def FollowXTraj(self, x_traj, t_traj, x_ext=None, arm=None, blocking=False):
'''Control an arm to the target self.EndLink(arm) pose.
arm: LEFT, RIGHT, or None (==currarm).
x_trg: target pose.
dt: duration time in seconds.
blocking: False: move background, True: wait until motion ends, 'time': wait until tN.
x_ext: a local pose on the self.EndLink(arm) frame.
If not None, the final joint angles q satisfies self.FK(q,x_ext,arm)==x_trg. '''
def MoveToX(self, x_trg, dt=4.0, x_ext=None, arm=None, blocking=False):
What does q_traj and t_traj represent? †
These are used in t.robot.FollowQTraj: moving a robot arm by following the joint angle trajectories (q_traj, t_traj).
We define a trajectory with q_traj: a sequence of joint angles, and t_traj: corresponding times. These are via-points and a goal point on the trajectory, and the robot automatically interpolates these points. Since Baxter has 7-DoF (i.e. 7 joints) on each arm, q_traj is a list (any size) of lists (each has 7 elements).
Example:
q_traj= [
[0.72, 1.05, 3.01, 2.41, -3.03, -0.90, -0.22],
[0.79, 0.94, 3.05, 1.68, -3.03, -0.45, -0.17],
[0.80, 1.00, 3.05, 1.64, -3.03, -0.27, -0.19],
]
t_traj= [1.0,1.5,1.6]
If the controller works perfectly, the arm passes q_traj[0] at t_traj[0], q_traj[1] at t_traj[1], and reaches q_traj[2] at t_traj[2]. So len(q_traj)==len(t_traj), len(q_traj[i])==7 for all i.
q_traj[i] is a list of joint angles. The order of values corresponds with the joint names; in Baxter case, the joint names are: 'right_' or 'left_' + ['s0', 's1', 'e0', 'e1', 'w0', 'w1', 'w2'] (refer to Hardware Spec). Each element is a dadian value whose base (q=[0.0]*7) is as shown in the figure:
t_traj[i] is a time in seconds. t=0 is the start time of the motion.
How to smooth a trajectory? †
If you have q_traj (joint angle trajectory) and t_traj (times corresponding with points in q_traj), use LimitQTrajVel to limit the joint angular velocity:
LimitQTrajVel(q_start=t.robot.Q(arm), q_traj=q_traj, t_traj=t_traj, qvel_limits=t.robot.JointVelLimits(arm))
where t.robot.JointVelLimits(arm) gives a vector of maximum joint angular velocities. You can replace t.robot.JointVelLimits(arm).
If you have x_traj (end-effector trajectory) and t_traj, you need to convert x_traj to q_traj before using LimitQTrajVel. This is easy. FollowXTraj
t.robot.FollowXTraj(x_traj, t_traj, x_ext, arm, blocking):
is equivalent to:
if arm==None: arm= t.robot.Arm
q_curr= t.robot.Q(arm)
q_traj= XTrajToQTraj(lambda x,q_start: t.robot.IK(x, x_ext=x_ext, start_angles=q_start, arm=arm),
x_traj, start_angles=q_curr)
if q_traj==None:
raise ROSException('ik','FollowXTraj: IK failed')
t.robot.FollowQTraj(q_traj, t_traj, arm=arm, blocking=blocking)
The default values of FollowXTraj are:
x_ext=None, arm=None, blocking=False