parameters: (robot, n_steps, to_foot)
return_statement: return request
docstring: Sets up the problem to safely shift the weight to the other foot (to_foot)
      Suppose to_foot = "r_foot"    
      Then problem constrains both feet to remain at fixed poses (their current poses)
      at all intermediate timesteps, the center of mass lies over the convex hull of l_foot and r_foot
      at the final timestep, the center of mass lies over r_foot
docstring_summary: Sets up the problem to safely shift the weight to the other foot (to_foot)
      Suppose to_foot = "r_foot"    
      Then problem constrains both feet to remain at fixed poses (their current poses)
      at all intermediate timesteps, the center of mass lies over the convex hull of l_foot and r_foot
      at the final timestep, the center of mass lies over r_foot
docstring_tokens: Sets up the problem to safely shift the weight to the other foot ( to_foot ) Suppose to_foot = r_foot Then problem constrains both feet to remain at fixed poses ( their current poses ) at all intermediate timesteps the center of mass lies over the convex hull of l_foot and r_foot at the final timestep the center of mass lies over r_foot
function: def shift_weight_request(robot, n_steps, to_foot):
      """
      Sets up the problem to safely shift the weight to the other foot (to_foot)
      Suppose to_foot = "r_foot"    
      Then problem constrains both feet to remain at fixed poses (their current poses)
      at all intermediate timesteps, the center of mass lies over the convex hull of l_foot and r_foot
      at the final timestep, the center of mass lies over r_foot
      """    
      from_foot = opposite_foot(to_foot)
      
      request = request_skeleton(n_steps)
      from_foot_xyz, from_foot_quat = xyzQuatFromMatrix(robot.GetLink(from_foot).GetTransform())
      to_foot_xyz, to_foot_quat = xyzQuatFromMatrix(robot.GetLink(to_foot).GetTransform())
          
      for i in xrange(1, n_steps):
          request["constraints"].extend([
              {
                  "type":"pose",
                  "name":"from_foot_pose",
                  "params":{
                      "xyz":list(from_foot_xyz),
                      "wxyz":list(from_foot_quat),
                      "link":from_foot,
                      "timestep":i
                  }
              },
              {
                  "type":"pose",
                  "name":"to_foot_pose",
                  "params":{
                      "xyz":list(to_foot_xyz),
                      "wxyz":list(to_foot_quat),
                      "link":to_foot,
                      "timestep":i
                  }
              }
          ])    
          if i < n_steps - 1:
              request["constraints"].append(
                  {
                      "type":"zmp","name":"zmp%i"%i,
                      "params":{"planted_links":[from_foot, to_foot],"timestep":i}
                  })
          else:
              request["constraints"].append(
                  {
                      "type":"zmp",
                      "name":"final_zmp",
                      "params":{"planted_links":[to_foot], "timestep":i}
                  })                    
  
      return request
function_tokens: def shift_weight_request ( robot , n_steps , to_foot ) : from_foot = opposite_foot ( to_foot ) request = request_skeleton ( n_steps ) from_foot_xyz , from_foot_quat = xyzQuatFromMatrix ( robot . GetLink ( from_foot ) . GetTransform ( ) ) to_foot_xyz , to_foot_quat = xyzQuatFromMatrix ( robot . GetLink ( to_foot ) . GetTransform ( ) ) for i in xrange ( 1 , n_steps ) : request [ "constraints" ] . extend ( [ { "type" : "pose" , "name" : "from_foot_pose" , "params" : { "xyz" : list ( from_foot_xyz ) , "wxyz" : list ( from_foot_quat ) , "link" : from_foot , "timestep" : i } } , { "type" : "pose" , "name" : "to_foot_pose" , "params" : { "xyz" : list ( to_foot_xyz ) , "wxyz" : list ( to_foot_quat ) , "link" : to_foot , "timestep" : i } } ] ) if i < n_steps - 1 : request [ "constraints" ] . append ( { "type" : "zmp" , "name" : "zmp%i" % i , "params" : { "planted_links" : [ from_foot , to_foot ] , "timestep" : i } } ) else : request [ "constraints" ] . append ( { "type" : "zmp" , "name" : "final_zmp" , "params" : { "planted_links" : [ to_foot ] , "timestep" : i } } ) return request