YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
partitem.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
7#ifndef PARTITEM_H
8#define PARTITEM_H
9
10#include "flowlayout.h"
11#include "sequencewindow.h"
12#include "jointitem.h"
13#include "piddlg.h"
14#include "yarpmotorgui.h"
15
17#include <yarp/os/Port.h>
18#include <yarp/os/Network.h>
22#include <yarp/dev/PolyDriver.h>
23#include <yarp/sig/Vector.h>
24#include <yarp/os/Time.h>
26#include <yarp/os/Stamp.h>
27
28#include <QWidget>
29#include <QTimer>
30
31
32
33using namespace yarp::dev;
34using namespace yarp::sig;
35using namespace yarp::os;
36
37#define MAX_WIDTH_JOINT 320
38
39class PartItem : public QWidget
40{
42public:
43 explicit PartItem(std::string robotName,
44 int partId,
45 std::string partName,
50 std::string rcb_protocol,
51 QWidget *parent = 0);
52
53
54 ~PartItem();
55 bool openPolyDrivers();
56 void initInterfaces();
57 bool openInterfaces();
58 bool getInterfaceError();
59 void openSequenceWindow();
62 bool checkAndRunAllSeq();
66 void runPart();
67 void idlePart();
68 bool homeJoint(int joint);
69 bool homePart();
71 void calibratePart();
72 bool checkAndGo();
73 void stopSequence();
74 void setTreeWidgetModeNode(QTreeWidgetItem *node);
75 void loadSequence();
77 QTreeWidgetItem *getTreeWidgetModeNode();
78 std::string getPartName();
80 void resizeWidget(int w);
83 JointItem* getJointWidget(int jointIndex);
84
85
86private:
87 void fixedTimeMove(SequenceItem sequence);
88
89protected:
90 void resizeEvent(QResizeEvent *event) override;
91 void changeEvent(QEvent *event) override;
92
93private:
94 FlowLayout *m_layout;
95 SequenceWindow *m_sequenceWindow;
96 std::string m_robotPartPort;
97 std::string m_robotName;
98 std::string m_partName;
99 int m_partId;
100 bool m_mixedEnabled;
101 bool m_positionDirectEnabled;
102 bool m_pwmEnabled;
103 bool m_currentEnabled;
104 PidDlg *m_currentPidDlg;
105 Stamp m_sequence_port_stamp;
106 QTimer m_runTimer;
107 QTimer m_runTimeTimer;
108 QTimer m_cycleTimer;
109 QTimer m_cycleTimeTimer;
110
111 QList<SequenceItem> m_runValues;
112 QList<SequenceItem> m_runTimeValues;
113 QList<SequenceItem> m_cycleValues;
114 QList<SequenceItem> m_cycleTimeValues;
115 std::vector<int> m_controlModes;
116 std::vector<double> m_refTrajectorySpeeds;
117 std::vector<double> m_refTrajectoryPositions;
118 std::vector<double> m_refTorques;
119 std::vector<double> m_refVelocitySpeeds;
120 std::vector<double> m_refVelocityAccelerations;
121 std::vector<double> m_torques;
122 std::vector<double> m_positions;
123 std::vector<double> m_speeds;
124 std::vector<double> m_currents;
125 std::vector<double> m_motorPositions;
126 std::vector<double> m_dutyCycles;
127 std::vector<bool> m_done;
128 std::vector<bool> m_braked;
129 bool m_part_speedVisible;
130 bool m_part_motorPositionVisible;
131 bool m_part_dutyVisible;
132 bool m_part_currentVisible;
133 std::vector<InteractionModeEnum> m_interactionModes;
135
136 ResourceFinder* m_finder = nullptr;
137 PolyDriver* m_partsdd=nullptr;
138 Property m_partOptions;
139 Port m_sequence_port;
140 bool m_interfaceError;
141
142 IPositionControl* m_iPos = nullptr;
143 IJointBrake* m_ijointbrake = nullptr;
144 IPositionDirect* m_iPosDir = nullptr;
145 IVelocityControl* m_iVel = nullptr;
146 IVelocityDirect* m_iVelDir = nullptr;
147 IRemoteVariables* m_iVar = nullptr;
148 IEncoders* m_iencs = nullptr;
149 IMotorEncoders* m_iMot = nullptr;
150 IAmplifierControl* m_iAmp = nullptr;
151 IPidControl* m_iPid = nullptr;
152 ICurrentControl* m_iCur = nullptr;
153 IPWMControl* m_iPWM = nullptr;
154 ITorqueControl* m_iTrq = nullptr;
155 IImpedanceControl* m_iImp = nullptr;
156 IAxisInfo* m_iinfo = nullptr;
157 IControlLimits* m_iLim = nullptr;
158 IControlCalibration* m_ical = nullptr;
159 IControlMode* m_ictrlmode = nullptr;
160 IInteractionMode* m_iinteract = nullptr;
161 IJointFault* m_ijointfault = nullptr;
162 IRemoteCalibrator* m_iremCalib = nullptr;
163 int m_slow_k;
164
165signals:
175
176public slots:
177 void updateControlMode();
178 bool updatePart();
179 void onViewSpeedValues(bool);
180 void onViewMotorPositions(bool);
181 void onViewDutyCycles(bool);
182 void onViewCurrentValues(bool);
183 void onSetPosSliderOptionPI(int mode, double step, int numOfDec);
184 void onSetVelSliderOptionPI(int mode, double step, int numOfDec);
185 void onSetAccSliderOptionPI(int mode, double step, int numOfDec);
186 void onSetTrqSliderOptionPI(int mode, double step, int numOfDec);
187 void onSetCurSliderOptionPI(int mode, double step, int numOfDec);
188 void onViewPositionTargetBox(bool);
189 void onViewPositionTargetValue(bool);
191 void onEnableControlMixed(bool control);
193 void onEnableControlPWM(bool control);
197
198private slots:
199 void onSequenceActivated();
200 void onSequenceStopped();
201 void onStopSequence();
202 void onCycleTimeTimerTimeout();
203 void onCycleTimerTimeout();
204 void onRunTimerTimeout();
205 void onRunTimeout();
206 void onGo(SequenceItem);
207 void onOpenSequence();
208 void onSaveSequence(QList<SequenceItem> values, QString fileName);
209 void onSequenceRunTime(QList<SequenceItem>);
210 void onSequenceRun(QList<SequenceItem> values);
211 void onSequenceCycle(QList<SequenceItem>);
212 void onSequenceCycleTime(QList<SequenceItem>);
213 void onCalibClicked(JointItem *joint);
214 void onJointChangeMode(int mode,JointItem *joint);
215 void onJointInteraction(int interaction,JointItem *joint);
216 void onSliderDirectPositionCommand(double dirpos, int index);
217 void onSliderMixedPositionCommand(double pos, int index);
218 void onSliderMixedVelocityCommand(double vel, int index);
219 void onSliderTorqueCommand(double torqueVal, int index);
220 void onSliderPosTrajectoryPositionCommand(double pos, int index);
221 void onSliderPosTrajectoryVelocityCommand(double speedVal, int index);
222 void onSliderPWMCommand(double dutyVal, int index);
223 void onSliderCurrentCommand(double current, int index);
224 void onSliderVelTrajectoryVelocityCommand(double speedVal, int index);
225 void onSliderVelTrajectoryAccelerationCommand(double accVal, int index);
226 void onSliderVelocityDirectCommand(double speedVal, int index);
227 void onSequenceWindowDoubleClicked(int sequenceNum);
228 void onHomeClicked(JointItem *joint);
229 void onIdleClicked(JointItem *joint);
230 void onRunClicked(JointItem *joint);
231 void onPidClicked(JointItem *joint);
232 void onSendPositionPid(int jointIndex, Pid newPid);
233 void onSendVelocityPid(int jointIndex, Pid newPid);
234 void onSendCurrentPid(int jointIndex, Pid newPid);
235 void onSendSingleRemoteVariable(std::string key, yarp::os::Bottle val);
236 void onUpdateAllRemoteVariables();
237 void onSendTorquePid(int jointIndex, Pid newPid, MotorTorqueParameters newTorqueParam);
238 void onSendStiffness(int jointIdex, double stiff, double damp, double force);
239 void onSendPWM(int jointIndex, double dutyVal);
240 void onRefreshPids(int jointIndex);
241 void onDumpAllRemoteVariables();
242
243
244};
245
246#endif // PARTITEM_H
define control board standard interfaces
FeatureMode mode
define control board standard interfaces
contains the definition of a Vector type
Original license follows:
Definition flowlayout.h:59
void initInterfaces()
Definition partitem.cpp:379
bool openPolyDrivers()
Definition partitem.cpp:358
bool checkAndGo()
void cycleTimeSequence()
bool homePart()
void onEnableControlVelocityDirect(bool control)
bool checkAndRunAllSeq()
void onViewDutyCycles(bool)
void resizeWidget(int w)
bool homeToCustomPosition(const yarp::os::Bottle &positionElement)
void setCurrentIndex(int)
void runTimeSequence()
void idlePart()
JointItem * getJointWidget(int jointIndex)
int getNumberOfJoints()
void onEnableControlCurrent(bool control)
bool getInterfaceError()
Definition partitem.cpp:511
void onSetVelSliderOptionPI(int mode, double step, int numOfDec)
void onViewMotorPositions(bool)
void onEnableControlPWM(bool control)
void runPart()
void onEnableControlVelocity(bool control)
QString getJointName(int joint)
std::string getPartName()
Definition partitem.cpp:516
void onSetCurSliderOptionPI(int mode, double step, int numOfDec)
void onViewPositionTargetValue(bool)
void onViewPositionTargetBox(bool)
bool homeJoint(int joint)
void onViewCurrentValues(bool)
void runSequence()
void onSetTrqSliderOptionPI(int mode, double step, int numOfDec)
void sendPartJointsValues(int, QList< double >, QList< double >)
bool checkAndCycleAllSeq()
void closeSequenceWindow()
bool updatePart()
void onViewSpeedValues(bool)
void openSequenceWindow()
void updateControlMode()
void stopSequence()
void stoppedSequence()
void onEnableControlPositionDirect(bool control)
void saveSequence(QString global_filename)
void resizeEvent(QResizeEvent *event) override
void changeEvent(QEvent *event) override
void onEnableControlTorque(bool control)
void loadSequence()
void sequenceStopped()
const QVector< JointItem::JointState > & getPartModes()
void cycleSequence()
void onEnableControlMixed(bool control)
bool cycleAllSeq()
void onSetPosSliderOptionPI(int mode, double step, int numOfDec)
void sequenceActivated()
bool checkAndRunTimeAllSeq()
bool checkAndCycleTimeAllSeq()
QTreeWidgetItem * getTreeWidgetModeNode()
void setTreeWidgetModeNode(QTreeWidgetItem *node)
void onSetAccSliderOptionPI(int mode, double step, int numOfDec)
void calibratePart()
bool openInterfaces()
Definition partitem.cpp:403
Interface for control devices, amplifier commands.
Interface for getting information about specific axes, if available.
Definition IAxisInfo.h:36
Interface for control devices, calibration commands.
Interface for control devices, commands to get/set position and veloity limits.
Interface for setting control mode in control board.
Interface for control boards implementing current control.
Control board, encoder interface.
Definition IEncoders.h:116
Interface for control boards implementing impedance control.
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
Interface for controlling a joint equipped with brakes (hardware or simulated).
Definition IJointBrake.h:23
Interface for getting info about the fault which may occur on a robot.
Definition IJointFault.h:23
Control board, encoder interface.
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Definition IPWMControl.h:23
Interface for a generic control board device implementing a PID controller, with scaled arguments.
Interface for a generic control board device implementing position control.
Interface for a generic control board device implementing position control.
IRemoteCalibrator interface is meant to remotize the access of the calibration device in order to all...
IRemoteVariables interface.
Interface for control boards implementing torque control.
Interface for control boards implementing velocity control.
Interface for control boards implementing direct velocity control.
Contains the parameters for a PID.
A container for a device driver.
Definition PolyDriver.h:23
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:65
A mini-server for performing network communication in the background.
A mini-server for network communication.
Definition Port.h:46
A class for storing options and configuration information.
Definition Property.h:33
Helper class for finding config files and other external resources.
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
bool speedview_param_enabled
Definition main.cpp:35
bool debug_param_enabled
Definition main.cpp:34
bool enable_calib_all
Definition main.cpp:36
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.