# Simulating suspension in rear wheel drive vehicle when turning

Hi all,

I'm trying to simulate an ackerman driven medium vehicle including suspension. For the most part the simulation works, however when turning, I have a problem with one of the rear wheels occaisionally sending what seems to be a large impulse force up through the suspension. this force is large enough to not only move the wheel but also bounce the entire vehicle back end, such that it cause it to change direction. My SDF parameters for the rear wheels are (same for all four wheels):

<link name="left_rear_wheel">
<collision name="left_rear_collision">
<!--origin xyz="0.1 -0.13 0.1" rpy="0 1.5707 1.5707" /-->
<origin xyz="0 0 0" rpy="0 1.5707 1.5707" />
<geometry>
</geometry>
</collision>
<gazebo reference ="left_rear_wheel">
<kp>1e+9</kp>
<kd>5e+6</kd>
<mu>0.9</mu>
<mu2>0.9</mu2>
<slip1>1</slip1>
<slip2>1</slip2>
<fdir1>0 0 1</fdir1>
<material>Gazebo/Orange</material>
</gazebo>


The suspension is modelled in the plugin:

void updateSuspension()
{
double frontLeftForce = -frontLeftSuspension->GetAngle(0).Radian()*springConstant - frontLeftSuspension->GetVelocity(0)*dampingConstant;
frontLeftSuspension->SetForce(0, frontLeftForce);

double frontRightForce = -frontRightSuspension->GetAngle(0).Radian()*springConstant - frontRightSuspension->GetVelocity(0)*dampingConstant;
frontRightSuspension->SetForce(0, frontRightForce);

double rearLeftForce = -rearLeftSuspension->GetAngle(0).Radian()*springConstant - rearLeftSuspension->GetVelocity(0)*dampingConstant;
rearLeftSuspension->SetForce(0, rearLeftForce);

double rearRightForce = -rearRightSuspension->GetAngle(0).Radian()*springConstant - rearRightSuspension->GetVelocity(0)*dampingConstant;
rearRightSuspension->SetForce(0, rearRightForce);
}


And my rear wheel drive wheel drive torque is applied here, And in my plugin update I used some code from the drcsim vehicle to modify the cfm_stop attributes which I thought may be an issue.:

void updateRearWheelDrive(double speed)
{

double controlValue = speedController.ControlAlgorithm(speed, rightRear->GetVelocity(0), 100, 1000 ,0);

if(speed!= 0)
{
this->rightRear->SetAttribute("stop_cfm", 0, 1.0);
this->leftRear->SetAttribute("stop_cfm", 0, 1.0);
this->frontRightWheel->SetAttribute("stop_cfm", 0, 1.0);
this->frontLeftWheel->SetAttribute("stop_cfm", 0, 1.0);
}
else
{
this->rightRear->SetAttribute("stop_cfm", 0, 0.0);
this->leftRear->SetAttribute("stop_cfm", 0, 0.0);
this->frontRightWheel->SetAttribute("stop_cfm", 0, 0.0);
this->frontLeftWheel->SetAttribute("stop_cfm", 0, 0.0);
}

rightRear->SetForce(0, controlValue);
leftRear->SetForce(0, controlValue);
frontLeftWheel->SetForce(0, 0);
frontRightWheel->SetForce(0, 0);
}


I think the problem may be due to a collision force being generated by the ground plane and the inside rear wheel. This problem only seems to be apparent when turning and particularly so when driving forward. I am just wondering if there is some collision attribute for the wheels that may alleviate any built up forces on the tires that is causing this? I have played around with the slip value but it doesn't really seem to do much.

edit retag close merge delete

Sort by » oldest newest most voted

Removing the specification of <slip1> and <slip2> probably had no effect, but on the rear wheels only, reduction of <mu2> to a lower value of around 0.1 allowed the inside rear wheel to slide sideways as required. This reduced transient forces that seemed to be producing pressure upwards.

Additionally and possibly more importantly, the wheel's collision shape was modelled as a cylinder. as the rear suspension joints were free only one direction (z direction), when the body of the vehicle tilted during turning, this caused the wheels to tilt resulting in a collision with the edges of the cylinder which represented the wheel and the ground plane.

It was the reaction forces from these collisions that was causing the observed behaviour. Changing the shape of the wheel's collision geometry to a sphere stopped the collisions and the subsequent reaction forces

Finally, the number of contact of the wheels and where they were is important, as I also had a problem with the steering working intermittently at low speeds. This resulted in the front wheels sliding across the surface. Looking at the EV Ranger model, I noticed that the cylinders forming the wheels were slightly canted so that they ran on the inside edge of the cylinder modelling the wheel. This was done by specifiying the joint axis for the wheel to be <xyz 0="" 1="" 0.05=""/> for the left side and <xyz 0="" 1="" -0.05=""/> for the right. Implementing this in my own model improved low speed steering.

more