Ejemplo n.º 1
0
  std::vector<FootstepState::Ptr>
  FootstepGraph::localMoveFootstepState(FootstepState::Ptr in)
  {
    std::vector<FootstepState::Ptr> moved_states;
    moved_states.reserve((2*parameters_.local_move_x_num + 1)*(2*parameters_.local_move_y_num + 1)*(2*parameters_.local_move_theta_num +1) - 1);
    int x_num     = parameters_.local_move_x_num;
    int y_num     = parameters_.local_move_y_num;
    int theta_num = parameters_.local_move_theta_num;
    if(x_num == 0)     x_num = 1;
    if(y_num == 0)     y_num = 1;
    if(theta_num == 0) theta_num = 1;

    double move_x = parameters_.local_move_x;
    double move_y = parameters_.local_move_y;
    double move_t = parameters_.local_move_theta;
    double offset_x = parameters_.local_move_x_offset;
    double offset_y = (in->getLeg() == jsk_footstep_msgs::Footstep::LEFT) ?
      parameters_.local_move_y_offset : - parameters_.local_move_y_offset;
    double offset_t = parameters_.local_move_theta_offset;

    bool have_offset = ((offset_x != 0.0) || (offset_y != 0.0) || (offset_t != 0.0));
    for (int xi = - parameters_.local_move_x_num; xi <= parameters_.local_move_x_num; xi++) {
      for (int yi = - parameters_.local_move_y_num; yi <= parameters_.local_move_y_num; yi++) {
        for (int thetai = - parameters_.local_move_theta_num; thetai <= parameters_.local_move_theta_num; thetai++) {
          if ( have_offset || (xi != 0) || (yi != 0) || (thetai != 0) ) {
            Eigen::Affine3f trans(Eigen::Translation3f((move_x / x_num * xi) + offset_x,
                                                       (move_y / y_num * yi) + offset_y,
                                                       0)
                                  * Eigen::AngleAxisf((move_t / theta_num * thetai) + offset_t,
                                                      Eigen::Vector3f::UnitZ()));
            moved_states.push_back(
                                   FootstepState::Ptr(new FootstepState(in->getLeg(),
                                                                        in->getPose() * trans,
                                                                        in->getDimensions(),
                                                                        in->getResolution())));
          }
        }
      }
    }
    return moved_states;
  }
Ejemplo n.º 2
0
 std::vector<FootstepState::Ptr>
 FootstepGraph::localMoveFootstepState(FootstepState::Ptr in)
 {
   std::vector<FootstepState::Ptr> moved_states;
   moved_states.reserve(local_move_x_num_ * local_move_y_num_ * local_move_theta_num_ * 8);
   for (size_t xi = - local_move_x_num_; xi <= local_move_x_num_; xi++) {
     for (size_t yi = - local_move_y_num_; yi <= local_move_y_num_; yi++) {
       for (size_t thetai = - local_move_theta_num_; thetai <= local_move_theta_num_; thetai++) {
         Eigen::Affine3f trans(Eigen::Translation3f(local_move_x_ / local_move_x_num_ * xi,
                                                    local_move_y_ / local_move_y_num_ * yi,
                                                    0)
                               * Eigen::AngleAxisf(local_move_theta_ / local_move_theta_num_ * thetai,
                                                   Eigen::Vector3f::UnitZ()));
         moved_states.push_back(
           FootstepState::Ptr(new FootstepState(in->getLeg(),
                                                in->getPose() * trans,
                                                in->getDimensions(),
                                                in->getResolution())));
       }
     }
   }
   return moved_states;
 }