Closed marcos-pereira closed 5 years ago
Hello, @marcos-pereira,
Yes!
The constructor DQ_SerialManipulator()
is deleted because an uninitialized DQ_SerialManipulator
doesn't make sense and calling any of its methods would have unspecified behavior.
The correct way to do this is with a pointer. From what I understand of your problem, a raw pointer would suffice:
#include <iostream>
#include <vector>
#include <dqrobotics/robot_modeling/DQ_SerialManipulator.h>
#include <dqrobotics/robots/KukaLw4Robot.h>
#include <dqrobotics/robots/Ax18ManipulatorRobot.h>
#include <dqrobotics/robots/ComauSmartSixRobot.h>
using namespace DQ_robotics;
void do_something_with_dq_serial_manipulator(DQ_SerialManipulator* robot)
{
std::cout << "Joint count: " << robot->get_dim_configuration_space() << std::endl;
}
void test_issue_27()
{
DQ_SerialManipulator robot_a = KukaLw4Robot::kinematics();
DQ_SerialManipulator robot_b = Ax18ManipulatorRobot::kinematics();
DQ_SerialManipulator robot_c = ComauSmartSixRobot::kinematics();
std::vector<DQ_SerialManipulator*> serial_manipulators;
serial_manipulators.push_back(&robot_a);
serial_manipulators.push_back(&robot_b);
serial_manipulators.push_back(&robot_c);
for(DQ_SerialManipulator* serial_manipulator: serial_manipulators)
{
do_something_with_dq_serial_manipulator(serial_manipulator);
}
}
int main(void)
{
test_issue_27();
return 0;
}
Hello,
I would like to know if there is a way to change the robot of a DQ_SerialManipulator during runtime.
Something like:
This yields an error of the following type
My goal is to be able to use the robot_serial_manipulator overall in the code without having to declare a DQ_SerialManipulator for each robot. I want to use the same code for different robots chosen during runtime.
Stable PPA DQ Robotics version: 19.10.0-0~201910030916~ubuntu18.04.1
Thank you,
Marcos