44#include <visp3/core/vpConfig.h>
45#include <visp3/robot/vpReflexTakktile2.h>
47int main(
int argc,
char *argv[])
49#ifdef ENABLE_VISP_NAMESPACE
53 std::string opt_network_interface =
"eth0";
54 std::string opt_finger_file_name =
"yaml/finger_calibrate.yaml";
55 std::string opt_tactile_file_name =
"yaml/tactile_calibrate.yaml";
56 std::string opt_motor_file_name =
"yaml/motor_constants.yaml";
58 for (
int i = 1;
i < argc;
i++) {
59 if (std::string(argv[i]) ==
"--network" && i + 1 < argc) {
60 opt_network_interface = std::string(argv[++i]);
62 else if (std::string(argv[i]) ==
"--finger" && i + 1 < argc) {
63 opt_finger_file_name = std::string(argv[++i]);
65 else if (std::string(argv[i]) ==
"--tactile" && i + 1 < argc) {
66 opt_tactile_file_name = atoi(argv[++i]);
68 else if (std::string(argv[i]) ==
"--motor" && i + 1 < argc) {
69 opt_motor_file_name = atoi(argv[++i]);
71 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
72 std::cout <<
"\nUsage: " << argv[0]
73 <<
" [--network <interface name>] "
74 <<
" [--finger <calib file name>]"
75 <<
" [--tactile <calib file name>]"
76 <<
" [--motor <constants file name>]"
79 std::cout <<
"Options:" << std::endl;
80 std::cout <<
" --network <interface name>" << std::endl;
81 std::cout <<
"\tNetwork interface name. Default: " << opt_network_interface << std::endl << std::endl;
82 std::cout <<
" --finger <calib file name>" << std::endl;
83 std::cout <<
"\tFinger calibration file name. Default: " << opt_finger_file_name << std::endl << std::endl;
84 std::cout <<
" --tactile <calib file name>" << std::endl;
85 std::cout <<
"\tTactile calibration file name. Default: " << opt_tactile_file_name << std::endl << std::endl;
86 std::cout <<
" --motor <constants file name>" << std::endl;
87 std::cout <<
"\tMotor constants file name. Default: " << opt_motor_file_name << std::endl << std::endl;
88 std::cout <<
" --help, -h" << std::endl;
89 std::cout <<
"\tPrint this helper." << std::endl;
94#ifdef VISP_HAVE_TAKKTILE2
107 std::cout <<
"Calibration complete" << std::endl;
113 std::cout <<
"Moving fingers..." << std::endl;
115 std::vector<vpColVector> finger_positions = {
116 {0.0, 0.0, 0.0, 0.0}, {0.5, 0.5, 0.5, 0.0}, {1.0, 1.0, 1.0, 0.0}, {0.5, 0.5, 0.5, 0.0}, {0.0, 0.0, 0.0, 0.0} };
118 for (
size_t i = 0;
i < finger_positions.size();
i++) {
123 std::cout <<
"Finger movement complete" << std::endl;
129 std::cout <<
"Moving preshape joint..." << std::endl;
131 std::vector<vpColVector> preshape_positions = {
132 {0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.5}, {0.0, 0.0, 0.0, 1.5}, {0.0, 0.0, 0.0, 0.5}, {0.0, 0.0, 0.0, 0.0} };
134 for (
size_t i = 0;
i < preshape_positions.size();
i++) {
139 std::cout <<
"Preshape movement complete" << std::endl;
145 std::cout <<
"Changing to faster speed..." << std::endl;
146 vpColVector faster_velocities = { 7.0, 7.0, 7.0, 7.0 };
149 for (
size_t i = 0;
i < finger_positions.size();
i++) {
154 std::cout <<
"Changing to slower speed..." << std::endl;
155 vpColVector slower_velocities = { 0.5, 0.5, 0.5, 0.5 };
158 for (
size_t i = 0;
i < finger_positions.size();
i++) {
163 std::cout <<
"Done changing speeds" << std::endl;
169 std::cout <<
"Starting blended control..." << std::endl;
173 for (
int i = 0;
i < 5;
i++) {
180 std::cout <<
"Blended control complete" << std::endl;
186 std::cout <<
"Starting tactile feedback..." << std::endl
187 <<
"All fingers will stop moving when any one makes contact" << std::endl;
199 std::cout <<
"Now each finger will only stop moving once it makes contact" << std::endl;
201 std::vector<int> thresholds = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20,
202 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 };
214 std::cout <<
"All torques disabled" << std::endl;
216 std::cout <<
"The end" << std::endl;
219 std::cout <<
"ViSP is not built to support Right Hand Reflex Takktile2 hand" << std::endl;
Implementation of column vector and the associated operations.
void setVelocityUntilAnyContact(const vpColVector &targets)
void setVelocityUntilEachContact(const vpColVector &targets)
void setTactileThreshold(int threshold)
void setMotorConfigFile(const std::string &motor_file_name)
void setPosition(const vpColVector &targets)
void setTactileConfigFile(const std::string &tactile_file_name)
void setPositioningVelocity(const vpColVector &targets)
void setNetworkInterface(const std::string &network_interface="eth0")
void setFingerConfigFile(const std::string &finger_file_name)
void wait(int milliseconds)