debugging
This commit is contained in:
parent
719502e631
commit
7858d6ef12
@ -8,6 +8,8 @@
|
||||
#include <atomic>
|
||||
#include <tuple>
|
||||
|
||||
#include "robotiq_2f_interface/SocketAdapterBase.hpp"
|
||||
|
||||
namespace robotiq{
|
||||
class MockRobotiq2fSocketAdapter : public SocketAdapterBase {
|
||||
public:
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <cerrno> // For errno
|
||||
#include <iostream>
|
||||
|
||||
#include "robotiq_2f_interface/SocketAdapterBase.hpp"
|
||||
|
||||
namespace robotiq{
|
||||
// Enum for Gripper Status
|
||||
enum class GripperStatus {
|
||||
@ -173,7 +175,7 @@ public:
|
||||
* @throws std::runtime_error if the adapter is not connected to the gripper, if the gripper is not in an
|
||||
* active state, or if the calibration sequence fails.
|
||||
*/
|
||||
void auto_calibrate(bool log=true) override;
|
||||
void auto_calibrate(bool log=true);
|
||||
|
||||
/**
|
||||
* Deactivates the gripper.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// IGripperAdapter.hpp
|
||||
// SocketAdapterBase.hpp
|
||||
|
||||
#ifndef SOCKET_ADAPTER_BASE_HPP
|
||||
#define SOCKET_ADAPTER_BASE_HPP
|
||||
|
@ -37,7 +37,7 @@ bool Robotiq2fSocketAdapter::connect(const std::string& hostname, int port) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (::connect(sockfd_, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
|
||||
if (::connect(*sockfd_, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
|
||||
std::cerr << "Connection to " << hostname << ":" << port << " failed: " << strerror(errno) << "\n";
|
||||
close(*sockfd_);
|
||||
*sockfd_ = -1;
|
||||
@ -344,20 +344,20 @@ std::tuple<int, ObjectStatus> Robotiq2fSocketAdapter::move_and_wait_for_pos(int
|
||||
|
||||
void Robotiq2fSocketAdapter::auto_calibrate(bool log=true) {
|
||||
// Open in case we are holding an object
|
||||
std::tuple<int, ObjectStatus> result = move_and_wait_for_pos(open_position, 64, 1);
|
||||
std::tuple<int, ObjectStatus> result = move_and_wait_for_pos(open_position_, 64, 1);
|
||||
if (std::get<1>(result) != ObjectStatus::AT_DEST) {
|
||||
throw std::runtime_error("Calibration failed opening to start.");
|
||||
}
|
||||
|
||||
// Close as far as possible
|
||||
result = move_and_wait_for_pos(closed_position, 64, 1);
|
||||
result = move_and_wait_for_pos(closed_position_, 64, 1);
|
||||
if (std::get<1>(result) != ObjectStatus::AT_DEST) {
|
||||
throw std::runtime_error("Calibration failed because of an object.");
|
||||
}
|
||||
max_position_ = std::get<0>(result); // Update max position
|
||||
|
||||
// Open as far as possible
|
||||
result = move_and_wait_for_pos(open_position, 64, 1);
|
||||
result = move_and_wait_for_pos(open_position_, 64, 1);
|
||||
if (std::get<1>(result) != ObjectStatus::AT_DEST) {
|
||||
throw std::runtime_error("Calibration failed because of an object.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user