An example showing how to control FRANKA's vacuum gripper.
An example showing how to control FRANKA's vacuum gripper.
#include <iostream>
#include <thread>
int main(int argc, char** argv) {
if (argc != 2) {
std::cerr << "Usage: ./vacuum_object <vacuum-gripper-hostname>" << std::endl;
return -1;
}
try {
std::cout << "Initial vacuum gripper state: " << vacuum_gripper_state << std::endl;
if (!vacuum_gripper.
vacuum(100, std::chrono::milliseconds(1000))) {
std::cout << "Failed to vacuum the object." << std::endl;
return -1;
}
vacuum_gripper_state = vacuum_gripper.
readOnce();
std::cout << "Vacuum gripper state after applying vacuum: " << vacuum_gripper_state
<< std::endl;
std::this_thread::sleep_for(std::chrono::duration<double, std::milli>(3000));
vacuum_gripper_state = vacuum_gripper.
readOnce();
std::cout << "Object lost." << std::endl;
return -1;
}
std::cout << "Vacuumed object, will release it now." << std::endl;
vacuum_gripper.
dropOff(std::chrono::milliseconds(1000));
std::cout << e.what() << std::endl;
return -1;
}
return 0;
}
Maintains a network connection to the vacuum gripper, provides the current vacuum gripper state,...
Definition vacuum_gripper.h:28
bool dropOff(std::chrono::milliseconds timeout) const
Drops the grasped object off.
bool stop() const
Stops a currently running vacuum gripper vacuum or drop off operation.
bool vacuum(uint8_t vacuum, std::chrono::milliseconds timeout, ProductionSetupProfile profile=ProductionSetupProfile::kP0) const
Vacuums an object.
VacuumGripperState readOnce() const
Waits for a vacuum gripper state update and returns it.
Contains exception definitions.
Base class for all exceptions used by libfranka.
Definition exception.h:20
Describes the vacuum gripper state.
Definition vacuum_gripper_state.h:31
bool in_control_range
Vacuum value within in setpoint area.
Definition vacuum_gripper_state.h:35
Contains the franka::VacuumGripper type.