Code of Conduct
By submitting this report you automatically agree that you've read and accepted the following conditions.
- Support for DQ Robotics is given voluntarily and it's not the developers' role to educate and/or convince anyone of their vision.
- Any possible response and its timeliness will be based on the relevance, accuracy, and politeness of a request and the following discussion.
- If a DQ Robotics member replies, the user must let them know if their response solves their issue or not.
- Any suggestion/advice/request made by anyone, as well intentioned as they might be, might not be incorporated into DQ Robotics.
Describe the missing/unexpected functionality
This problem is somewhat related to #24, but using a different constructor for pure quaternions or pure dual quaternions. Namely, when constructing them using double values, the C++ version of the code does not return pure quaternions or pure dual quaternions. In contrast, this construction is possible in MATLAB.
Matlab behavior
MATLAB SCRIPT
MATLAB OUTPUT
C++ behavior
C++ Code
#include <iostream>
#include <dqrobotics/DQ.h>
using namespace std;
int main()
{
DQ_robotics::DQ should_be_pure = DQ_robotics::DQ(1., 2., 3.);
cout << "should_be_pure = " << should_be_pure << endl;
return 0;
}
CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
include(${CMAKE_CURRENT_SOURCE_DIR}/../dqrobotics_dependencies.cmake)
project(simple_class_tests)
set (CMAKE_CXX_STANDARD 11)
FIND_PACKAGE(Eigen3 REQUIRED)
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
ADD_COMPILE_OPTIONS(-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
# DQ Dynamics library is installed here when using the regular
# cmake ., make, sudo make install
LINK_DIRECTORIES(
/usr/local/lib/)
add_executable(test_dq_pure
test_dq_pure.cpp
)
TARGET_LINK_LIBRARIES(test_dq_pure
dqrobotics
)
C++ OUTPUT
Environment:
- OS: Ubuntu 22.04.5 LTS
- dqrobotics version: development
- MATLAB version: R2023b
Additional context
One possible solution would be to overload the constructor
explicit DQ(const double& q0=0.0,
const double& q1=0.0,
const double& q2=0.0,
const double& q3=0.0,
const double& q4=0.0,
const double& q5=0.0,
const double& q6=0.0,
const double& q7=0.0) noexcept;
to behave similarly to the one in MATLAB, which throws:
The DQ constructor accepts only vectors with 1 (scalar), 3 (pure quaternion), 4 (quaternion), 6 (pure dual
quaternion) or 8 (dual quaternion) elements.
Code of Conduct
By submitting this report you automatically agree that you've read and accepted the following conditions.
Describe the missing/unexpected functionality
This problem is somewhat related to #24, but using a different constructor for pure quaternions or pure dual quaternions. Namely, when constructing them using double values, the C++ version of the code does not return pure quaternions or pure dual quaternions. In contrast, this construction is possible in MATLAB.
Matlab behavior
MATLAB SCRIPT
MATLAB OUTPUT
ans = 1i + 2j + 3kC++ behavior
C++ Code
CMakeLists.txt
C++ OUTPUT
Environment:
Additional context
One possible solution would be to overload the constructor
to behave similarly to the one in MATLAB, which throws: