Interface between DQ_Robotics and proxqp
- DQ Robotics for C++
- MacOS users require Homebrew
- Windows users require vcpkg (C:\vcpkg)
sudo add-apt-repository ppa:dqrobotics-dev/development
sudo apt-get update
sudo apt-get install libdqrobotics
sudo apt-get install libsimde-dev
Check the official PROXSuite instructions
Summary (MacOS using homebrew)
brew install proxsuite
Summary (Ubuntu: building from sources with the vectorization support disabled):
cd ~/Downloads
git clone https://github.com/Simple-Robotics/proxsuite.git --recursive
cd proxsuite
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_WITH_VECTORIZATION_SUPPORT=OFF
make
sudo make install
Summary (Windows using vcpkg)
If you do not have vcpkg:
cd C:/
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg; .\bootstrap-vcpkg.bat
.\vcpkg.exe integrate install
.\vcpkg install proxsuite
2. Build the cpp-interface-proxqp from sources (Tested on MacOS ARM64 and Ubuntu {20.04LTS-64Bits, 22.04LTS-64Bits})
cd ~/Downloads
git clone https://github.com/juanjqo/cpp-interface-proxqp.git
cd cpp-interface-proxqp
mkdir build
cd build
cmake ..
make -j16
sudo make install
cd ~/Downloads
git clone https://github.com/juanjqo/cpp-interface-proxqp.git
cd cpp-interface-proxqp
chmod +x debian/rules
fakeroot debian/rules clean
fakeroot debian/rules build
fakeroot debian/rules binary
cd ..
sudo dpkg -i ./*.deb
Run powershell as administrator:
mkdir build
cd build
cmake ..
cmake --build . --config Release
cmake --install .
#include <memory>
#include <dqrobotics/DQ.h>
#include <dqrobotics/solvers/DQ_PROXQPSolver.h>
#include <dqrobotics/robots/FrankaEmikaPandaRobot.h>
#include <dqrobotics/robot_control/DQ_ClassicQPController.h>
using namespace Eigen;
using namespace DQ_robotics;
int main(){
auto robot = std::make_shared<DQ_SerialManipulatorMDH>(FrankaEmikaPandaRobot::kinematics());
auto proxqp_solver = std::make_shared<DQ_PROXQPSolver>();
DQ_ClassicQPController controller_proxqp(robot, proxqp_solver);
controller_proxqp.set_gain(0.5);
controller_proxqp.set_damping(0.1);
controller_proxqp.set_control_objective(DQ_robotics::Translation);
controller_proxqp.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_proxqp = controller_proxqp.compute_setpoint_control_signal(q, vec4(xdesired.translation()));
std::cout<<"u_proxqp: "<<u_proxqp.transpose()<<std::endl;
}
u_proxqp: 0.107115 0.147883 0.107115 0.029608 0.107115 -0.261227 2.66176e-17
#include <memory>
#include <dqrobotics/solvers/DQ_PROXQPSolver.h>
using namespace Eigen;
using namespace DQ_robotics;
int main(){
auto proxqp_solver = std::make_shared<DQ_PROXQPSolver>();
MatrixXd H = MatrixXd::Zero(3,3);
H << 1,-1, 1,
-1, 2,-2,
1,-2, 4;
VectorXd f = VectorXd::Zero(3);
f << 2,-3, 1;
VectorXd lb = VectorXd::Zero(3);
VectorXd ub = VectorXd::Ones(3);
MatrixXd Aeq = MatrixXd::Ones(1,3);
VectorXd beq = VectorXd::Ones(1);
beq(0) = 0.5;
MatrixXd A(6,3);
VectorXd b(6);
MatrixXd I = MatrixXd::Identity(3,3);
A << I, -I;
b << ub, -lb;
auto u = proxqp_solver->solve_quadratic_program(H, f, A, b, Aeq, beq);
std::cout<<"u: "<<u.transpose()<<std::endl;
}
u: -9.84188e-17 0.5 -2.6844e-17
cmake_minimum_required(VERSION 3.5)
project(my_example LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
add_executable(my_example main.cpp)
target_link_libraries(my_example
dqrobotics)