Interface between DQ_Robotics and OSQP
Check the official OSQP instructions
Summary (Ubuntu):
cd ~/Downloads
git clone --recursive https://github.com/osqp/osqp
cd osqp
mkdir build && cd build
cmake -G "Unix Makefiles" ..
cmake --build .
cmake --build . --target install
cd ~/Downloads
git clone https://github.com/juanjqo/cpp-interface-osqp.git
cd cpp-interface-osqp
mkdir build && cd build
cmake ..
make -j16
sudo make install
#include <memory>
#include <dqrobotics/DQ.h>
#include <dqrobotics/solvers/DQ_OSQPSolver.h>
#include <dqrobotics/robots/FrankaEmikaPandaRobot.h>
#include <dqrobotics/robot_control/DQ_ClassicQPController.h>
using namespace Eigen;
using namespace DQ_robotics;
auto robot = std::make_shared<DQ_SerialManipulatorMDH>(FrankaEmikaPandaRobot::kinematics());
auto osqp_solver = std::make_shared<DQ_OSQPSolver>(DQ_OSQPSolver());
DQ_ClassicQPController controller_osqp(robot, osqp_solver);
controller_osqp.set_gain(0.5);
controller_osqp.set_damping(0.1);
controller_osqp.set_control_objective(DQ_robotics::Translation);
controller_osqp.set_stability_threshold(0.001);
DQ xdesired = 1 + E_*0.5*DQ(0, 0.2, 0.3, 0.3);
VectorXd q = VectorXd::Zero(7);
auto u_osqp = controller_osqp.compute_setpoint_control_signal(q, vec4(xdesired.translation()));
std::cout<<"u_osqp: "<<u_osqp.transpose()<<std::endl;
add_executable(my_example my_example.cpp)
target_link_libraries(my_example PRIVATE osqp::osqp
pthread
dqrobotics)