Fawkes API  Fawkes Development Version
fawkes::KatanaControllerKni Class Reference

Controller class for a Neuronics Katana, using libkni to interact with the real Katana arm. More...

#include <>>

Inheritance diagram for fawkes::KatanaControllerKni:

Public Member Functions

 KatanaControllerKni ()
 Constructor. More...
 
virtual ~KatanaControllerKni ()
 Destructor. More...
 
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. More...
 
virtual void init ()
 Initialize controller. More...
 
virtual void set_max_velocity (unsigned int vel)
 Set maximum velocity. More...
 
virtual bool final ()
 Check if movement is final. More...
 
virtual bool joint_angles ()
 Check if controller provides joint angle values. More...
 
virtual bool joint_encoders ()
 Check if controller provides joint encoder values. More...
 
virtual void calibrate ()
 Calibrate the arm. More...
 
virtual void stop ()
 Stop movement immediately. More...
 
virtual void turn_on ()
 Turn on arm/motors. More...
 
virtual void turn_off ()
 Turn off arm/motors. More...
 
virtual void read_coordinates (bool refresh=false)
 Store current coordinates of endeeffctor. More...
 
virtual void read_motor_data ()
 Read motor data of currently active joints from device into controller libray. More...
 
virtual void read_sensor_data ()
 Read all sensor data from device into controller libray. More...
 
virtual void gripper_open (bool blocking=false)
 Open Gripper. More...
 
virtual void gripper_close (bool blocking=false)
 Close Gripper. More...
 
virtual void move_to (float x, float y, float z, float phi, float theta, float psi, bool blocking=false)
 Move endeffctor to given coordinates. More...
 
virtual void move_to (std::vector< int > encoders, bool blocking=false)
 Move joints to encoder values. More...
 
virtual void move_to (std::vector< float > angles, bool blocking=false)
 Move joints to angle values. More...
 
virtual void move_motor_to (unsigned short id, int enc, bool blocking=false)
 Move single joint/motor to encoder value. More...
 
virtual void move_motor_to (unsigned short id, float angle, bool blocking=false)
 Move single joint/motor to angle value. More...
 
virtual void move_motor_by (unsigned short id, int enc, bool blocking=false)
 Move single joint/motor by encoder value (i.e. More...
 
virtual void move_motor_by (unsigned short id, float angle, bool blocking=false)
 Move single joint/motor by angle value (i.e. More...
 
virtual double x ()
 Get x-coordinate of latest endeffector position. More...
 
virtual double y ()
 Get y-coordinate of latest endeffector position. More...
 
virtual double z ()
 Get z-coordinate of latest endeffector position. More...
 
virtual double phi ()
 Get x-coordinate of latest endeffector position. More...
 
virtual double theta ()
 Get theta-rotation of latest endeffector orientation. More...
 
virtual double psi ()
 Get psi-rotation of latest endeffector orientation. More...
 
virtual void get_sensors (std::vector< int > &to, bool refresh=false)
 Get sensor values. More...
 
virtual void get_encoders (std::vector< int > &to, bool refresh=false)
 Get encoder values of joints/motors. More...
 
virtual void get_angles (std::vector< float > &to, bool refresh=false)
 Get angle values of joints/motors. More...
 
- Public Member Functions inherited from fawkes::KatanaController
virtual ~KatanaController ()
 Virtual empty destructor. More...
 

Detailed Description

Controller class for a Neuronics Katana, using libkni to interact with the real Katana arm.

Author
Bahram Maleki-Fard

Definition at line 48 of file controller_kni.h.

Constructor & Destructor Documentation

◆ KatanaControllerKni()

fawkes::KatanaControllerKni::KatanaControllerKni ( )

Constructor.

Definition at line 43 of file controller_kni.cpp.

◆ ~KatanaControllerKni()

fawkes::KatanaControllerKni::~KatanaControllerKni ( )
virtual

Destructor.

Definition at line 56 of file controller_kni.cpp.

Member Function Documentation

◆ calibrate()

void fawkes::KatanaControllerKni::calibrate ( )
virtual

Calibrate the arm.

Implements fawkes::KatanaController.

Definition at line 148 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ final()

bool fawkes::KatanaControllerKni::final ( )
virtual

Check if movement is final.

Returns
movement is final

Implements fawkes::KatanaController.

Definition at line 123 of file controller_kni.cpp.

◆ get_angles()

void fawkes::KatanaControllerKni::get_angles ( std::vector< float > &  to,
bool  refresh = false 
)
virtual

Get angle values of joints/motors.

Parameters
tovector to be filled with angle values for active joints.
refreshrefresh joints/motors data (call 'read_motor_data')?

Implements fawkes::KatanaController.

Definition at line 455 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ get_encoders()

void fawkes::KatanaControllerKni::get_encoders ( std::vector< int > &  to,
bool  refresh = false 
)
virtual

Get encoder values of joints/motors.

Parameters
tovector to be filled with encoder values for active joints.
refreshrefresh joints/motors data (call 'read_motor_data')?

Implements fawkes::KatanaController.

Definition at line 442 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ get_sensors()

void fawkes::KatanaControllerKni::get_sensors ( std::vector< int > &  to,
bool  refresh = false 
)
virtual

Get sensor values.

Parameters
tovector to be filled with all available sensor values.
refreshrefresh sensor data (call 'read_sensor_data')?

Implements fawkes::KatanaController.

Definition at line 421 of file controller_kni.cpp.

References read_sensor_data(), and fawkes::Exception::what().

◆ gripper_close()

void fawkes::KatanaControllerKni::gripper_close ( bool  blocking = false)
virtual

Close Gripper.

Parameters
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 246 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ gripper_open()

void fawkes::KatanaControllerKni::gripper_open ( bool  blocking = false)
virtual

Open Gripper.

Parameters
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 228 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ init()

void fawkes::KatanaControllerKni::init ( )
virtual

Initialize controller.

Implements fawkes::KatanaController.

Definition at line 82 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ joint_angles()

bool fawkes::KatanaControllerKni::joint_angles ( )
virtual

Check if controller provides joint angle values.

Returns
can get angle values

Implements fawkes::KatanaController.

Definition at line 137 of file controller_kni.cpp.

◆ joint_encoders()

bool fawkes::KatanaControllerKni::joint_encoders ( )
virtual

Check if controller provides joint encoder values.

Returns
can get encoder values

Implements fawkes::KatanaController.

Definition at line 142 of file controller_kni.cpp.

◆ move_motor_by() [1/2]

void fawkes::KatanaControllerKni::move_motor_by ( unsigned short  id,
int  enc,
bool  blocking = false 
)
virtual

Move single joint/motor by encoder value (i.e.

increase/decrease).

Parameters
idid of the joint/motor.
encincrease/decrease by encoder value.
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 349 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ move_motor_by() [2/2]

void fawkes::KatanaControllerKni::move_motor_by ( unsigned short  id,
float  angle,
bool  blocking = false 
)
virtual

Move single joint/motor by angle value (i.e.

increase/decrease).

Parameters
idid of the joint/motor.
angleincrease/decrease by angle value.
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 366 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ move_motor_to() [1/2]

void fawkes::KatanaControllerKni::move_motor_to ( unsigned short  id,
int  enc,
bool  blocking = false 
)
virtual

Move single joint/motor to encoder value.

Parameters
idid of the joint/motor.
enctarget encoder value.
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 315 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ move_motor_to() [2/2]

void fawkes::KatanaControllerKni::move_motor_to ( unsigned short  id,
float  angle,
bool  blocking = false 
)
virtual

Move single joint/motor to angle value.

Parameters
idid of the joint/motor.
angletarget angle value.
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 332 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ move_to() [1/3]

void fawkes::KatanaControllerKni::move_to ( float  x,
float  y,
float  z,
float  phi,
float  theta,
float  psi,
bool  blocking = false 
)
virtual

Move endeffctor to given coordinates.

Parameters
xtranslation on x-axis.
ytranslation on y-axis.
ztranslation on z-axis.
phi1st rotation of euler-ZXZ-rotation
theta2nd rotation of euler-ZXZ-rotation
psi3rd rotation of euler-ZXZ-rotation
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 264 of file controller_kni.cpp.

References fawkes::Exception::what().

Referenced by move_to().

◆ move_to() [2/3]

void fawkes::KatanaControllerKni::move_to ( std::vector< int >  encoders,
bool  blocking = false 
)
virtual

Move joints to encoder values.

Parameters
encodersvector containing encoder values for all joints.
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 283 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ move_to() [3/3]

void fawkes::KatanaControllerKni::move_to ( std::vector< float >  angles,
bool  blocking = false 
)
virtual

Move joints to angle values.

Parameters
anglesvector containing angle values for all joints.
blockingIs this a blocking call?

Implements fawkes::KatanaController.

Definition at line 299 of file controller_kni.cpp.

References move_to(), and fawkes::Exception::what().

◆ phi()

double fawkes::KatanaControllerKni::phi ( )
virtual

Get x-coordinate of latest endeffector position.

Call 'read_coordinates()' to read latest position.

Returns
x-coordinate Get phi-rotation of latest endeffector orientation. Call 'read_coordinates()' to read latest orientation.
phi-rotation (1st rotation of euler-ZXZ-rotation)

Implements fawkes::KatanaController.

Definition at line 403 of file controller_kni.cpp.

◆ psi()

double fawkes::KatanaControllerKni::psi ( )
virtual

Get psi-rotation of latest endeffector orientation.

Call 'read_coordinates()' to read latest orientation.

Returns
psi-rotation (3rd rotation of euler-ZXZ-rotation)

Implements fawkes::KatanaController.

Definition at line 415 of file controller_kni.cpp.

◆ read_coordinates()

void fawkes::KatanaControllerKni::read_coordinates ( bool  refresh = false)
virtual

Store current coordinates of endeeffctor.

Parameters
refreshfetch new joint data from device (update data in controller library). No need to set to 'true' if 'read_motor_data()' is being called regularly.

Implements fawkes::KatanaController.

Definition at line 188 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ read_motor_data()

void fawkes::KatanaControllerKni::read_motor_data ( )
virtual

Read motor data of currently active joints from device into controller libray.

Implements fawkes::KatanaController.

Definition at line 198 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ read_sensor_data()

void fawkes::KatanaControllerKni::read_sensor_data ( )
virtual

Read all sensor data from device into controller libray.

Implements fawkes::KatanaController.

Definition at line 216 of file controller_kni.cpp.

References fawkes::Exception::what().

Referenced by get_sensors().

◆ set_max_velocity()

void fawkes::KatanaControllerKni::set_max_velocity ( unsigned int  vel)
virtual

Set maximum velocity.

Parameters
velvelocity

Implements fawkes::KatanaController.

Definition at line 112 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ setup()

void fawkes::KatanaControllerKni::setup ( std::string &  device,
std::string &  kni_conffile,
unsigned int  read_timeout,
unsigned int  write_timeout 
)
virtual

Setup parameters needed to initialize Katana arm with libkni.

Parameters
devicedevice string, e.g. "/dev/ttyS0"
kni_conffilepath to kni configfile, e.g. "/etc/kni3/hd300/katana6M180.cfg"
read_timeouttimeout for read operations, in ms
write_timeouttimeout for write operations, in ms

Definition at line 72 of file controller_kni.cpp.

Referenced by KatanaActThread::init().

◆ stop()

void fawkes::KatanaControllerKni::stop ( )
virtual

Stop movement immediately.

Implements fawkes::KatanaController.

Definition at line 158 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ theta()

double fawkes::KatanaControllerKni::theta ( )
virtual

Get theta-rotation of latest endeffector orientation.

Call 'read_coordinates()' to read latest orientation.

Returns
theta-rotation (2nd rotation of euler-ZXZ-rotation)

Implements fawkes::KatanaController.

Definition at line 409 of file controller_kni.cpp.

◆ turn_off()

void fawkes::KatanaControllerKni::turn_off ( )
virtual

Turn off arm/motors.

Implements fawkes::KatanaController.

Definition at line 178 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ turn_on()

void fawkes::KatanaControllerKni::turn_on ( )
virtual

Turn on arm/motors.

Implements fawkes::KatanaController.

Definition at line 168 of file controller_kni.cpp.

References fawkes::Exception::what().

◆ x()

double fawkes::KatanaControllerKni::x ( )
virtual

Get x-coordinate of latest endeffector position.

Call 'read_coordinates()' to read latest position.

Returns
x-coordinate

Implements fawkes::KatanaController.

Definition at line 385 of file controller_kni.cpp.

◆ y()

double fawkes::KatanaControllerKni::y ( )
virtual

Get y-coordinate of latest endeffector position.

Call 'read_coordinates()' to read latest position.

Returns
y-coordinate

Implements fawkes::KatanaController.

Definition at line 391 of file controller_kni.cpp.

◆ z()

double fawkes::KatanaControllerKni::z ( )
virtual

Get z-coordinate of latest endeffector position.

Call 'read_coordinates()' to read latest position.

Returns
z-coordinate

Implements fawkes::KatanaController.

Definition at line 397 of file controller_kni.cpp.


The documentation for this class was generated from the following files: