# TORA: Invalid number in NLP function or derivative detected

**URL:** <https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511>\
**Category:** Optimization (Mathematical)\
**Created:** [May 4, 2022, 9:13pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511 "2022-05-04T21:13:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hedonismbot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hedonismbot/32/35964_2.png) [@hedonismbot](https://discourse.julialang.org/u/hedonismbot)\
**Post date:** [May 4, 2022, 9:13pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/1 "2022-05-04T21:13:34Z")

</div>

On a custom URDF file ([fanuc.urdf · GitHub](https://gist.github.com/andreas-botbuilt/1998505abc0c382e078723343c183b9d)), the tutorial for `tora.jl` ([Tutorial · TORA.jl](https://juliarobotics.org/TORA.jl/dev/tutorial/)) always fails with this error:

> EXIT: Invalid number in NLP function or derivative detected.  
> (6.328051371, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], SolverLog(Matrix{Float64}(undef, 5412, 0), Float64, Float64, Float64, Float64, Float64, -999))

This even happens for unconstrained optimization problems and simple constraints, like the end effector being constrained at a few knots to be close to its current location (via `TORA.constrain_ee_position!`).

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 4, 2022, 9:27pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/2 "2022-05-04T21:27:48Z")

</div>

Hi there,

The `Invalid number in NLP function or derivative detected` means that Ipopt tried to evaluate something like `log(0)` or `1 / 0`.

But since TORA is constructing the problem, I’m not sure what the next step should be. Does your custom file lead to some singularity where there isn’t a feasible solution? You could try changing the initial starting point.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 4, 2022, 9:28pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/3 "2022-05-04T21:28:55Z")

</div>

Tagging @ferrolho since they might know more.

---

<div class="post-metadata">

**Author:** ![hedonismbot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hedonismbot/32/35964_2.png) [@hedonismbot](https://discourse.julialang.org/u/hedonismbot)\
**Post date:** [May 5, 2022, 3:20pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/4 "2022-05-05T15:20:20Z")

</div>

Thanks for your suggestions! I have tried a bunch of different initial starting points with the same result.

I have also tried to reduce the robot down to two joints ([https://gist.github.com/andreas-botbuilt/bccac78b2bb7f6ea19f77094c2475412](https://gist.github.com/andreas-botbuilt/bccac78b2bb7f6ea19f77094c2475412)) and reduce the number of knots in the problem. This gives the same result.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 5, 2022, 7:37pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/5 "2022-05-05T19:37:39Z")

</div>

Maybe open an issue at TORA.jl. I haven’t used the package so not much help, unfortunately.

---

<div class="post-metadata">

**Author:** ![ferrolho](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ferrolho/32/213665_2.png) [@ferrolho](https://discourse.julialang.org/u/ferrolho)\
**Post date:** [May 6, 2022, 9:40am UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/6 "2022-05-06T09:40:39Z")

</div>

Hi @hedonismbot and @odow,

Thank you for trying out TORA.jl, @hedonismbot!

TORA.jl is a library for planning robot motion that takes into account the full-order system dynamics. I.e., it is not a kinematic motion planner, and instead considers the mass/inertia parameters of every link throughout the kinematic chain of a robot.

Your custom URDF file does not seem to have any of these dynamic quantities for each of your robot’s links.

EDIT: Having said that, I am definitely the one to blame for not having implemented a method to check whether the URDF being loaded has all the dynamics quantities required by the package, and then logging a more user-friendly message explaining the problem. Can you please open an issue on GitHub for this?

---

<div class="post-metadata">

**Author:** ![hedonismbot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hedonismbot/32/35964_2.png) [@hedonismbot](https://discourse.julialang.org/u/hedonismbot)\
**Post date:** [May 6, 2022, 1:45pm UTC](https://discourse.julialang.org/t/tora-invalid-number-in-nlp-function-or-derivative-detected/80511/7 "2022-05-06T13:45:14Z")

</div>

That makes sense. Here’s the [GitHub issue](https://github.com/JuliaRobotics/TORA.jl/issues/3).
