Skip to content

Commit

Permalink
add initialization for roll&pitch, remove condition in launch (autowa…
Browse files Browse the repository at this point in the history
…refoundation#209)

Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
  • Loading branch information
TakaHoribe authored Dec 21, 2020
1 parent 7d7c818 commit b1e4400
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
14 changes: 5 additions & 9 deletions localization/ekf_localizer/launch/ekf_localizer.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,11 @@

<node pkg="ekf_localizer" exec="ekf_localizer" name="ekf_localizer" output="screen">

<remap unless="$(var use_pose_with_covariance)" from="in_pose" to="$(var input_pose_name)"/>
<remap unless="$(var use_pose_with_covariance)" from="in_pose_with_covariance" to="input_pose_with_cov_UNUSED"/>
<remap if="$(var use_pose_with_covariance)" from="in_pose" to="input_pose_UNUSED"/>
<remap if="$(var use_pose_with_covariance)" from="in_pose_with_covariance" to="$(var input_pose_with_cov_name)"/>

<remap unless="$(var use_twist_with_covariance)" from="in_twist" to="$(var input_twist_name)"/>
<remap unless="$(var use_twist_with_covariance)" from="in_twist_with_covariance" to="input_twist_with_covariance_UNUSED"/>
<remap if="$(var use_twist_with_covariance)" from="in_twist" to="input_twist_UNUSED"/>
<remap if="$(var use_twist_with_covariance)" from="in_twist_with_covariance" to="$(var input_twist_with_cov_name)"/>
<remap from="in_pose" to="$(var input_pose_name)"/>
<remap from="in_pose_with_covariance" to="$(var input_pose_with_cov_name)"/>

<remap from="in_twist" to="$(var input_twist_name)"/>
<remap from="in_twist_with_covariance" to="$(var input_twist_with_cov_name)"/>

<remap from="initialpose" to="$(var input_initial_pose_name)"/>

Expand Down
11 changes: 4 additions & 7 deletions localization/ekf_localizer/src/ekf_localizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,14 @@ void EKFLocalizer::setCurrentResult()
current_ekf_pose_.pose.position.y = ekf_.getXelement(IDX::Y);

tf2::Quaternion q_tf;
double roll = 0.0, pitch = 0.0, yaw = 0.0;
double roll = 0.0, pitch = 0.0;
if (current_pose_ptr_ != nullptr) {
current_ekf_pose_.pose.position.z = current_pose_ptr_->pose.position.z;
tf2::fromMsg(current_pose_ptr_->pose.orientation, q_tf); /* use Pose pitch and roll */
tf2::Matrix3x3(q_tf).getRPY(roll, pitch, yaw);
} else {
// current_ekf_pose_.pose.position.z = 0.0;
// roll = 0;
// pitch = 0;
double yaw_tmp;
tf2::Matrix3x3(q_tf).getRPY(roll, pitch, yaw_tmp);
}
yaw = ekf_.getXelement(IDX::YAW) + ekf_.getXelement(IDX::YAWB);
double yaw = ekf_.getXelement(IDX::YAW) + ekf_.getXelement(IDX::YAWB);
current_ekf_pose_.pose.orientation = createQuaternionFromRPY(roll, pitch, yaw);

current_ekf_pose_no_yawbias_ = current_ekf_pose_;
Expand Down

0 comments on commit b1e4400

Please sign in to comment.