Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transform #6

Open
mickeyouyou opened this issue Oct 13, 2020 · 3 comments
Open

transform #6

mickeyouyou opened this issue Oct 13, 2020 · 3 comments

Comments

@mickeyouyou
Copy link
Member

  TransformStamped transform;
  if (tf_buffer_->GetLatestStaticTF(frame_id, child_frame_id, &transform)) {
    ConstructTransformationMatrix(transform.transform().rotation(),
                                  transform.transform().translation(), matrix);
    return true;
  }
@mickeyouyou
Copy link
Member Author

bool Compensator::QueryPoseAffineFromTF2(const uint64_t& timestamp, void* pose,
                                         const std::string& child_frame_id) {
  cyber::Time query_time(timestamp);
  std::string err_string;
  if (!tf2_buffer_ptr_->canTransform(
          config_.world_frame_id(), child_frame_id, query_time,
          config_.transform_query_timeout(), &err_string)) {
    AERROR << "Can not find transform. " << timestamp
           << " frame_id:" << child_frame_id << " Error info: " << err_string;
    return false;
  }

  apollo::transform::TransformStamped stamped_transform;

  try {
    stamped_transform = tf2_buffer_ptr_->lookupTransform(
        config_.world_frame_id(), child_frame_id, query_time);
  } catch (tf2::TransformException& ex) {
    AERROR << ex.what();
    return false;
  }

  Eigen::Affine3d* tmp_pose = (Eigen::Affine3d*)pose;
  *tmp_pose =
      Eigen::Translation3d(stamped_transform.transform().translation().x(),
                           stamped_transform.transform().translation().y(),
                           stamped_transform.transform().translation().z()) *
      Eigen::Quaterniond(stamped_transform.transform().rotation().qw(),
                         stamped_transform.transform().rotation().qx(),
                         stamped_transform.transform().rotation().qy(),
                         stamped_transform.transform().rotation().qz());
  return true;
}

``

@mickeyouyou
Copy link
Member Author

mickeyouyou commented Oct 15, 2020

publish odometry info by velicity sport model

https://www.cnblogs.com/21207-iHome/p/8066135.html
https://www.cnblogs.com/zeen/p/12506173.html

@mickeyouyou
Copy link
Member Author

  1. Publish odometry tf message by chassis component

  2. Publish laser scan tf static message by static transform publisher component

  3. Publish map frame to odometry frame by Gmapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant