I want to use the high level mode to send speed to the robot and simultaneously obtain feedback information on the robot's joint position, speed, and torque. I used the Async method, but my program encountered the following error:
Robot connection successful
[libprotobuf FATAL /home/robot/kortex-XH/api_cpp/examples/kortex_api/include/google/protobuf/repeated_field.h:1522] CHECK failed: (index) < (currentsize):
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: (index) < (currentsize):
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
When sending speed, the robot does indeed move, and the program does not enter the while loop, so joint information is not printed. I want to know how to solve this problem. Here is my program. I hope someone can help me check it. Thank you very much for your reply.
include "kortex_api/include/common/KortexRobot.h"
include "iostream"
include "utilities.h"
if defined(_MSC_VER)
include
else
include
endif
include
include //pinocchio
include
include <boost/asio.hpp>
include
include
include
include
include
int main(int argc, char **argv)
{
KortexRobot robot = KortexRobot("192.168.1.10");
int num = robot.GetNbDof();
if (robot.IsConnected())
{
std::cout << "Robot connection successful" << std::endl;
//Subscription notifications
robot.SubscribeToNotifications();
// Asynchronous thread sending speed and running for two seconds
auto async_task = std::async(std::launch::async, [&robot]() {
std::vector<float> speeds{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f};
robot.SetJointSpeeds(speeds);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
//Unsubscribe Notifications
robot.UnsubscribeToNotifications();
robot.stop();
});
// Main thread refresh feedback
while (async_task.wait_for(std::chrono::milliseconds(1)) != std::future_status::ready) {
robot.RefreshFeedback();
std::vector<float> jointPositions = robot.GetJointPositions();
std::vector<float> jointVelocities = robot.GetJointVelocities();
std::vector<float> jointTorques = robot.GetJointTorques();
cout << "Print joint information " << endl;
for (int i = 0; i < robot.GetNbDof(); i++)
{
std::cout <<"Joint" << i <<"\t Position" << jointPositions[i] <<"\t Velocity" << jointVelocities[i] << "\t Torque" << jointTorques[i] << std::endl;
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
std::cout << "End of example" << std::endl;
I want to use the high level mode to send speed to the robot and simultaneously obtain feedback information on the robot's joint position, speed, and torque. I used the Async method, but my program encountered the following error: Robot connection successful [libprotobuf FATAL /home/robot/kortex-XH/api_cpp/examples/kortex_api/include/google/protobuf/repeated_field.h:1522] CHECK failed: (index) < (currentsize): terminate called after throwing an instance of 'google::protobuf::FatalException' what(): CHECK failed: (index) < (currentsize):
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
When sending speed, the robot does indeed move, and the program does not enter the while loop, so joint information is not printed. I want to know how to solve this problem. Here is my program. I hope someone can help me check it. Thank you very much for your reply.
include "kortex_api/include/common/KortexRobot.h"
include "iostream"
include "utilities.h"
if defined(_MSC_VER)
include
else
include
endif
include
include//pinocchio
include
include <boost/asio.hpp>
include
include
include
include
include
int main(int argc, char **argv) {
}