But, when I drop it to the ground it starts behaving super weird, glitching and twitching and rolling back and forth:
https://user-images.githubusercontent.com/634877/210060212-96a725d8-5b99-49db-b7b1-1ff7ea4c2012.mp4
(Sorry for shakiness from filming screen, hopefully the glitches are obvious... And this is after reducing the weight of things drastically - at higher weights it was really nuts!)
Now, my main question here is to check that I am not totally on a wrong track with this? It seems logical to be able to use revolute joints like this. But even without steering, just four wheels, if I set ridiculous amount for max_motor_force and set_motor_velocity to zero this thing will still creep slowly and randomly back and forth.... That to me seems like I have some major misunderstanding what revolute joints can be used for? Are they only for "show" and can't handle contact with ground?
Then I also have a minor separate question - how am I to retrieve a joint so I can set speed for it during the update loop, given a MultibodyJointHandle? I came up with this code:
let motor = self
.multibody_joint_set
.get_mut(self.wheel_front_left_motor)
.unwrap();
let joint = &mut motor.0.link_mut(3).unwrap().joint;
joint
.data
.as_revolute_mut()
.unwrap()
.set_motor_position(steering_angle, 500.0, 50.0);
The call there to link_mut(3)... that surely is not correct 😅
I am trying to create a vehicle and my approach is to use a
RigidBody
for each of:RigidBody
which is used for steeringI then set up revolute joints for the wheels and the steering. When I apply steering using
set_motor_position
and throttle/brake usingset_motor_velicity
I get the expected result if I let things hover in the air with no ground contact: https://user-images.githubusercontent.com/634877/210060114-e120e304-5c10-478d-8323-8b1f28a0a2fe.mp4But, when I drop it to the ground it starts behaving super weird, glitching and twitching and rolling back and forth: https://user-images.githubusercontent.com/634877/210060212-96a725d8-5b99-49db-b7b1-1ff7ea4c2012.mp4 (Sorry for shakiness from filming screen, hopefully the glitches are obvious... And this is after reducing the weight of things drastically - at higher weights it was really nuts!)
Now, my main question here is to check that I am not totally on a wrong track with this? It seems logical to be able to use revolute joints like this. But even without steering, just four wheels, if I set ridiculous amount for
max_motor_force
andset_motor_velocity
to zero this thing will still creep slowly and randomly back and forth.... That to me seems like I have some major misunderstanding what revolute joints can be used for? Are they only for "show" and can't handle contact with ground?Then I also have a minor separate question - how am I to retrieve a joint so I can set speed for it during the update loop, given a
MultibodyJointHandle
? I came up with this code:The call there to
link_mut(3)
... that surely is not correct 😅