Fawkes API Fawkes Development Version
controller_openrave.h
1
2/***************************************************************************
3 * controller_openrave.h - OpenRAVE Controller class for katana arm
4 *
5 * Created: Sat Jan 07 16:10:54 2012
6 * Copyright 2012-2014 Bahram Maleki-Fard
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_KATANA_CONTROLLER_OPENRAVE_H_
24#define _PLUGINS_KATANA_CONTROLLER_OPENRAVE_H_
25
26#include "controller.h"
27
28#include <core/utils/refptr.h>
29
30#ifdef HAVE_OPENRAVE
31# include <openrave/openrave.h>
32# include <plugins/openrave/types.h>
33#endif
34
35#include <memory>
36#include <string>
37#include <vector>
38
39namespace fawkes {
40
41class OpenRaveConnector;
42
44{
45#ifdef HAVE_OPENRAVE
46public:
49
50 // setup
51 virtual void init();
52 virtual void set_max_velocity(unsigned int vel);
53
54 // status checking
55 virtual bool final();
56 virtual bool joint_angles();
57 virtual bool joint_encoders();
58
59 // commands
60 virtual void calibrate();
61 virtual void stop();
62 virtual void turn_on();
63 virtual void turn_off();
64 virtual void read_coordinates(bool refresh = false);
65 virtual void read_motor_data();
66 virtual void read_sensor_data();
67 virtual void gripper_open(bool blocking = false);
68 virtual void gripper_close(bool blocking = false);
69 virtual void
70 move_to(float x, float y, float z, float phi, float theta, float psi, bool blocking = false);
71 virtual void move_to(std::vector<int> encoders, bool blocking = false);
72 virtual void move_to(std::vector<float> angles, bool blocking = false);
73 virtual void move_motor_to(unsigned short id, int enc, bool blocking = false);
74 virtual void move_motor_to(unsigned short id, float angle, bool blocking = false);
75 virtual void move_motor_by(unsigned short id, int enc, bool blocking = false);
76 virtual void move_motor_by(unsigned short id, float angle, bool blocking = false);
77
78 // getters
79 virtual double x();
80 virtual double y();
81 virtual double z();
82 virtual double phi();
83 virtual double theta();
84 virtual double psi();
85 virtual void get_sensors(std::vector<int> &to, bool refresh = false);
86 virtual void get_encoders(std::vector<int> &to, bool refresh = false);
87 virtual void get_angles(std::vector<float> &to, bool refresh = false);
88
89private:
90 double x_, y_, z_;
91 double phi_, theta_, psi_;
92
93 fawkes::OpenRaveConnector * openrave_;
97 OpenRAVE::EnvironmentBasePtr env_;
98 OpenRAVE::RobotBasePtr robot_;
99 OpenRAVE::RobotBase::ManipulatorPtr manip_;
100
101 bool initialized_;
102
103 std::vector<short> active_motors_;
104
105 void update_manipulator();
106 void wait_finished();
107 void check_init();
108
109 bool motor_oor(unsigned short id);
110#endif //HAVE_OPENRAVE
111};
112
113} // end of namespace fawkes
114
115#endif
Controller class for a Neuronics Katana, using libkni to interact with the real Katana arm.
Abstract class for a Neuronics Katana controller.
Definition: controller.h:35
virtual double phi()=0
Get x-coordinate of latest endeffector position.
virtual void gripper_open(bool blocking=false)=0
Open Gripper.
virtual bool joint_angles()=0
Check if controller provides joint angle values.
virtual void read_motor_data()=0
Read motor data of currently active joints from device into controller libray.
virtual void set_max_velocity(unsigned int vel)=0
Set maximum velocity.
virtual double theta()=0
Get theta-rotation of latest endeffector orientation.
virtual void gripper_close(bool blocking=false)=0
Close Gripper.
virtual void read_sensor_data()=0
Read all sensor data from device into controller libray.
virtual double psi()=0
Get psi-rotation of latest endeffector orientation.
virtual double y()=0
Get y-coordinate of latest endeffector position.
virtual void init()=0
Initialize controller.
virtual double z()=0
Get z-coordinate of latest endeffector position.
virtual void move_motor_to(unsigned short id, int enc, bool blocking=false)=0
Move single joint/motor to encoder value.
virtual void move_motor_by(unsigned short id, int enc, bool blocking=false)=0
Move single joint/motor by encoder value (i.e.
virtual bool joint_encoders()=0
Check if controller provides joint encoder values.
virtual double x()=0
Get x-coordinate of latest endeffector position.
virtual void turn_on()=0
Turn on arm/motors.
virtual void get_sensors(std::vector< int > &to, bool refresh=false)=0
Get sensor values.
virtual void calibrate()=0
Calibrate the arm.
virtual void get_encoders(std::vector< int > &to, bool refresh=false)=0
Get encoder values of joints/motors.
virtual void stop()=0
Stop movement immediately.
virtual void move_to(float x, float y, float z, float phi, float theta, float psi, bool blocking=false)=0
Move endeffctor to given coordinates.
virtual void get_angles(std::vector< float > &to, bool refresh=false)=0
Get angle values of joints/motors.
virtual void read_coordinates(bool refresh=false)=0
Store current coordinates of endeeffctor.
virtual void turn_off()=0
Turn off arm/motors.
Interface for a OpenRave connection creator.
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:50
Fawkes library namespace.