The Path Planning Service automatically generates motion paths for the manipulator to reach a target without colliding with its surroundings.
Uses environment information, including robot model, tools, and obstacles, to calculate interference-free paths between start and end points.
Creation of environmental models can be performed by any one of the following methods:
Connecting to the gRPC service can be performed by using the hostname or IP address followed by the port number.
| Hostname | Port |
|---|---|
| PathPlanningService | 50310 |
The following example demonstrates how to connect to the gRPC channel then plan and execute a path.
#include <grpc/grpc.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/create_channel.h>
#include "ppls/v1/path_planning_service.grpc.pb.h"
#include <unistd.h>
#include <iostream>
using namespace ppls::v1;
int main(void) {
// Initialize the gRPC client
auto channel = grpc::CreateChannel("PathPlanningService:50310" , grpc::InsecureChannelCredentials());
auto stub = PathPlanningService::NewStub(channel)
// Define start and end positions
TargetPos start_pos; // <-- Fill out this position data, often is set to robot current position
TargetPos end_pos; // <-- Fill out this position data
// Plan the path
grpc::ClientContext context;
PlanPathRequest planReq;
PlanPathResponse planRes;
planReq.set_group_no(0);
planReq.set_tool(0);
planReq.set_start(start_pos);
planReq.set_end(start_pos);
grpc::Status status = stub->PlanPath(&context, planReq, &planRes);
// Handle error status
if (!status.ok()) {
std::cerr << "Error calling PlanPath: " << status.error_message() << std::endl;
return 1;
}
// Execute the planned path
grpc::ClientContext context2;
ExecutePlannedPathRequest execReq;
ExecutePlannedPathResponse execRes;
execReq.set_planning_result_handle(response.planning_result_handle());
execReq.set_enable_wait_completion(true);
status = stub->ExecutePlannedPath(&context2, execReq, &execRes);
// Handle error status
if (!status.ok()) {
std::cerr << "Error calling ExecutePlannedPath: " << status.error_message() << std::endl;
return 1;
}
std::cout << "Path planning successful" << std::endl;
return 0;
}