NameError: name 'projector_constraint' is not defined
Closed this issue · 4 comments
Thanks for your brilliant contribution!!
I have encountered this problem when I'm trying to run notebooks/motion_planning_sampling/panda.ipynb.
is_collide = True
while is_collide is True:
q = rob_simple_sampler.sample().flatten()
res = projector_constraint.project(q)
q, success, func_calls = res['q'], res['stat'], res['nfev']
#print(projector_constraint.project(q))
is_collide = rob_col_checker.check_collision(q)
set_q_std(q.flatten())
NameError Traceback (most recent call last)
<ipython-input-40-dc57b1fb1684> in <module>
3 while is_collide is True:
4 q = rob_simple_sampler.sample().flatten()
----> 5 res = projector_constraint.project(q)
6 q, success, func_calls = res['q'], res['stat'], res['nfev']
7 #print(projector_constraint.project(q))
NameError: name 'projector_constraint' is not defined
My environment: ubuntu18.04, numpy1.19.03, pinocchio2.6.0, pybullet3.1.3, tensorflow2.4.1, and I have installed everything according to the Installation Procedure.
It seems like the ·'projector_constraint' class cannot be found.
Hi @ChenEating716 , thanks!
The instance 'projector_constraint' used to be defined for previous version of projection operators, but it has been removed from the code. The same with robot_ik_solver0, sorry for this. You can replace them by 'robot_ik_solver' instead.
I have pushed an update to panda.ipynb, this should remove the problem you are facing.
Thanks for your update!! The new code removes the problem I'm facing!
It seems like "standard_rrt.extend_nfevs" also comes from the previous version.
if success:
T1 += [t]
P1 += [proj_iter]
E1 += [ext_steps]
S1 += 0
R1 += [n_retry]
E_F1 += [standard_rrt.extend_nfevs]
I don't know if I did it right, I replaced "standard_rrt.extend_nfevs" with "standard_rrt.step_plan()[1]".
Then another problem arises as followed:
ValueError Traceback (most recent call last)
<ipython-input-54-a32799bf8a51> in <module>
----> 1 a1 = np.concatenate(E_F1)
2 a2 = np.concatenate(E_F2)
3 a3 = np.concatenate(E_F3)
4 print(np.mean(a1), np.std(a1))
5 print(np.mean(a2), np.std(a2))
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: zero-dimensional arrays cannot be concatenated
Hi @ChenEating716 , you're welcome.
extend_nfevs should be available, it's added every time an extend function is called in the RRT:
extend
This is only necessary for my analysis, though (I want to know how many cost function calls are called for each extend function call), but not necessary for the RRT task itself so you can ignore this.
ValueError: zero-dimensional arrays cannot be concatenated
This error is because you are trying to concatenate a list of floats(e.g. [0., 3., 2.]), instead of a list of arrays or lists (e.g. [array([0.]), array([1.]), array([3.])]. You can remove this error by writing
E_F1 += [[standard_rrt.step_plan()[1]]]
instead (adding a list bracket) . But this value is not what you want. step_plan([1]) is the number of function when you do 1 step at RRT.
Hi @teguhSL , thanks for your guidance!! It helps a lot!!!
"extend_nfevs" is available. Sorry for that incorrect comment, it was my mistake before.