3 #ifndef __KEYBOARD_CONTROLLER_HPP__
4 #define __KEYBOARD_CONTROLLER_HPP__
10 #include <yarp/os/RFModule.h>
11 #include <yarp/os/ResourceFinder.h>
13 #include <yarp/dev/PolyDriver.h>
14 #include <yarp/dev/IControlLimits.h>
15 #include <yarp/dev/IControlMode.h>
16 #include <yarp/dev/IEncoders.h>
17 #include <yarp/dev/IPositionControl.h>
18 #include <yarp/dev/IVelocityControl.h>
20 #include "LinearTrajectoryThread.hpp"
22 #include "KinematicRepresentation.hpp"
43 enum joint { Q1 = 0, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, MAX_JOINTS };
44 enum cart { X = 0, Y, Z, ROTX, ROTY, ROTZ, NUM_CART_COORDS };
46 bool configure(yarp::os::ResourceFinder & rf)
override;
47 bool updateModule()
override;
48 bool interruptModule()
override;
49 double getPeriod()
override;
50 bool close()
override;
53 enum control_modes { NOT_CONTROLLING, JOINT_MODE, CARTESIAN_MODE };
54 enum joint_mode { POSITION, VELOCITY };
56 static const std::plus<double> increment_functor;
57 static const std::minus<double> decrement_functor;
59 template <
typename func>
60 void incrementOrDecrementJointCommand(joint j, func op);
62 template <
typename func>
63 void incrementOrDecrementCartesianCommand(cart coord, func op);
65 void toggleJointMode();
66 void toggleReferenceFrame();
68 void actuateTool(
int command);
70 void printJointPositions();
71 void printCartesianPositions();
80 double jointPosStep {0.0};
81 double jointVelStep {0.0};
84 std::string angleRepr;
86 control_modes controlMode {NOT_CONTROLLING};
87 joint_mode jointMode {VELOCITY};
89 bool usingThread {
false};
92 yarp::dev::PolyDriver controlBoardDevice;
93 yarp::dev::PolyDriver cartesianControlDevice;
95 yarp::dev::IEncoders * iEncoders {
nullptr};
96 yarp::dev::IControlMode * iControlMode {
nullptr};
97 yarp::dev::IControlLimits * iControlLimits {
nullptr};
98 yarp::dev::IPositionControl * iPositionControl {
nullptr};
99 yarp::dev::IVelocityControl * iVelocityControl {
nullptr};
103 std::vector<double> minPositionLimits;
104 std::vector<double> maxPositionLimits;
105 std::vector<double> maxVelocityLimits;
106 std::vector<double> currentJointVels;
107 std::vector<double> currentCartVels;
Contains roboticslab::ICartesianControl and related vocabs.
constexpr int VOCAB_CC_ACTUATOR_NONE
No actuator or no action.
Definition: ICartesianControl.h:114
Abstract base class for a cartesian controller.
Definition: ICartesianControl.h:146
reference_frame
Lists supported reference frames.
Definition: ICartesianSolver.h:27
@ BASE_FRAME
Base frame.
Definition: ICartesianSolver.h:28
Sends streaming commands to the cartesian controller from a standard keyboard.
Definition: KeyboardController.hpp:37
Periodic thread that encapsulates a linear trajectory.
Definition: LinearTrajectoryThread.hpp:24
orientation_system
Lists available rotational representations.
Definition: KinematicRepresentation.hpp:36
@ AXIS_ANGLE
(axis_x, axis_y, axis_z, rotation angle) [axis needs not to be normalized]
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6