23 #ifndef _PLUGINS_KATANA_CONTROLLER_KNI_H_ 24 #define _PLUGINS_KATANA_CONTROLLER_KNI_H_ 26 #include "controller.h" 28 #include <core/utils/refptr.h> 53 virtual void setup(std::string &device,
54 std::string &kni_conffile,
55 unsigned int read_timeout,
56 unsigned int write_timeout);
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.