41 const float blend_radius,
const bool cartesian)
48 uint8_t* b_pos = buffer;
50 if (positions !=
nullptr)
52 for (
auto const& pos : *positions)
56 b_pos +=
append(b_pos, val);
61 b_pos += 6 *
sizeof(int32_t);
65 b_pos += 6 *
sizeof(int32_t);
66 b_pos += 6 *
sizeof(int32_t);
68 int32_t val =
static_cast<int32_t
>(goal_time *
MULT_TIME);
70 b_pos +=
append(b_pos, val);
72 val =
static_cast<int32_t
>(blend_radius *
MULT_TIME);
74 b_pos +=
append(b_pos, val);
86 b_pos +=
append(b_pos, val);
94 const vector6d_t* accelerations,
const float goal_time)
105 uint8_t* b_pos = buffer;
106 if (positions !=
nullptr)
108 for (
auto const& pos : *positions)
112 b_pos +=
append(b_pos, val);
117 throw urcl::UrException(
"TrajectoryPointInterface::writeTrajectorySplinePoint is only getting a nullptr for " 121 if (velocities !=
nullptr)
124 for (
auto const& vel : *velocities)
128 b_pos +=
append(b_pos, val);
133 throw urcl::UrException(
"TrajectoryPointInterface::writeTrajectorySplinePoint is only getting a nullptr for " 137 if (accelerations !=
nullptr)
140 for (
auto const& acc : *accelerations)
144 b_pos +=
append(b_pos, val);
149 b_pos += 6 *
sizeof(int32_t);
152 int32_t val =
static_cast<int32_t
>(goal_time *
MULT_TIME);
154 b_pos +=
append(b_pos, val);
156 val =
static_cast<int32_t
>(spline_type);
158 b_pos +=
append(b_pos, val);
162 b_pos +=
append(b_pos, val);
177 URCL_LOG_ERROR(
"Connection request to TrajectoryPointInterface received while connection already established. Only " 178 "one connection is allowed at a time. Ignoring this request.");
184 URCL_LOG_DEBUG(
"Connection to trajectory interface dropped.", filedescriptor);
192 int32_t* status =
reinterpret_cast<int*
>(buffer);
193 URCL_LOG_DEBUG(
"Received message %d on TrajectoryPointInterface", be32toh(*status));
201 URCL_LOG_DEBUG(
"Trajectory execution finished with result %d, but no callback was given.");
206 URCL_LOG_WARN(
"Received %d bytes on TrajectoryPointInterface. Expecting 4 bytes, so ignoring this message",
#define URCL_LOG_ERROR(...)
static const int32_t MULT_JOINTSTATE
size_t append(uint8_t *buffer, T &val)
bool writeTrajectoryPoint(const vector6d_t *positions, const float goal_time, const float blend_radius, const bool cartesian)
Writes needed information to the robot to be read by the URScript program.
virtual void connectionCallback(const int filedescriptor) override
virtual void messageCallback(const int filedescriptor, char *buffer, int nbytesrecv) override
virtual void disconnectionCallback(const int filedescriptor) override
#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(...)
TrajectoryPointInterface()=delete
std::function< void(TrajectoryResult)> handle_trajectory_end_
std::array< double, 6 > vector6d_t
static const int MESSAGE_LENGTH
static const int32_t MULT_TIME
The ReverseInterface class handles communication to the robot. It starts a server and waits for the r...
Our base class for exceptions. Specialized exceptions should inherit from those.
bool writeTrajectorySplinePoint(const vector6d_t *positions, const vector6d_t *velocities, const vector6d_t *accelerations, const float goal_time)
Writes needed information to the robot to be read by the URScript program including velocity and acce...