Xinyu-Yi / PIP

A real-time system that captures physically correct human motion, joint torques, and ground reaction forces with only 6 inertial measurement units
https://xinyu-yi.github.io/PIP/
GNU General Public License v3.0
304 stars 38 forks source link

rbdl安装 #5

Open Jaceyxy opened 2 years ago

Jaceyxy commented 2 years ago

请问如何在windows安装rbdl和urdf,我使用vcpkg在windows下安装了rbdl image 但仍然提示无法找到rbdl 十分感谢

mariolew commented 2 years ago

AttributeError: module 'rbdl' has no attribute 'CalcZeroMomentPoint' 提示这个错误是什么意思呢 rbdl已经编译安装好了 他就是没这个接口

Jaceyxy commented 2 years ago

@mariolew 你好,请问你是在windows编译安装的嘛,方便交流一下过程嘛

mariolew commented 2 years ago

@Jaceyxy linux

xinzi2018 commented 2 years ago

我在linux环境下安装也出现了 module 'rbdl' has no attribute 'CalcZeroMomentPoint' 这个问题。但是在安装包/home/***/tools/rbdl/src/rbdl_utils.cc中有看到对应的文件,不知道为啥检索不到

Xinyu-Yi commented 2 years ago

AttributeError: module 'rbdl' has no attribute 'CalcZeroMomentPoint' 提示这个错误是什么意思呢 rbdl已经编译安装好了 他就是没这个接口

是的,这个函数在rbdl_utils.cc中,如果正常编译通过的话应该会有这个函数的实现

Xinyu-Yi commented 2 years ago

请问如何在windows安装rbdl和urdf,我使用vcpkg在windows下安装了rbdl image 但仍然提示无法找到rbdl 十分感谢

Windows下需要自己编译并且安装他的python wrapper,需要大量修改代码,我已经不记得了。你只能一边编译一边看报错,然后改代码

Xinyu-Yi commented 2 years ago

我在linux环境下安装也出现了 module 'rbdl' has no attribute 'CalcZeroMomentPoint' 这个问题。但是在安装包/home/***/tools/rbdl/src/rbdl_utils.cc中有看到对应的文件,不知道为啥检索不到

看了一下源代码,他的这个函数在#ifndef RBDL_USE_CASADI_MATH中。看看是不是编译选项不对

mariolew commented 2 years ago

编译v2.6.1版本即可,最新版rbdl确实没CalcZeroMomentPoint这个的python接口

xinzi2018 commented 2 years ago

有2.6.1版本文件的下载入口么? 我只找到3.2.0版本的

xinzi2018 commented 2 years ago

https://github.com/rbdl/rbdl/releases/tag/v2.6.1 找到了~

NoLoPhe commented 2 years ago

Hello everyone! I'm very interested in this issue. Let's discuss it together.

TowoC commented 2 years ago

Hi all, I have helped to pull the request of adding the function CalcZeroMomentPoint in rbdl. The owner has merge the request into master. You can clone this version of rbdl and using CalcZeroMomentPoint directly.

NoLoPhe commented 1 year ago

Hi @Jaceyxy!

I solved the problem of instal RBDL in Windows, you can see here

Jaceyxy commented 1 year ago

@NoLoPhe thank you very much,However, I encountered some problems, as shown in the picture below image I don't know how to solve the problem. Thank you again

NoLoPhe commented 1 year ago

Hi @Jaceyxy

I am installing Miniconda to reproduce this error. Please wait!

NoLoPhe commented 1 year ago

I tested with Miniconda3 and no problem

image

NoLoPhe commented 1 year ago

This is a log.txt file that includes the install commands and pip list. log_PIP_conda.txt

Jaceyxy commented 1 year ago

@NoLoPhe hello,I am currently using the GPU version of Pythorch and the effect is as follows, image but when the action ends, there will be the following message, I don't know if this is normal. log.txt No file is generated in the result\DIP_IMU\PIP folder

NoLoPhe commented 1 year ago

Hi @Jaceyxy

I don't have the same problem as you, make an environment like mine: same library (pip list), switch GPU->CPU. I can't debug without the same environment.

image

NoLoPhe commented 1 year ago

If you just generate in the result\DIP_IMU\PIP. Next time run, please skip simulation.

Jaceyxy commented 1 year ago

@NoLoPhe hi,I redeployed the environment as you ordered, but the problem was not solved.

log.txt

Xinyu-Yi commented 1 year ago

@NoLoPhe thank you very much,However, I encountered some problems, as shown in the picture below image I don't know how to solve the problem. Thank you again

@NoLoPhe Thanks a lot for your help. @Jaceyxy Your problem is that the QP solver finds that there's not enough constraints to solve the accelerations and torques. Did you modify dynamics.py e.g. disable some energy terms? If not, please print the shape of P q A b G h at the time when this error occurs

Jaceyxy commented 1 year ago

我使用了原始的dynamics.py shape打印如下 十分感谢 ============ Evaluating "PIP" on "DIP_IMU" ============ Cached ids: [] Missing ids: [0, 1, 2, 3, 4] Loading imu data from "data/dataset_work/DIP_IMU" Saving the results at "data/result\DIPIMU\PIP" 0%| | 0/5 [00:00<?, ?it/s] P.shape (162, 162) q.shape (162,) G.shape (28, 162) h.shape (28,) A.shape (75, 162) b_.shape (75,) 0%| | 0/5 [00:13<?, ?it/s] Traceback (most recent call last): File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 2065, in coneqp try: f = kktsolver(W) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 1981, in kktsolver return factor(W, P) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\misc.py", line 1472, in factor lapack.potrf(F['K']) ArithmeticError: 12

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\MoveDesktop\pip_rbdl\PIP\evaluate.py", line 209, in evaluate(net, paths.dipimu_dir, pose_evaluator=reduced_pose_evaluator, evaluate_pose=True, evaluate_zmp=True, flush_cache=False) File "d:\MoveDesktop\pip_rbdl\PIP\evaluate.py", line 143, in evaluate run_pipeline(net, data_dir, missing_ids) File "d:\MoveDesktop\pip_rbdl\PIP\evaluate.py", line 119, in run_pipeline torch.save(net.predict(accs[i], rots[i], init_poses[i]), os.path.join(output_dir, '%d.pt' % i)) File "D:\miniconda3\envs\PIP\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context return func(args, kwargs) File "d:\MoveDesktop\pip_rbdl\PIP\net.py", line 97, in predict p, t = self.dynamics_optimizer.optimize_frame(p, v, c, a) File "d:\MoveDesktop\pip_rbdl\PIP\dynamics.py", line 239, in optimize_frame x = solveqp(P, q, G, h, A, b_, solver='cvxopt', initvals=init) File "D:\miniconda3\envs\PIP\lib\site-packages\qpsolvers\solve_qp.py", line 132, in solve_qp return solve_function[solver](P, q, G, h, A, b, kwargs) File "D:\miniconda3\envs\PIP\lib\site-packages\qpsolvers\solvers\cvxopt_.py", line 125, in cvxopt_solve_qp sol = qp(args, solver=solver, initvals=initvals, **kwargs) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 4485, in qp return coneqp(P, q, G, h, None, A, b, initvals, kktsolver = kktsolver, options = options) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 2067, in coneqp raise ValueError("Rank(A) < p or Rank([P; A; G]) < n") ValueError: Rank(A) < p or Rank([P; A; G]) < n numActiveThreads = 0 stopping threads Thread with taskId 0 with handle 0000000000000A9C exiting Thread TERMINATED finished numActiveThreads = 0 btShutDownExampleBrowser stopping threads Thread with taskId 0 with handle 00000000000006A4 exiting Thread TERMINATED

Xinyu-Yi commented 1 year ago

please print P[:75, :75], P[-75:, -75:], P[75:-75, 75:-75]

Jaceyxy commented 1 year ago

P_[:75, :75] [[ 2.00000000e+01 0.00000000e+00 0.00000000e+00 ... 3.64291930e-17 -6.93889390e-17 -1.97758476e-16] [ 0.00000000e+00 2.00000000e+01 0.00000000e+00 ... -5.29090660e-17 -5.63785130e-18 -1.04083409e-17] [ 0.00000000e+00 0.00000000e+00 2.00000000e+01 ... -3.33066907e-16 -2.77555756e-17 -1.66533454e-16] ... [ 3.64291930e-17 -5.29090660e-17 -3.33066907e-16 ... 1.00000000e+00 7.01497413e-33 4.88132963e-32] [-6.93889390e-17 -5.63785130e-18 -2.77555756e-17 ... 7.01497413e-33 1.00000000e+00 1.84031634e-32] [-1.97758476e-16 -1.04083409e-17 -1.66533454e-16 ... 4.88132963e-32 1.84031634e-32 1.00000000e+00]] P_[-75:, -75:] [[9.99999881e-03 0.00000000e+00 0.00000000e+00 ... 0.00000000e+00 0.00000000e+00 0.00000000e+00] [0.00000000e+00 9.99999881e-03 0.00000000e+00 ... 0.00000000e+00 0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00 9.99999881e-03 ... 0.00000000e+00 0.00000000e+00 0.00000000e+00] ... [0.00000000e+00 0.00000000e+00 0.00000000e+00 ... 9.99999955e-05 0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00 0.00000000e+00 ... 0.00000000e+00 9.99999955e-05 0.00000000e+00] [0.00000000e+00 0.00000000e+00 0.00000000e+00 ... 0.00000000e+00 0.00000000e+00 9.99999955e-05]] P_[75:-75, 75:-75] [[0.00560136 0. 0. 0. 0. 0.

            1. ] [0. 0.00560136 0. 0. 0. 0.
            1. ] [0. 0. 0.00560136 0. 0. 0.
            1. ] [0. 0. 0. 0.00560136 0. 0.
            1. ] [0. 0. 0. 0. 0.00560136 0.
            1. ] [0. 0. 0. 0. 0. 0.00560136
            1. ] [0. 0. 0. 0. 0. 0. 0.00560136 0. 0. 0. 0. 0. ] [0. 0. 0. 0. 0. 0.
  1. 0.00560136 0. 0. 0. 0. ] [0. 0. 0. 0. 0. 0.
    1. 0.00560136 0. 0. 0. ] [0. 0. 0. 0. 0. 0.
      1. 0.00560136 0. 0. ] [0. 0. 0. 0. 0. 0.
        1. 0.00560136 0. ] [0. 0. 0. 0. 0. 0.
          1. 0.00560136]]
Xinyu-Yi commented 1 year ago

sorry, i can not find where the problem is. i did not encounter this problem

YeeLou commented 8 months ago

我使用了原始的dynamics.py shape打印如下 十分感谢 ============ Evaluating "PIP" on "DIP_IMU" ============ Cached ids: [] Missing ids: [0, 1, 2, 3, 4] Loading imu data from "data/dataset_work/DIP_IMU" Saving the results at "data/result\DIPIMU\PIP" 0%| | 0/5 [00:00<?, ?it/s] P.shape (162, 162) q.shape (162,) G.shape (28, 162) h.shape (28,) A.shape (75, 162) b_.shape (75,) 0%| | 0/5 [00:13<?, ?it/s] Traceback (most recent call last): File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 2065, in coneqp try: f = kktsolver(W) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 1981, in kktsolver return factor(W, P) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\misc.py", line 1472, in factor lapack.potrf(F['K']) ArithmeticError: 12

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\MoveDesktop\pip_rbdl\PIP\evaluate.py", line 209, in evaluate(net, paths.dipimu_dir, pose_evaluator=reduced_pose_evaluator, evaluate_pose=True, evaluate_zmp=True, flush_cache=False) File "d:\MoveDesktop\pip_rbdl\PIP\evaluate.py", line 143, in evaluate run_pipeline(net, data_dir, missing_ids) File "d:\MoveDesktop\pip_rbdl\PIP\evaluate.py", line 119, in run_pipeline torch.save(net.predict(accs[i], rots[i], init_poses[i]), os.path.join(output_dir, '%d.pt' % i)) File "D:\miniconda3\envs\PIP\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context return func(args, kwargs) File "d:\MoveDesktop\pip_rbdl\PIP\net.py", line 97, in predict p, t = self.dynamics_optimizer.optimize_frame(p, v, c, a) File "d:\MoveDesktop\pip_rbdl\PIP\dynamics.py", line 239, in optimize_frame x = solveqp(P, q, G, h, A, b_, solver='cvxopt', initvals=init) File "D:\miniconda3\envs\PIP\lib\site-packages\qpsolvers\solve_qp.py", line 132, in solve_qp return solve_function[solver](P, q, G, h, A, b, kwargs) File "D:\miniconda3\envs\PIP\lib\site-packages\qpsolvers\solvers\cvxopt_.py", line 125, in cvxopt_solve_qp sol = qp(args, solver=solver, initvals=initvals, **kwargs) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 4485, in qp return coneqp(P, q, G, h, None, A, b, initvals, kktsolver = kktsolver, options = options) File "D:\miniconda3\envs\PIP\lib\site-packages\cvxopt\coneprog.py", line 2067, in coneqp raise ValueError("Rank(A) < p or Rank([P; A; G]) < n") ValueError: Rank(A) < p or Rank([P; A; G]) < n numActiveThreads = 0 stopping threads Thread with taskId 0 with handle 0000000000000A9C exiting Thread TERMINATED finished numActiveThreads = 0 btShutDownExampleBrowser stopping threads Thread with taskId 0 with handle 00000000000006A4 exiting Thread TERMINATED

Hello, I also met the same problem in the evaluation. Have you solved it? I would appreciate any help.

Xinyu-Yi commented 8 months ago

Hi, I have a naive solution for this problem now. Please use try{} catch{} for the code solve_qp(P_, q_, G_, h_, A_, b_, solver='cvxopt', initvals=init), and when this exception occurs, run solve_qp(P_, q_, None, None, A_, b_, solver='quadprog', initvals=init) instead.

By doing this, you can remove the constraints that make QP infeasible.

Xinyu-Yi commented 8 months ago

for example, you can change the codes to:

        init = self.last_x if False and len(self.last_x) == len(q_) else None
        x = solve_qp(P_, q_, G_, h_, A_, b_, solver='quadprog', initvals=init)

        # if x is None or np.linalg.norm(x) > 10000:
        #     x = solve_qp(P_, q_, G_, h_, A_, b_, solver='cvxopt', initvals=init)

        if x is None or np.linalg.norm(x) > 10000:
            if not self.quiet: print('Warning: QP infeasible. Ignoring Gx <= h constraints')
            x = solve_qp(P_, q_, None, None, A_, b_, solver='quadprog', initvals=init)

        qddot = x[:self.model.qdot_size]
        GRF = x[self.model.qdot_size:-self.model.qdot_size]
        tau = x[-self.model.qdot_size:]
whl-007 commented 5 months ago

https://github.com/rbdl/rbdl/releases/tag/v2.6.1 找到了~

https://github.com/rbdl/rbdl/releases/tag/v2.6.1 找到了~

I have encountered the problem 'module 'rbdl' has no attribute 'loadModel'. Have you solved this issue? If you could help me solve this problem, I would be greatly appreciated.

whl-007 commented 5 months ago

@Jaceyxy linux

I have encountered the problem 'module 'rbdl' has no attribute 'loadModel'. Have you solved this issue? If you could help me solve this problem, I would be greatly appreciated.

whl-007 commented 5 months ago

我在linux环境下安装也出现了 module 'rbdl' has no attribute 'CalcZeroMomentPoint' 这个问题。但是在安装包/home/***/tools/rbdl/src/rbdl_utils.cc中有看到对应的文件,不知道为啥检索不到 I have encountered the problem 'module 'rbdl' has no attribute 'loadModel'. Have you solved this issue? If you could help me solve this problem, I would be greatly appreciated.

whl-007 commented 4 months ago

AttributeError: module 'rbdl' has no attribute 'CalcZeroMomentPoint' 提示这个错误是什么意思呢 rbdl已经编译安装好了 他就是没这个接口

您好,我在linux环境中conda的site-packages下编译安装好rbdl了,我import rbdl可以执行,但是会报错'module 'rbdl' has no attribute 'loadModel'.您遇到过这个问题吗?如果可以的话您可以让我看看您编译好后的rbdl包的目录嘛

Xinyu-Yi commented 4 months ago

rbdl需要版本2.6.0,编译的时候要开python binding,lua addon什么的,之后应该就会有