Jump to content

Rotating and Steering Wheels with JointSuspension


Recommended Posts

Hi,

 

I'm trying to implement a car model, and have attached 4 wheels to a box using JointSuspension. The documentation refers to an attached motor, and has certain related parameters. Is there a specific "motor" object I should be adding, or does that simply refer to adding torque to the wheel's rigid body? Is it good practice to rotate the wheel by adding torque to the wheels in their local pitch axes, and steer by adding torque in yaw axes straight out?

 

I also couldn't manage to steer, the wheels resist to any sort of rotation in their z-axes. I can see from the visuals in JointSuspension document that a JointSuspension comprises of a PRISMATIC and a rotating joint. I intuitively assume that a prismatic joint is not allowed to rotate, which leaves me wondering how exactly I am supposed to steer the vehicle.

 

Thanks in advance. 

 

Cem

 

Edit: This might be unrelated, but I also think there is a mistake in the description of JointSuspension::setAxis11 method. It claims it is the suspension axis, but it actually modifies the axis around which the wheel rotates (wheel axis). Either I percieve the expression "suspension axis" wrong, or the information itself is wrong. 

Link to comment
Hello,
To use the motion: 
joint.setAngularTorque(torque);
joint.setAngularVelocity(velocity); 
 
To change the steering angle, use: 
joint.setAxis10 (rotateZ (steer_angle) * vec3 (0.0f, 1.0f, 0.0f));

Constructor creates a suspension joint connecting two given bodies using a given anchor and axes.

 

Body body0 - The wheel to connect with the joint.

Body body1 - The frame to connect with the joint.
vec3 anchor - Anchor of the joint.

vec3 axis0 - Wheel axis.

vec3 axis1 - Suspension axis.
 
JointSuspension (body0, body1, anchor, axis0, axis1)
 
setWorldAxis1 (vec3 axis) Sets a suspension axis in the world coordinates.
Link to comment

Thanks for the reply alterego. I have seen the method setAngularTorque in the examples, but somehow couldn't utilize it before. Now -although still a little faulty- it does seem to work. When I use setAngularTorque, it does not work, but when I add in setAngularVelocity, it works according to torque data I have previously entered. Does setAngularVelocity sort of define an upper limit of angular velocity, or does it simply create a kinematic motion regardless of the torque applied? 

 

That is:

 

for(int i = 0; i < 4; i++)
{
wheel_joint[i].setAngularTorque(throttleVal);
wheel_joint[i].setAngularVelocity(10.0f);
}
 
works fine when I push up the throttle. But:
 

for(int i = 0; i < 4; i++)
{
wheel_joint[i].setAngularTorque(throttleVal);
}
 
gives no response whatsoever. My guess here is setAngularVelocity defines the limit value for velocity, and not defining it sets it to 0, thus restricting the rotation. Am I mistaken in that? And with all due respect, i think terms "Sets a maximum torque of the attached angular motor." and "Sets a target velocity of wheel rotation." are a little ambiguous in the documentation, some further explanation might be useful. 
 
Thanks. 
Link to comment
×
×
  • Create New...