logo
The core of the gRPC implementation are the relevant Protobuf files. The main file looks as follows:
protobuf
//ParametricRobotControlService provides an interface for simulating/controlling supported robots through GRPC. service ParametricRobotControlService { //Step 1: Setup the simulation/control environment. rpc SetupRobot (SetupRobotRequest) returns (SetupRobotReply); //Step 2: Define a task to be processed or simulated. rpc AddRobotTask (AddRobotTaskRequest) returns (AddRobotTaskReply); //Step 3: Subscribe to the feedback coming from the simulation/control environment. rpc SubscribeRobotFeedback (SubscribeRobotFeedbackRequest) returns (stream RobotFeedback); //Step 4: Request a simulation update, to be either provided directly or written to the feedback stream. rpc GetSimulatedRobotState (GetSimulatedRobotStateRequest) returns (RobotState); //Optional: Set a variable. rpc SetVariable (SetVariableRequest) returns (google.protobuf.Empty); //Optional: Ping the controller. rpc SendPing (Ping) returns (Ping); }
gRPC has predefined messages that describe objects. For example, a JointTarget contains a list of (external) axis values and values for speed and acceleration.
protobuf
//JointTarget contains the target position of the robot in joint space, as well as the speed and acceleration of the robot. message JointTarget{ //The target position of the robot in joint space. repeated float axis_values = 1; //The speed of the robot, either one value per axis or a single value for all. repeated float speed = 2; //The acceleration of the robot, either one value per axis or a single value for all. repeated float acceleration = 3; //The position of any external axes of the robot. repeated float external_axis_values = 4; }
On the other hand, a CartesianTarget defines a CartesianPosition, which can be defined by either a Matrix4x4, Euler values, or a CoordinateSystem.
protobuf
//CartesianTarget contains the position defined as a CartesianPosition and addds information relating to the posture, speed, acceleration of the robot, as well as of its external axes. message CartesianTarget{ //The CartesianPosition of the target. CartesianPosition position = 1; //The posture of the robot. string posture = 2; //The speed of the robot, either one value per axis or a single value for all. repeated float speed = 3; //The acceleration of the robot, either one value per axis or a single value for all. repeated float acceleration = 4; //The position of any external axes of the robot. repeated float external_axis_values = 5; }
protobuf
//CartesianPosition uses one of three definitions to define a Cartesian position, either as a matrix, through Euler values, or a coordinate system. message CartesianPosition{ //The frame, defined either as matrix, Euler values, or coordinate system. oneof frame { Matrix4x4 matrix = 1; Euler euler = 2; CoordinateSystem cs = 3; } //The CartesianReference enum describes if the current frame is absolute, relative, or linked to a parent. CartesianReference reference = 4; //A parent matrix can be provided. Matrix4x4 parent = 5; }
Based on the protobuf files, native code for languages such as C#, Python or Javascript can be automatically generated.
Share