Skip to content
Snippets Groups Projects
Commit 009273bf authored by Joschua Gosda's avatar Joschua Gosda
Browse files

tried handing over shared model ptr directly but cannot be given to python cuz of its type

parent 94522de8
No related branches found
No related tags found
1 merge request!2Cleanup
......@@ -3,4 +3,4 @@
std::pair<Eigen::Matrix<double, 7, 1>, Eigen::Matrix<double, 6, 1>> gpm(Eigen::Matrix<double, 6, 1> &desPose, Eigen::Matrix<double, 6, 1> &desVelocity,
Eigen::Matrix<double, 7, 1> &jointAngles, Eigen::Matrix<double, 7, 1> &jointVelocity, void * kinematic_ptr);
Eigen::Matrix<double, 7, 1> &jointAngles, Eigen::Matrix<double, 7, 1> &jointVelocity, std::shared_ptr<rl::mdl::Model> model);
......@@ -4,10 +4,9 @@ class Arm {
public:
Arm(std::string path);
void* get_pointer2arm();
std::shared_ptr<rl::mdl::Model> get_pointer2arm();
private:
rl::mdl::Kinematic* kin_pointer;
rl::mdl::Kinematic kin_model;
void* void_pointer;
//rl::mdl::Kinematic kin_model;
std::shared_ptr<rl::mdl::Model> model;
};
......@@ -11,12 +11,11 @@
std::pair<Eigen::Matrix<double, 7, 1>, Eigen::Matrix<double, 6, 1>> gpm(Eigen::Matrix<double, 6, 1> &desPose, Eigen::Matrix<double, 6, 1> &desVelocity,
Eigen::Matrix<double, 7, 1> &jointAngles, Eigen::Matrix<double, 7, 1> &jointVelocity, void * kinematic_ptr) {
Eigen::Matrix<double, 7, 1> &jointAngles, Eigen::Matrix<double, 7, 1> &jointVelocity, std::shared_ptr<rl::mdl::Model> model) {
rl::mdl::Kinematic* kinematic = dynamic_cast<rl::mdl::Kinematic*>(model.get());
// FORWARD KINEMATICS
rl::mdl::Kinematic* kinematic = (rl::mdl::Kinematic*) kinematic_ptr;
std::cout << "adress of pointer gpm " << kinematic_ptr << std::endl;
//std::cout << "pointer in gpm" << kinematic_ptr << std::endl;
......
......@@ -7,15 +7,15 @@
Arm::Arm(std::string path){
rl::mdl::UrdfFactory factory;
std::shared_ptr<rl::mdl::Model> model(factory.create(path));
kin_pointer = dynamic_cast<rl::mdl::Kinematic*>(model.get());
kin_model = *(kin_pointer);
rl::mdl::Kinematic* tmp_pointer = &kin_model;
void_pointer = (void*) tmp_pointer;
std::cout << "adress of pointer load " << void_pointer << std::endl;
std::shared_ptr<rl::mdl::Model> model_tmp(factory.create(path));
model = model_tmp;
//std::cout << "adress of pointer load " << void_pointer << std::endl;
}
void* Arm::get_pointer2arm() {return void_pointer;}
std::shared_ptr<rl::mdl::Model> Arm::get_pointer2arm() {return model;}
/* class Arm {
public:
......
......@@ -24,7 +24,7 @@ int main(int, char**) {
rl::mdl::Kinematic* kinematic = dynamic_cast<rl::mdl::Kinematic*>(model.get());
Arm right_arm("/home/joschua/Coding/forceControl/master-project/c++/models/urdf/yumi_right.urdf");
void* test_pointer = right_arm.get_pointer2arm();
std::shared_ptr<rl::mdl::Model> abc = right_arm.get_pointer2arm();
// Is Values
Eigen::Matrix<double, 6, 1> actualPosition;
......@@ -44,7 +44,7 @@ int main(int, char**) {
desVelocity << 0.0, 0.0, 0.0, 0.0, 0.0, 0.0;
std::pair<Eigen::Matrix<double, 7, 1>, Eigen::Matrix<double, 6, 1>> result;
result = gpm(desPose, desVelocity, jointAngles, jointVelocity, test_pointer);
result = gpm(desPose, desVelocity, jointAngles, jointVelocity, abc);
std::cout << "desired joint values: \n" << result.first << std::endl;
std::cout << "current pose: \n" << result.second << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment