Skip to content

Add passive joint moments #31

Description

@tvdbogert

@moorepants I have coded this in the branch "add-passive-joint-moments". It seemed quite straightforward. Any feedback is welcome!

The code still works without passive moments, but code generation crashes when I turn them on:

(gait2d-dev) C:\Users\Ton\Documents\GitHub\gait2d>python examples/plot_forward_sim.py
loading modules...
deriving equations of motion...
Traceback (most recent call last):
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\ode_function_generators.py", line 907, in generate_ode_function
    g = generator(*args, **kwargs)
TypeError: 'str' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\cython_code.py", line 222, in compile
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\subprocess.py", line 473, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\subprocess.py", line 578, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\Users\\Ton\\anaconda3\\envs\\gait2d-dev\\python.exe', 'pydy_codegen_0_setup.py', 'build_ext', '--inplace']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Ton\Documents\GitHub\gait2d\examples\plot_forward_sim.py", line 46, in <module>
    rhs = generate_ode_function(
        symbolics.kanes_method.forcing,
    ...<9 lines>...
        specifieds_arg_type='array',
    )
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\ode_function_generators.py", line 917, in generate_ode_function
    return g.generate()
           ~~~~~~~~~~^^
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\ode_function_generators.py", line 624, in generate
    self.generate_min_mass_matrix_function()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\ode_function_generators.py", line 714, in generate_min_mass_matrix_function
    self._set_eval_array(self._cythonize_symbolic_lusolve(outputs,
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
                                                          self.inputs))
                                                          ^^^^^^^^^^^^
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\ode_function_generators.py", line 666, in _cythonize_symbolic_lusolve
    return g.compile(tmp_dir=self._options['tmp_dir'],
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     verbose=self._options['verbose'])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ton\anaconda3\envs\gait2d-dev\Lib\site-packages\pydy\codegen\cython_code.py", line 227, in compile
    raise Exception('Failed to compile and import Cython module.')
Exception: Failed to compile and import Cython module.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions