42 const int message_length = 1;
44 uint8_t* b_pos = buffer;
46 b_pos +=
append(b_pos, val);
52 b_pos +=
append(b_pos, val);
61 const int message_length = 5;
63 uint8_t* b_pos = buffer;
65 b_pos +=
append(b_pos, val);
68 b_pos +=
append(b_pos, val);
70 for (
auto const& center_of_mass : *cog)
72 val = htobe32(static_cast<int32_t>(center_of_mass * MULT_JOINTSTATE));
73 b_pos +=
append(b_pos, val);
80 b_pos +=
append(b_pos, val);
89 const int message_length = 2;
91 uint8_t* b_pos = buffer;
93 b_pos +=
append(b_pos, val);
96 b_pos +=
append(b_pos, val);
102 b_pos +=
append(b_pos, val);
112 const int message_length = 26;
114 uint8_t* b_pos = buffer;
117 b_pos +=
append(b_pos, val);
119 for (
auto const& frame : *task_frame)
122 b_pos +=
append(b_pos, val);
125 for (
auto const& selection : *selection_vector)
128 b_pos +=
append(b_pos, val);
131 for (
auto const& force_torque : *wrench)
134 b_pos +=
append(b_pos, val);
138 b_pos +=
append(b_pos, val);
140 for (
auto const& lim : *limits)
142 val = htobe32(static_cast<int32_t>(lim * MULT_JOINTSTATE));
143 b_pos +=
append(b_pos, val);
150 b_pos +=
append(b_pos, val);
159 const int message_length = 1;
161 uint8_t* b_pos = buffer;
164 b_pos +=
append(b_pos, val);
170 b_pos +=
append(b_pos, val);
179 const int message_length = 1;
181 uint8_t* b_pos = buffer;
184 b_pos +=
append(b_pos, val);
190 b_pos +=
append(b_pos, val);
199 const int message_length = 1;
201 uint8_t* b_pos = buffer;
204 b_pos +=
append(b_pos, val);
210 b_pos +=
append(b_pos, val);
232 URCL_LOG_ERROR(
"Connection request to ScriptCommandInterface received while connection already established. Only " 233 "one connection is allowed at a time. Ignoring this request.");
239 URCL_LOG_DEBUG(
"Connection to ScriptCommandInterface dropped.", filedescriptor);
248 int32_t* status =
reinterpret_cast<int*
>(buffer);
249 URCL_LOG_DEBUG(
"Received message %d on Script command interface", be32toh(*status));
257 URCL_LOG_DEBUG(
"Tool contact execution finished with result %d, but no callback was given.", be32toh(*status));
262 URCL_LOG_WARN(
"Received %d bytes on script command interface. Expecting 4 bytes, so ignoring this message",
bool startToolContact()
This will make the robot look for tool contact in the tcp directions that the robot is currently movi...
virtual void messageCallback(const int filedescriptor, char *buffer, int nbytesrecv) override
#define URCL_LOG_ERROR(...)
ToolVoltage
Possible values for the tool voltage.
static const int32_t MULT_JOINTSTATE
bool setPayload(const double mass, const vector3d_t *cog)
Set the active payload mass and center of gravity.
ScriptCommandInterface()=delete
size_t append(uint8_t *buffer, T &val)
Start detecting tool contact.
bool endForceMode()
Stop force mode and put the robot into normal operation mode.
bool setToolVoltage(const ToolVoltage voltage)
Set the tool voltage.
std::array< double, 3 > vector3d_t
Zero force torque sensor.
End detecting tool contact.
virtual void disconnectionCallback(const int filedescriptor) override
bool clientConnected()
Returns whether a client/robot is connected to this server.
#define URCL_LOG_DEBUG(...)
bool write(const int fd, const uint8_t *buf, const size_t buf_len, size_t &written)
Writes to a client.
#define URCL_LOG_WARN(...)
bool endToolContact()
This will stop the robot from looking for a tool contact, it will also enable sending move commands t...
constexpr std::underlying_type< E >::type toUnderlying(const E e) noexcept
Converts an enum type to its underlying type.
virtual void connectionCallback(const int filedescriptor) override
static const int MAX_MESSAGE_LENGTH
std::array< uint32_t, 6 > vector6uint32_t
std::array< double, 6 > vector6d_t
bool zeroFTSensor()
Zero the force torque sensor.
bool startForceMode(const vector6d_t *task_frame, const vector6uint32_t *selection_vector, const vector6d_t *wrench, const unsigned int type, const vector6d_t *limits)
Set robot to be controlled in force mode.
The ReverseInterface class handles communication to the robot. It starts a server and waits for the r...
std::function< void(ToolContactResult)> handle_tool_contact_result_