Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a double free error while using Spatial Transform #75

Open
shubhamsingh91 opened this issue Jan 21, 2024 · 0 comments
Open

Getting a double free error while using Spatial Transform #75

shubhamsingh91 opened this issue Jan 21, 2024 · 0 comments

Comments

@shubhamsingh91
Copy link

Hi Matthew

Thanks for the open-sourcing the library. I was just testing some basic elements of the library and getting a run-time error (Double-free or corruption) in the following code:

#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
#include "src/BenchmarkingHelpers.hpp"

using namespace grbda;
using namespace grbda::ori;
using namespace grbda::spatial;

using std::cout;
using std::endl;

template <typename T>
void print(const T& var){
    cout << var << endl;
    cout << "---------------" << endl;
}

template <typename T>
void print(const T& var, const std::string& var_name){
    cout << var_name << " = " << var << endl;
    cout << "---------------" << endl;
}

int main(){

// cout << "Testing out simple objects/functions in GRBDA---" << endl;
// cout << "---------------Testing Cpptypes ------" << endl;

// RotMat<double> m1;
// m1.setOnes();
// print(m1);

// Vec4<float> v1;
// v1.setRandom();
// print(v1);

// DVec<int> d1;
// d1.resize(12);
// d1.setRandom();
// print(d1);

// d1.resize(2);
// print(d1);

// print("Testing Orientation Tools!");

// // rotx
// Mat3<float> Mx = coordinateRotation<float>(CoordinateAxis::X, 0.1);
// Mat3<float> My = coordinateRotation<float>(CoordinateAxis::Y, 0.2);
// Mat3<float> Mz = coordinateRotation<float>(CoordinateAxis::Z, 0.3);

// Mat3<float> Mfinal;
// Mfinal = Mx*My*Mz;
// print(Mfinal,"Mfinal");

// Vec3<float> vec_rpy{0.1,0.2,0.3};

// Mat3<float> Mfinal2 = rpyToRotMat(vec_rpy);
// print(Mfinal2,"Mfinal2");

// print(Mfinal-Mfinal2,"Mfinal-Mfinal2");
// print(vectorToSkewMat(vec_rpy),"skew(vecrpy)");

// Quat<float> q1 = rotationMatrixToQuaternion(Mfinal2);
// print(q1,"q(Mfinal2)");

// Mat3<float> Mfinal3 = quaternionToRotationMatrix(q1);
// print(Mfinal3, "Mfinal3");

// Vec3<float> om = {0.1,0.1,0.1};
// float dt {0.001};
// Quat<float> q2 = integrateQuat(q1,om,dt);
// print(q1,"q1");
// print(q2,"q2");

// print("---------------Testing Spatial Objects----");
// Transform<float> T1;
// T1.setIdentity();

// auto M4 = T1.getRotation();
// print(M4,"T1 rot");

// auto v4 = T1.getTranslation();
// print(v4,"v4");
// auto M5 = T1.toMatrix();

// print(M5,"M5");

// Transform<float> T2{Mfinal,vec_rpy};
// print(T2.getRotation(),"T2 rotation");
// print(T2.getTranslation(),"T2 translation");
// SVec<float> v6 {0.1,0.1,0.1,0.2,0.2,0.2};

// print(v6);
// auto v7 = T2.transformMotionVector(v6);
// print(v7,"v7");

D6Mat <float> D1;
D1.resize(6,2);
D1.setRandom();
print(D1,"D1");

 Transform<float> T3;
 T3.setIdentity();
 auto D2 = T3.transformMotionSubspace(D1);
 
 print(D2,"D2");




return 0;

}

I dont seem to find any dangling reference in the TransformMotionSubspace, but the error is generated from there. Did you have something like this while calling this function, or know what is happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant