1#include "formrobotpilot.h"
2#include "ui_formrobotpilot.h"
4FormRobotPilot::FormRobotPilot(
RoboDK *rdk, QWidget *parent) : QWidget(parent),
15 setAttribute(Qt::WA_DeleteOnClose);
18 setWindowFlags(windowFlags() | Qt::Window);
21 ui->radCartesianTool->click();
27FormRobotPilot::~FormRobotPilot(){
37 if (all_robots.length() == 0){
38 ui->lblRobot->setText(
"Load a robot");
39 RDK->
ShowMessage(
"Select File-Open to load a robot or a RoboDK station",
false);
46 bool robot_is_selected = (
Robot !=
nullptr);
47 if (robot_is_selected) {
48 ui->lblRobot->setText(
"Selected robot:\n" +
Robot->
Name());
50 ui->lblRobot->setText(
"Robot not selected");
52 return robot_is_selected;
58 ui->btnTXn->setText(
"J1-");
59 ui->btnTXp->setText(
"J1+");
60 ui->btnTYn->setText(
"J2-");
61 ui->btnTYp->setText(
"J2+");
62 ui->btnTZn->setText(
"J3-");
63 ui->btnTZp->setText(
"J3+");
64 ui->btnRXn->setText(
"J4-");
65 ui->btnRXp->setText(
"J4+");
66 ui->btnRYn->setText(
"J5-");
67 ui->btnRYp->setText(
"J5+");
68 ui->btnRZn->setText(
"J6-");
69 ui->btnRZp->setText(
"J6+");
72 ui->btnTXn->setText(
"Tx-");
73 ui->btnTXp->setText(
"Tx+");
74 ui->btnTYn->setText(
"Ty-");
75 ui->btnTYp->setText(
"Ty+");
76 ui->btnTZn->setText(
"Tz-");
77 ui->btnTZp->setText(
"Tz+");
78 ui->btnRXn->setText(
"Rx-");
79 ui->btnRXp->setText(
"Rx+");
80 ui->btnRYn->setText(
"Ry-");
81 ui->btnRYp->setText(
"Ry+");
82 ui->btnRZn->setText(
"Rz-");
83 ui->btnRZp->setText(
"Rz+");
85void FormRobotPilot::on_radCartesianReference_clicked(){
89void FormRobotPilot::on_radCartesianTool_clicked()
94void FormRobotPilot::on_radJoints_clicked()
118 double step = sense * ui->spnStep->value();
121 bool is_joint_move = ui->radJoints->isChecked();
124 if (
id >= joints.
Length()){
125 qDebug() <<
"Internal problem: Invalid joint ID";
128 joints.
Data()[id] = joints.
Data()[id] + step;
131 RDK->
ShowMessage(tr(
"The robot can't move to this location"),
false);
135 if (id < 0 || id >= 6){
136 qDebug()<<
"Internal problem: Invalid id provided for an incremental move";
142 for (
int i=0; i<6; i++){
155 bool is_tcp_relative_move = ui->radCartesianTool->isChecked();
156 if (is_tcp_relative_move){
159 pose_robot_new = pose_robot * pose_increment;
166 Mat transformation_axes(pose_robot);
167 transformation_axes.
setPos(0, 0, 0);
168 Mat movement_pose_aligned = transformation_axes.
inv() * pose_increment * transformation_axes;
169 pose_robot_new = pose_robot * movement_pose_aligned;
174 RDK->
ShowMessage(tr(
"The robot can't move to this location"),
false);
188void FormRobotPilot::on_chkRunOnRobot_clicked(
bool checked){
192 ui->chkRunOnRobot->setChecked(
false);
203 RDK->
ShowMessage(tr(
"Run Mode set to run the real robot. Make sure you are properly connected to the robot (select Connect-Connect Robot)"),
false);
@ ITEM_TYPE_ROBOT
Item of type robot (.robot file)
virtual QString Name()=0
Returns the name of an item. The name of the item is always displayed in the RoboDK station tree.
virtual bool MoveJ(const Item &itemtarget)=0
Add a joint move to a program or move a robot to a target item ("Move Joint" mode)....
virtual Mat Pose()=0
Returns the local position (pose) of an object, target or reference frame. For example,...
virtual bool Connect(const QString &robot_ip="")=0
Connect to a real robot using the corresponding robot driver.
virtual tJoints Joints()=0
Returns the current joints of a robot or the joints of a target. If the item is a cartesian target,...
This class is the iterface to the RoboDK API. With the RoboDK API you can automate certain tasks and ...
@ RUNMODE_RUN_ROBOT
Moves the real robot from the PC (PC is the client, the robot behaves like a server).
@ RUNMODE_SIMULATE
Performs the simulation moving the robot (default)
virtual Item ItemUserPick(const QString &message="Pick one item", int itemtype=-1)=0
Shows a RoboDK popup to select one object from the open RoboDK station. An item type can be specified...
virtual void ShowMessage(const QString &message, bool popup=true)=0
Show a message in RoboDK (it can be blocking or non blocking in the status bar)
virtual void setRunMode(int run_mode=1)=0
Sets the behavior of the RoboDK API. By default, RoboDK shows the path simulation for movement instru...
virtual QList< Item > getItemList(int filter=-1)=0
Returns a list of items (list of names or pointers) of all available items in the currently open stat...
virtual void Render(int flags=RenderComplete)=0
Update the scene.
The Mat class represents a 4x4 pose matrix. The main purpose of this object is to represent a pose in...
void FromXYZRPW(tXYZWPR xyzwpr)
Calculates the pose from the position and euler angles ([x,y,z,r,p,w] vector) The result is the same ...
Mat inv() const
Invert the pose (homogeneous matrix assumed)
void setPos(double x, double y, double z)
Set the position (T position) in mm.
The tJoints class represents a joint position of a robot (robot axes).
int Length() const
Number of joint axes of the robot (or degrees of freedom)