Xinyu-Yi/PIP

rbdl安装

Opened this issue · 34 comments

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

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

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

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

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

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

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

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

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

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

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

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

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

TowoC commented

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.

Hi @Jaceyxy!

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

@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

Hi @Jaceyxy

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

I tested with Miniconda3 and no problem

image

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

@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

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

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

  • In Line ~44 in net.py: set debug=False
self.dynamics_optimizer = PhysicsOptimizer(debug=False)
  • evaluate.py: set flush_cache=False in evaluate()

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

log.txt

@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

我使用了原始的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\DIP_IMU\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 = solve_qp(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

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

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.
0. 0. 0. 0. 0. 0. ]
[0. 0.00560136 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. ]
[0. 0. 0.00560136 0. 0. 0.
0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0.00560136 0. 0.
0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0.00560136 0.
0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0.00560136
0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0.
0.00560136 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0.00560136 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. 0.00560136 0. 0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. 0. 0.00560136 0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0.00560136 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.00560136]]

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

我使用了原始的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\DIP_IMU\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 = solve_qp(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.

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.

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:]

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.

@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.

我在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.

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

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

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