old_contents: #!/usr/bin/env python
  #-*- coding:utf-8 -*-
  import math
  import pprint
  
  import rospy
  
  import baxter_interface
  
  bcolors = dict(
     header='\033[95m',
     okblue='\033[94m',
     okgreen='\033[92m',
     endc='\033[0m')
  
  def get_arm_position():
      rospy.init_node('get_arm_status', anonymous=True)
  
      for lim in ['left', 'right']:
          print bcolors['header'] + "### {0} arm".format(lim) + bcolors['endc']
          lim = baxter_interface.Limb(lim)
          #
          print bcolors['okgreen'] + "==> end_point_pose" + bcolors['endc']
          pprint.pprint(lim.endpoint_pose())
          #
          print bcolors['okgreen'] + "==> joint_angle" + bcolors['endc']
          print bcolors['okblue'] + "==> [rad]" + bcolors['endc'] 
          joint_angles_rad = lim.joint_angles()
          print joint_angles_rad.keys()
          print joint_angles_rad.values()
          print bcolors['okblue'] + "==> [deg]" + bcolors['endc'] 
          joint_angles_deg = {}
          if joint_angles_rad != {}:
              for jt_nm, jt_angle in joint_angles_rad.items():
                  joint_angles_deg[jt_nm] = jt_angle / math.pi * 180
          print joint_angles_deg.keys()
          print joint_angles_deg.values()
  
  if __name__ == '__main__':
      get_arm_position()
  
new_contents: #!/usr/bin/env python
  #-*- coding:utf-8 -*-
  """
  function: get arm joints and end effector positions
  
  How to use
  ---
  
      $ rosrun jsk_2014_picking_challenge get_arm_status.py
  
  """
  
  import math
  import pprint
  
  import rospy
  
  import baxter_interface
  
  
  def cprint(sentence, color):
      colors = dict(pink='\033[95m',
                    blue='\033[94m',
                    green='\033[92m')
      if color not in colors:
          raise ValueError('Unexpected color input')
      endc = '\033[0m'
      print(colors[color] + sentence + endc)
  
  
  def get_arm_position():
      rospy.init_node('get_arm_status', anonymous=True)
  
      for limb_nm in ['left', 'right']:
          cprint('### {0} arm'.format(limb_nm), 'pink')
          limb = baxter_interface.Limb(limb_nm)
          # end point pose
          cprint('==> end_point_pose', 'green')
          pprint.pprint(limb.endpoint_pose())
          # joint angles [rad]
          cprint('==> joint_angle', 'green')
          cprint('==> [rad]', 'blue')
          joint_angles_rad = limb.joint_angles()
          print(limb.joint_names())
          print([joint_angles_rad[jt_nm] for jt_nm in limb.joint_names()])
          # joint angles [deg]
          cprint('==> [deg]', 'blue')
          joint_angles_deg = {}
          if joint_angles_rad != {}:
              for jt_nm, jt_angle in joint_angles_rad.items():
                  joint_angles_deg[jt_nm] = jt_angle / math.pi * 180
          print(limb.joint_names())
          print([joint_angles_deg[jt_nm] for jt_nm in limb.joint_names()])
  
  
  if __name__ == '__main__':
      get_arm_position()
  
subject: fix different arm joint order (now you can copy and paste to use it)