ClemensElflein / open_mower_ros

Other
500 stars 124 forks source link

Update mower_map_service.cpp #68

Closed AlbersSoftware closed 11 months ago

AlbersSoftware commented 11 months ago

Update to main: If the docking point is not set, the program logs an error message and exits with a non-zero error code, preventing any further processing. If the docking point is set, it proceeds to build the map and starts the ROS node event loop as before.

Signed-off by: Chris Albers chrisalberssoftware@gmail.com

AlbersSoftware commented 11 months ago

I realized this is looking for logic more like this: ros::ServiceClient dockingPointClient = n->serviceClient("mower_map_service/get_docking_point");

bool approachDockingPoint() { mower_map::GetDockingPointSrv srv; srv.request.docking_point_id = "desired_docking_point_id"; // Set the ID or name of the desired docking point

if (dockingPointClient.call(srv)) {
    // Successfully received information about the docking point
    double docking_x = srv.response.docking_point.x;
    double docking_y = srv.response.docking_point.y;
    double docking_orientation = srv.response.docking_point.orientation;

    // Use the received information to plan the approach to the docking point
    // Implement the approach logic here I couldn't find it in the codebase.
    // ...
}
else {
    ROS_ERROR("Failed to retrieve docking point information");
}

}

and I don't understand this projects code yet. Sorry for the PR i am a new programmer