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

Add additional support for perimeter board. #75

Merged
merged 4 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mower_logic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ add_executable(mower_logic
src/mower_logic/behaviors/IdleBehavior.cpp
src/mower_logic/behaviors/MowingBehavior.h
src/mower_logic/behaviors/MowingBehavior.cpp
src/mower_logic/behaviors/PerimeterDocking.h
src/mower_logic/behaviors/PerimeterDocking.cpp
src/mower_logic/behaviors/AreaRecordingBehavior.h
src/mower_logic/behaviors/AreaRecordingBehavior.cpp
)
Expand Down
5 changes: 3 additions & 2 deletions src/mower_logic/cfg/MowerLogic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ from dynamic_reconfigure.parameter_generator_catkin import ParameterGenerator, d
gen = ParameterGenerator()

gen.add("automatic_mode", int_t, 0, "0 - Manual, 1 - Semiautomatic, 2 - Automatic", 0, 0, 2)
gen.add("undock_distance", double_t, 0, "Distance to drive back for undocking", 2, 0, 5)
gen.add("docking_distance", double_t, 0, "Distance to drive forward during docking", 2, 0, 5)
gen.add("undock_distance", double_t, 0, "Distance to drive back for undocking", 2, 0, 100)
gen.add("docking_distance", double_t, 0, "Distance to drive forward during docking", 2, 0, 100)
gen.add("docking_approach_distance", double_t, 0, "Distance to approach docking point", 1.5, 0, 5)
gen.add("docking_retry_count", int_t, 0, "How often should we retry docking", 4, 1, 10)
gen.add("perimeter_signal",int_t, 0, "Which perimeter signal should be used? 0-None, positive number gives signal number and uses counterclockwise docking, negative numbers use clockwise docking", 0, -2, 2)
gen.add("outline_count", int_t, 0, "Outline count to mow before filling", 3, 0, 255)
gen.add("outline_overlap_count", int_t, 0, "Outlines to overlap with fill", 0, 0, 255)
gen.add("outline_offset", double_t, 0, "Additional outer outline offset, use positive values for safety, negative values to enlarge the area", 0.0, -1.0, 1.0)
Expand Down
4 changes: 4 additions & 0 deletions src/mower_logic/src/mower_logic/behaviors/DockingBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//
//
#include "DockingBehavior.h"
#include "PerimeterDocking.h"

extern ros::ServiceClient dockingPointClient;
extern actionlib::SimpleActionClient<mbf_msgs::MoveBaseAction> *mbfClient;
Expand Down Expand Up @@ -209,6 +210,9 @@ Behavior *DockingBehavior::execute() {
inApproachMode = false;
setGPS(false);

if (PerimeterSearchBehavior::configured(config))
return &PerimeterSearchBehavior::INSTANCE;

bool docked = dock_straight();

if (!docked) {
Expand Down
9 changes: 6 additions & 3 deletions src/mower_logic/src/mower_logic/behaviors/IdleBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//
//
#include "IdleBehavior.h"
#include "PerimeterDocking.h"

extern void stopMoving();
extern void stopBlade();
Expand Down Expand Up @@ -77,9 +78,11 @@ Behavior *IdleBehavior::execute() {
if (manual_start_mowing || ((automatic_mode || active_semiautomatic_task) && mower_ready)) {
// set the robot's position to the dock if we're actually docked
if(last_status.v_charge > 5.0) {
ROS_INFO_STREAM("Currently inside the docking station, we set the robot's pose to the docks pose.");
setRobotPose(docking_pose_stamped.pose);
return &UndockingBehavior::INSTANCE;
if (PerimeterUndockingBehavior::configured(config))
return &PerimeterUndockingBehavior::INSTANCE;
ROS_INFO_STREAM("Currently inside the docking station, we set the robot's pose to the docks pose.");
setRobotPose(docking_pose_stamped.pose);
return &UndockingBehavior::INSTANCE;
}
// Not docked, so just mow
setGPS(true);
Expand Down
Loading
Loading