Skip to content

Commit 5b7b405

Browse files
committed
add gard mondays
1 parent 39de670 commit 5b7b405

4 files changed

Lines changed: 37 additions & 25 deletions

File tree

pipeline_follower_sim/config/pipeline_follower_sim.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ pipeline_follower_node:
22
ros__parameters:
33
input_topic_lines: "irls_line/lines"
44
input_topic_info: "/pipeline/camera/camera_info"
5-
input_topic_pose: "/orca/odom"
6-
input_topic_altitude: "/orca/dvl/altitude"
5+
input_topic_pose: "/nautilus/odom"
6+
input_topic_altitude: "/nautilus/dvl/altitude"
77
camera_height: 0.5
8-
send_rate_hz: 0.90
8+
send_rate_hz: 3.0
99
camera_placment_x: 0.4
10+
camera_placment_y: -0.158
11+
camera_placment_z: 0.161
1012
debug_waypoint_topic: "/debug/waypoint"
1113
debug_service_off_topic: "/debug/send_waypoints_service_off"
14+
target_height: 0.9
15+
receive_frame: "nautilus/downwards_camera_optical" #implement tf2 :D
16+
target_frame: "nautilus/odom"

pipeline_follower_sim/include/pipeline_follower_sim/pipeline_follower_node.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <vortex_msgs/msg/waypoint.hpp>
66
#include <vortex_msgs/srv/send_waypoints.hpp>
77
#include <vortex_msgs/msg/dvl_altitude.hpp>
8+
#include <vortex_msgs/msg/waypoint_mode.hpp>
89
#include <std_msgs/msg/bool.hpp>
910
#include <nav_msgs/msg/odometry.hpp>
1011
#include <sensor_msgs/msg/camera_info.hpp>
@@ -77,10 +78,13 @@ class PipelineFollowerNode : public rclcpp::Node
7778
double camera_height_;
7879
double send_rate_hz_;
7980
double camera_placment_x_;
81+
double camera_placment_y_;
82+
double camera_placment_z_;
8083
cv::Matx33d K_;
8184
double robot_a_{0.0};
8285
double image_width;
8386
double image_height;
87+
double target_height_;
8488

8589
bool have_last_corner_{false};
8690
double last_corner_x_{0.0};
@@ -103,7 +107,7 @@ class PipelineFollowerNode : public rclcpp::Node
103107
bool goal_blocked_ = false;
104108

105109
int min_dist_skip_count_ = 0;
106-
static constexpr int MAX_MIN_DIST_SKIPS = 4;
110+
static constexpr int MAX_MIN_DIST_SKIPS = 20;
107111

108112
rclcpp::TimerBase::SharedPtr request_delay_timer_;
109113
rclcpp::Subscription<vortex_msgs::msg::LineSegment2DArray>::SharedPtr sub_line;

pipeline_follower_sim/include/pipeline_follower_sim/pipeline_follower_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ inline double angleBetweenLinesRad(
8787
return normalizeAngle(yaw + angle);
8888
}
8989

90-
inline double hight_regulator(double z_hight, double dvl_hight, double target_hight = 0.7)
90+
inline double hight_regulator(double z_hight, double dvl_hight, double target_hight)
9191
{
9292
return z_hight - (target_hight - dvl_hight);
9393
}

pipeline_follower_sim/src/pipeline_follower_node.cpp

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
PipelineFollowerNode::PipelineFollowerNode()
1111
: Node("pipeline_follower_node")
1212
{
13-
input_topic_lines_ = this->declare_parameter<std::string>("input_topic_lines", "irls_line/lines");
14-
input_topic_info_ = this->declare_parameter<std::string>("input_topic_info", "/pipeline/camera/camera_info");
15-
input_topic_pose_ = this->declare_parameter<std::string>("input_topic_pose", "/orca/odom");
16-
input_topic_altitude_ = this->declare_parameter<std::string>("input_topic_altitude", "/orca/dvl/altitude");
17-
camera_height_ = this->declare_parameter<double>("camera_height", 0.5);
18-
send_rate_hz_ = this->declare_parameter<double>("send_rate_hz", 0.90);
19-
camera_placment_x_ = this->declare_parameter<double>("camera_placment_x", 0.4);
13+
input_topic_lines_ = this->declare_parameter<std::string>("input_topic_lines");
14+
input_topic_info_ = this->declare_parameter<std::string>("input_topic_info");
15+
input_topic_pose_ = this->declare_parameter<std::string>("input_topic_pose");
16+
input_topic_altitude_ = this->declare_parameter<std::string>("input_topic_altitude");
17+
camera_height_ = this->declare_parameter<double>("camera_height");
18+
send_rate_hz_ = this->declare_parameter<double>("send_rate_hz");
19+
camera_placment_x_ = this->declare_parameter<double>("camera_placment_x");
20+
camera_placment_y_ = this->declare_parameter<double>("camera_placment_y");
21+
camera_placment_z_ = this->declare_parameter<double>("camera_placment_z");
22+
target_height_ = this->declare_parameter<double>("target_height");
2023

2124
debug_waypoint_topic_ = this->declare_parameter<std::string>("debug_waypoint_topic", "/debug/waypoint");
2225
debug_service_off_topic_ = this->declare_parameter<std::string>("debug_service_off_topic", "/debug/send_waypoints_service_off");
@@ -48,7 +51,7 @@ PipelineFollowerNode::PipelineFollowerNode()
4851
std::bind(&PipelineFollowerNode::infoCb, this, std::placeholders::_1)
4952
);
5053

51-
client_ = this->create_client<vortex_msgs::srv::SendWaypoints>("/orca/waypoint_addition");
54+
client_ = this->create_client<vortex_msgs::srv::SendWaypoints>("/nautilus/waypoint_addition");
5255

5356
goal_service_ = this->create_service<std_srvs::srv::Trigger>(
5457
"pipline/goal_service",
@@ -144,7 +147,7 @@ void PipelineFollowerNode::sendOrDebugWaypoint(
144147
bool overwrite_prior, bool take_priority,
145148
uint mode, double switching_threshold)
146149
{
147-
constexpr double MIN_WP_DIST = 0.15;
150+
constexpr double MIN_WP_DIST = 0.20;
148151

149152
if (have_prev_wp_) {
150153
const double dx = x - prev_x_;
@@ -174,7 +177,7 @@ void PipelineFollowerNode::sendOrDebugWaypoint(
174177
wp.pose.position.y = y;
175178
wp.pose.position.z = z;
176179
wp.pose.orientation = quatFromYaw(yaw);
177-
wp.mode = mode;
180+
wp.waypoint_mode.mode = mode;
178181

179182
if (!client_->service_is_ready()) {
180183
debug_wp_pub_->publish(wp);
@@ -272,8 +275,8 @@ void PipelineFollowerNode::handleSingleLine(const vortex_msgs::msg::LineSegment2
272275
double forward = ground.y;
273276

274277
auto [dx, dy] = rotateXY(forward, right, robot_yaw_);
275-
auto [xc, yc] = rotateXY(camera_placment_x_, 0, robot_yaw_);
276-
auto new_robot_z = hight_regulator(robot_a_, robot_z_);
278+
auto [xc, yc] = rotateXY(camera_placment_x_, camera_placment_y_, robot_yaw_);
279+
auto new_robot_z = hight_regulator(robot_a_, robot_z_, target_height_);
277280

278281
double x_in_meters = robot_x_ + dx + xc;
279282
double y_in_meters = robot_y_ + dy + yc;
@@ -282,14 +285,14 @@ void PipelineFollowerNode::handleSingleLine(const vortex_msgs::msg::LineSegment2
282285
double newYaw = angleBetweenLinesRad(robot_yaw_, p1, p2, cv::Point2f(0, 0), cv::Point2f(1, 1), true);
283286
if (abs(abs(robot_yaw_) - abs(newYaw)) > 1.35) {
284287
sendOrDebugWaypoint(x_in_meters, y_in_meters, new_robot_z, robot_yaw_,
285-
true, false, vortex_msgs::msg::Waypoint::FORWARD_HEADING, 0.3);
288+
true, false, vortex_msgs::msg::WaypointMode::FORWARD_HEADING, 0.3);
286289
return;
287290
}
288291
sendOrDebugWaypoint(robot_x_, robot_y_, new_robot_z, newYaw,
289-
true, false, vortex_msgs::msg::Waypoint::ONLY_ORIENTATION, 0.3);
292+
true, false, vortex_msgs::msg::WaypointMode::ONLY_ORIENTATION, 0.3);
290293
} else {
291294
sendOrDebugWaypoint(x_in_meters, y_in_meters, new_robot_z, robot_yaw_,
292-
true, false, vortex_msgs::msg::Waypoint::FORWARD_HEADING, 0.3);
295+
true, false, vortex_msgs::msg::WaypointMode::FORWARD_HEADING, 0.3);
293296
}
294297
}
295298

@@ -329,7 +332,7 @@ void PipelineFollowerNode::handleTwoLines(
329332
double forward = ground.y;
330333

331334
auto [dx, dy] = rotateXY(forward, right, robot_yaw_);
332-
auto [xc, yc] = rotateXY(camera_placment_x_, 0, robot_yaw_);
335+
auto [xc, yc] = rotateXY(camera_placment_x_, camera_placment_y_, robot_yaw_);
333336

334337
double x_in_meters = robot_x_ + dx + xc;
335338
double y_in_meters = robot_y_ + dy + yc;
@@ -343,7 +346,7 @@ void PipelineFollowerNode::handleTwoLines(
343346
last_corner_x_ = x_in_meters;
344347
last_corner_y_ = y_in_meters;
345348
have_last_corner_ = true;
346-
auto new_robot_z = hight_regulator(robot_a_, robot_z_);
349+
auto new_robot_z = hight_regulator(robot_a_, robot_z_, target_height_);
347350

348351
double angle_rad = angleBetweenLinesRad(robot_yaw_, p1, p2, q1, q2);
349352
double yaw_rad = angle_rad;
@@ -353,14 +356,14 @@ void PipelineFollowerNode::handleTwoLines(
353356
wp1.pose.position.y = y_in_meters;
354357
wp1.pose.position.z = new_robot_z;
355358
wp1.pose.orientation = quatFromYaw(robot_yaw_);
356-
wp1.mode = vortex_msgs::msg::Waypoint::FULL_POSE;
359+
wp1.waypoint_mode.mode = vortex_msgs::msg::WaypointMode::FULL_POSE;
357360

358361
vortex_msgs::msg::Waypoint wp2;
359362
wp2.pose.position.x = x_in_meters;
360363
wp2.pose.position.y = y_in_meters;
361364
wp2.pose.position.z = new_robot_z;
362365
wp2.pose.orientation = quatFromYaw(yaw_rad);
363-
wp2.mode = vortex_msgs::msg::Waypoint::FULL_POSE;
366+
wp2.waypoint_mode.mode = vortex_msgs::msg::WaypointMode::FULL_POSE;
364367

365368
double xf = x_in_meters + 0.5 * std::cos(yaw_rad);
366369
double yf = y_in_meters + 0.5 * std::sin(yaw_rad);
@@ -370,7 +373,7 @@ void PipelineFollowerNode::handleTwoLines(
370373
wp3.pose.position.y = yf;
371374
wp3.pose.position.z = new_robot_z;
372375
wp3.pose.orientation = quatFromYaw(yaw_rad);
373-
wp3.mode = vortex_msgs::msg::Waypoint::FULL_POSE;
376+
wp3.waypoint_mode.mode = vortex_msgs::msg::WaypointMode::FULL_POSE;
374377

375378
enqueueWaypoint(wp1, true, true, 0.1);
376379
enqueueWaypoint(wp2, false, true, 0.1);

0 commit comments

Comments
 (0)