Skip to content

Commit

Permalink
merge main and resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sadanand1120 committed Jun 29, 2023
2 parents 17a4558 + e54b078 commit 269665f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/navigation/navigation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,10 @@ string Navigation::GetNavStatus() {
}
}

uint8_t Navigation::GetNavStatusUint8() {
return static_cast<uint8_t>(nav_state_);
}

vector<Vector2f> Navigation::GetPredictedCloud() {
return fp_point_cloud_;
}
Expand Down Expand Up @@ -882,7 +886,7 @@ bool Navigation::Run(const double& time,
prev_state = nav_state_;
if (nav_state_ == NavigationState::kGoto &&
local_target_.squaredNorm() < Sq(params_.target_dist_tolerance) &&
robot_vel_.squaredNorm() < Sq(params_.target_dist_tolerance)) {
robot_vel_.squaredNorm() < Sq(params_.target_vel_tolerance)) {
nav_state_ = NavigationState::kTurnInPlace;
} else if (nav_state_ == NavigationState::kTurnInPlace &&
AngleDist(robot_angle_, nav_goal_angle_) <
Expand Down
9 changes: 5 additions & 4 deletions src/navigation/navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class Navigation {
int GetNavState();
float GetAngularVelocity();
std::string GetNavStatus();
uint8_t GetNavStatusUint8();
std::vector<Eigen::Vector2f> GetPredictedCloud();
float GetCarrotDist();
float GetObstacleMargin();
Expand Down Expand Up @@ -183,17 +184,17 @@ class Navigation {
// Publish a status message
void PublishNavStatus(const Eigen::Vector2f& carrot);

// Current robot location.
// Current map frame robot location (LocalizationCallback).
Eigen::Vector2f robot_loc_;
// Current robot orientation.
// Current map frame robot orientation (LocalizationCallback).
float robot_angle_;
// Current robot velocity.
Eigen::Vector2f robot_vel_;
// Current robot angular speed.
float robot_omega_;
// Odometry-reported robot location.
// Current odometry frame robot location (OdometryCallback).
Eigen::Vector2f odom_loc_;
// Odometry-reported robot angle.
// Current odometry frame robot angle (OdometryCallback).
float odom_angle_;
// Newest odometry message received.
Odom latest_odom_msg_;
Expand Down
10 changes: 5 additions & 5 deletions src/navigation/navigation_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "config_reader/config_reader.h"
#include "motion_primitives.h"
#include "constant_curvature_arcs.h"
#include "actionlib_msgs/GoalStatus.h"
#include "amrl_msgs/NavStatusMsg.h"
#include "amrl_msgs/Pose2Df.h"
#include "glog/logging.h"
#include "gflags/gflags.h"
Expand Down Expand Up @@ -73,7 +73,7 @@
#include "motion_primitives.h"
#include "navigation.h"

using actionlib_msgs::GoalStatus;
using amrl_msgs::NavStatusMsg;
using amrl_msgs::VisualizationMsg;
using amrl_msgs::AckermannCurvatureDriveMsg;
using math_util::DegToRad;
Expand Down Expand Up @@ -142,7 +142,6 @@ ros::Publisher twist_drive_pub_;
ros::Publisher viz_pub_;
ros::Publisher map_lines_publisher_;
ros::Publisher pose_marker_publisher_;
ros::Publisher nav_status_pub_;
ros::Publisher status_pub_;
ros::Publisher fp_pcl_pub_;
ros::Publisher path_pub_;
Expand Down Expand Up @@ -321,8 +320,9 @@ navigation::Twist ToTwist(geometry_msgs::TwistStamped twist_msg) {
}

void PublishNavStatus() {
GoalStatus status;
status.status = 1;
NavStatusMsg status;
status.stamp = ros::Time::now();
status.status = navigation_.GetNavStatusUint8();

status_pub_.publish(status);
}
Expand Down

0 comments on commit 269665f

Please sign in to comment.