46 #include <visp3/robot/vpReflexTakktile2.h>
48 int main(
int argc,
char *argv[])
50 std::string opt_network_interface =
"eth0";
51 std::string opt_finger_file_name =
"yaml/finger_calibrate.yaml";
52 std::string opt_tactile_file_name =
"yaml/tactile_calibrate.yaml";
53 std::string opt_motor_file_name =
"yaml/motor_constants.yaml";
55 for (
int i = 0; i < argc; i++) {
56 if (std::string(argv[i]) ==
"--network")
57 opt_network_interface = std::string(argv[i + 1]);
58 else if (std::string(argv[i]) ==
"--finger")
59 opt_finger_file_name = std::string(argv[i + 1]);
60 else if (std::string(argv[i]) ==
"--tactile")
61 opt_tactile_file_name = atoi(argv[i + 1]);
62 else if (std::string(argv[i]) ==
"--motor")
63 opt_motor_file_name = atoi(argv[i + 1]);
64 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
65 std::cout <<
"\nUsage: " << argv[0]
66 <<
" [--network <interface name>] "
67 " [--finger <calib file name>]"
68 " [--tactile <calib file name>]"
69 " [--motor <constants file name>]"
72 std::cout <<
"Options:" << std::endl;
73 std::cout <<
" --network <interface name>" << std::endl;
74 std::cout <<
"\tNetwork interface name. Default: " << opt_network_interface << std::endl << std::endl;
75 std::cout <<
" --finger <calib file name>" << std::endl;
76 std::cout <<
"\tFinger calibration file name. Default: " << opt_finger_file_name << std::endl << std::endl;
77 std::cout <<
" --tactile <calib file name>" << std::endl;
78 std::cout <<
"\tTactile calibration file name. Default: " << opt_tactile_file_name << std::endl << std::endl;
79 std::cout <<
" --motor <constants file name>" << std::endl;
80 std::cout <<
"\tMotor constants file name. Default: " << opt_motor_file_name << std::endl << std::endl;
81 std::cout <<
" --help, -h" << std::endl;
82 std::cout <<
"\tPrint this helper." << std::endl;
87 #ifdef VISP_HAVE_TAKKTILE2
100 std::cout <<
"Calibration complete" << std::endl;
106 std::cout <<
"Moving fingers..." << std::endl;
108 std::vector<vpColVector> finger_positions = {
109 {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}};
111 for (
size_t i = 0; i < finger_positions.size(); i++) {
116 std::cout <<
"Finger movement complete" << std::endl;
122 std::cout <<
"Moving preshape joint..." << std::endl;
124 std::vector<vpColVector> preshape_positions = {
125 {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}};
127 for (
size_t i = 0; i < preshape_positions.size(); i++) {
132 std::cout <<
"Preshape movement complete" << std::endl;
138 std::cout <<
"Changing to faster speed..." << std::endl;
139 vpColVector faster_velocities = {7.0, 7.0, 7.0, 7.0};
142 for (
size_t i = 0; i < finger_positions.size(); i++) {
147 std::cout <<
"Changing to slower speed..." << std::endl;
148 vpColVector slower_velocities = {0.5, 0.5, 0.5, 0.5};
151 for (
size_t i = 0; i < finger_positions.size(); i++) {
156 std::cout <<
"Done changing speeds" << std::endl;
162 std::cout <<
"Starting blended control..." << std::endl;
166 for (
int i = 0; i < 5; i++) {
173 std::cout <<
"Blended control complete" << std::endl;
179 std::cout <<
"Starting tactile feedback..." << std::endl
180 <<
"All fingers will stop moving when any one makes contact" << std::endl;
192 std::cout <<
"Now each finger will only stop moving once it makes contact" << std::endl;
194 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,
195 20, 20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30};
207 std::cout <<
"All torques disabled" << std::endl;
209 std::cout <<
"The end" << std::endl;
212 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)