23 #ifndef __PLUGINS_KATANA_CONTROLLER_KNI_H_ 24 #define __PLUGINS_KATANA_CONTROLLER_KNI_H_ 26 #include "controller.h" 28 #include <core/utils/refptr.h> 55 virtual void setup(std::string& device, std::string& kni_conffile,
56 unsigned int read_timeout,
unsigned int write_timeout);
76 virtual void move_to(
float x,
float y,
float z,
float phi,
float theta,
float psi,
bool blocking =
false);
77 virtual void move_to(std::vector<int> encoders,
bool blocking =
false);
78 virtual void move_to(std::vector<float> angles,
bool blocking =
false);
79 virtual void move_motor_to(
unsigned short id,
int enc,
bool blocking =
false);
80 virtual void move_motor_to(
unsigned short id,
float angle,
bool blocking =
false);
81 virtual void move_motor_by(
unsigned short id,
int enc,
bool blocking =
false);
82 virtual void move_motor_by(
unsigned short id,
float angle,
bool blocking =
false);
89 virtual double theta();
91 virtual void get_sensors(std::vector<int>& to,
bool refresh =
false);
92 virtual void get_encoders(std::vector<int>& to,
bool refresh =
false);
93 virtual void get_angles(std::vector<float>& to,
bool refresh =
false);
97 double __phi, __theta, __psi;
99 std::string __cfg_device;
100 std::string __cfg_kni_conffile;
101 unsigned int __cfg_read_timeout;
102 unsigned int __cfg_write_timeout;
105 #if __cplusplus >= 201103L 106 std::unique_ptr<CCdlCOM> __device;
107 std::unique_ptr<CCplSerialCRC> __protocol;
109 std::auto_ptr<CCdlCOM> __device;
110 std::auto_ptr<CCplSerialCRC> __protocol;
113 CSctBase *__sensor_ctrl;
114 std::vector<TMotInit> __motor_init;
116 std::vector<short> __active_motors;
117 std::vector<int> __gripper_last_pos;
119 bool motor_oor(
unsigned short id);
120 bool motor_final(
unsigned short id);
121 void cleanup_active_motors();
122 void add_active_motor(
unsigned short id);
virtual double z()
Get z-coordinate of latest endeffector position.
virtual void setup(std::string &device, std::string &kni_conffile, unsigned int read_timeout, unsigned int write_timeout)
Setup parameters needed to initialize Katana arm with libkni.
virtual double theta()
Get theta-rotation of latest endeffector orientation.
virtual void read_sensor_data()
Read all sensor data from device into controller libray.
Fawkes library namespace.
virtual void turn_on()
Turn on arm/motors.
virtual void move_to(float x, float y, float z, float phi, float theta, float psi, bool blocking=false)
Move endeffctor to given coordinates.
virtual double phi()
Get x-coordinate of latest endeffector position.
virtual double x()
Get x-coordinate of latest endeffector position.
Controller class for a Neuronics Katana, using libkni to interact with the real Katana arm...
virtual void init()
Initialize controller.
Abstract class for a Neuronics Katana controller.
virtual void move_motor_by(unsigned short id, int enc, bool blocking=false)
Move single joint/motor by encoder value (i.e.
virtual void turn_off()
Turn off arm/motors.
virtual void move_motor_to(unsigned short id, int enc, bool blocking=false)
Move single joint/motor to encoder value.
virtual void set_max_velocity(unsigned int vel)
Set maximum velocity.
virtual void gripper_close(bool blocking=false)
Close Gripper.
virtual double y()
Get y-coordinate of latest endeffector position.
virtual void read_motor_data()
Read motor data of currently active joints from device into controller libray.
virtual bool joint_angles()
Check if controller provides joint angle values.
virtual ~KatanaControllerKni()
Destructor.
virtual void calibrate()
Calibrate the arm.
KatanaControllerKni()
Constructor.
virtual double psi()
Get psi-rotation of latest endeffector orientation.
virtual void get_encoders(std::vector< int > &to, bool refresh=false)
Get encoder values of joints/motors.
virtual void get_angles(std::vector< float > &to, bool refresh=false)
Get angle values of joints/motors.
virtual void get_sensors(std::vector< int > &to, bool refresh=false)
Get sensor values.
virtual bool joint_encoders()
Check if controller provides joint encoder values.
virtual void gripper_open(bool blocking=false)
Open Gripper.
virtual void stop()
Stop movement immediately.
virtual void read_coordinates(bool refresh=false)
Store current coordinates of endeeffctor.