Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
takktile2-read-data.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Interface for the Reflex Takktile 2 hand from Right Hand Robotics.
32 */
33
40
41#include <iostream>
42#include <string>
43
44#include <visp3/core/vpConfig.h>
45#include <visp3/robot/vpReflexTakktile2.h>
46
47int main(int argc, char *argv[])
48{
49#ifdef ENABLE_VISP_NAMESPACE
50 using namespace VISP_NAMESPACE_NAME;
51#endif
52
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";
57
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]);
61 }
62 else if (std::string(argv[i]) == "--finger" && i + 1 < argc) {
63 opt_finger_file_name = std::string(argv[++i]);
64 }
65 else if (std::string(argv[i]) == "--tactile" && i + 1 < argc) {
66 opt_tactile_file_name = atoi(argv[++i]);
67 }
68 else if (std::string(argv[i]) == "--motor" && i + 1 < argc) {
69 opt_motor_file_name = atoi(argv[++i]);
70 }
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>]"
77 << " [--help] [-h]\n"
78 << std::endl;
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;
90
91 return EXIT_SUCCESS;
92 }
93 }
94#ifdef VISP_HAVE_TAKKTILE2
95 vpReflexTakktile2 reflex;
96 reflex.setNetworkInterface(opt_network_interface);
97 reflex.setFingerConfigFile(opt_finger_file_name);
98 reflex.setTactileConfigFile(opt_tactile_file_name);
99 reflex.setMotorConfigFile(opt_motor_file_name);
100
101 reflex.open();
102
103 // Hit CTRL-C to stop
104 while (true) {
105
106 std::cout << reflex.getHandInfo() << std::endl;
107 reflex.wait(50);
108 }
109
110#else
111 std::cout << "ViSP is not built to support Right Hand Reflex Takktile2 hand" << std::endl;
112#endif
113
114 return EXIT_SUCCESS;
115}
void setMotorConfigFile(const std::string &motor_file_name)
void setTactileConfigFile(const std::string &tactile_file_name)
void setNetworkInterface(const std::string &network_interface="eth0")
void setFingerConfigFile(const std::string &finger_file_name)
void wait(int milliseconds)