OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to include a modulus operation in CasADi function

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Guest
I can't find a modulus function in CasADi. I want to build a function with something like this:

Code:
from casadi import MX

angle = MX.sym('angle')

wrapped_angle = ((angle + 180) % 360) - 180

Code:
TypeError: unsupported operand type(s) for %: 'MX' and 'int'

There doesn't appear to be a mod or divmod function as far as I can see.

Maybe it's not implemented for a reason, but if so I would like to know that.
<p>I can't find a modulus function in CasADi. I want to build a function with something like this:</p>
<pre class="lang-python prettyprint-override"><code>from casadi import MX

angle = MX.sym('angle')

wrapped_angle = ((angle + 180) % 360) - 180
</code></pre>
<pre class="lang-none prettyprint-override"><code>TypeError: unsupported operand type(s) for %: 'MX' and 'int'
</code></pre>
<p>There doesn't appear to be a <code>mod</code> or <code>divmod</code> function as far as I can see.</p>
<p>Maybe it's not implemented for a reason, but if so I would like to know that.</p>
 
Top