Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultyBody with FixedJoint causes a panic when only one part is attached to it #208

Open
Kritzefitz opened this issue Jun 29, 2019 · 0 comments

Comments

@Kritzefitz
Copy link

The following program panics with the message below:

let mut world = World::new();

let shape = ShapeHandle::new(Cuboid::new(Vector3::repeat(0.5)));
let collider = ColliderDesc::new(shape)
    .density(1.0);

let top_joint = FixedJoint::new(Isometry3::identity());
let mut body_desc = MultibodyDesc::new(top_joint)
    .collider(&collider)
    .parent_shift(Vector3::repeat(1.0));

/*let sub_joint = PrismaticJoint::new(Vector3::x_axis(), 0.0);
body_desc.add_child(sub_joint)
    .set_parent_shift(Vector3::repeat(1.0))
    .add_collider(&collider);*/

body_desc.build(&mut world);

Testbed::new(world).run()
thread 'main' panicked at 'Matrix slicing out of bounds.', /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.18.0/src/base/matrix_slice.rs:227:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
             at /usr/src/rustc-1.34.2/src/libstd/panicking.rs:412
   6: nalgebra::base::matrix_slice::<impl nalgebra::base::matrix::Matrix<N, R, C, S>>::assert_slice_index
             at ./<::std::macros::panic macros>:3
   7: nalgebra::base::matrix_slice::<impl nalgebra::base::matrix::Matrix<N, R, C, S>>::columns_generic
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.18.0/src/base/matrix_slice.rs:410
   8: nalgebra::base::matrix_slice::<impl nalgebra::base::matrix::Matrix<N, R, C, S>>::fixed_columns
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.18.0/src/base/matrix_slice.rs:391
   9: nalgebra::base::matrix_slice::<impl nalgebra::base::matrix::Matrix<N, R, C, S>>::column
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.18.0/src/base/matrix_slice.rs:360
  10: nalgebra::base::blas::<impl nalgebra::base::matrix::Matrix<N, D1, D1, S>>::quadform_with_workspace
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.18.0/src/base/blas.rs:1487
  11: nalgebra::base::blas::<impl nalgebra::base::matrix::Matrix<N, D1, D1, S>>::quadform
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.18.0/src/base/blas.rs:1532
  12: <nphysics3d::object::multibody::Multibody<N>>::update_inertias
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nphysics3d-0.11.1/src/object/multibody.rs:465
  13: <nphysics3d::object::multibody::Multibody<N>>::update_dynamics
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nphysics3d-0.11.1/src/object/multibody.rs:381
  14: <nphysics3d::object::multibody::Multibody<N> as nphysics3d::object::body::Body<N>>::update_dynamics
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nphysics3d-0.11.1/src/object/multibody.rs:841
  15: <nphysics3d::world::world::World<N>>::step
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nphysics3d-0.11.1/src/world/world.rs:238
  16: <nphysics_testbed3d::testbed::Testbed as kiss3d::window::state::State>::step
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nphysics_testbed3d-0.5.0/src/testbed.rs:552
  17: kiss3d::window::window::Window::do_render_with_state
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.19.0/src/window/window.rs:597
  18: kiss3d::window::window::Window::render_loop::{{closure}}
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.19.0/src/window/window.rs:581
  19: <kiss3d::window::gl_canvas::GLCanvas as kiss3d::window::canvas::AbstractCanvas>::render_loop
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.19.0/src/window/gl_canvas.rs:67
  20: kiss3d::window::canvas::Canvas::render_loop
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.19.0/src/window/canvas.rs:31
  21: kiss3d::window::window::Window::render_loop
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.19.0/src/window/window.rs:581
  22: nphysics_testbed3d::testbed::Testbed::run
             at /home/sven/.cargo/registry/src/github.com-1ecc6299db9ec823/nphysics_testbed3d-0.5.0/src/testbed.rs:243
  23: reproduce::main
             at src/reproduce.rs:27
  24: std::rt::lang_start::{{closure}}
             at /usr/src/rustc-1.34.2/src/libstd/rt.rs:64
  25: std::panicking::try::do_call
  26: __rust_maybe_catch_panic
  27: std::rt::lang_start_internal
  28: std::rt::lang_start
             at /usr/src/rustc-1.34.2/src/libstd/rt.rs:64
  29: main
  30: __libc_start_main
  31: _start

When I comment in the part that adds the sub part on a PrismaticJoint the panic goes away. I guess having a FixedJoint with only one part below it isn't really useful, as it could also be achieved by mounting a RigidBody to the ground, but I think at least the panic should give a proper message about the problem, as this is quite hard to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant