Exemple #1
0
        private void WriteMessage()
        {
            message.header.Update();

            Vector3 eulers = c.transform.rotation.eulerAngles;

            eulers += new Vector3(SimUtils.getRandNormal(0, orientationNoiseStdDev), SimUtils.getRandNormal(0, orientationNoiseStdDev), SimUtils.getRandNormal(0, orientationNoiseStdDev));
            Quaternion orientation = Quaternion.Euler(eulers.x, -eulers.z, -eulers.y);

            message.orientation.w = orientation.w;
            message.orientation.x = orientation.x;
            message.orientation.y = orientation.y;
            message.orientation.z = orientation.z;

            Vector3 accel = c.transform.worldToLocalMatrix * c.accel; // sick maths

            message.linear_acceleration.x = accel.x + SimUtils.getRandNormal(0, accelNoiseStdDev);
            message.linear_acceleration.y = accel.z + SimUtils.getRandNormal(0, accelNoiseStdDev);
            message.linear_acceleration.z = accel.y + SimUtils.getRandNormal(0, accelNoiseStdDev);

            message.angular_velocity.x = c.angular_vel.x + SimUtils.getRandNormal(0, angularVelocityNoiseStdDev);
            message.angular_velocity.y = -c.angular_vel.z + SimUtils.getRandNormal(0, angularVelocityNoiseStdDev);
            message.angular_velocity.z = -c.angular_vel.y + SimUtils.getRandNormal(0, angularVelocityNoiseStdDev);

            Publish(message);
        }
        private void WriteMessage()
        {
            Vector3 pos = this.transform.position;

            message.latitude  = (pos.x + SimUtils.getRandNormal(0, latNoiseStdDev)) / 110944.33 + lat0Pos;
            message.longitude = (pos.z + SimUtils.getRandNormal(0, lonNoiseStdDev)) / 91058.93 + lon0Pos;
            Publish(message);
        }
Exemple #3
0
        private void FixedUpdate()
        {
            if (newMessage)
            {
                car.SetControl(lastMessage.speed + SimUtils.getRandNormal(0, powerNoiseStdDev), lastMessage.turn_angle + SimUtils.getRandNormal(0, angleNoiseStdDev));
                newMessage = false;
            }

            if (begingame)
            {
                begingame = false;
                GameManager.instance.StartSim();
            }

            if (firstMessage && !begingame && Time.realtimeSinceStartup - startTime >= 30)
            {
                GameManager.instance.StopSim("Did not start in 30 seconds!");
            }
        }
 private void WriteMessage()
 {
     message.latitude  = Mathf.Round((c.linear_vel.x + SimUtils.getRandNormal(0, velocityNoiseStdDev) * c.Power / 4.0f) * 1000f) / 1000f;
     message.longitude = Mathf.Round((c.linear_vel.z + SimUtils.getRandNormal(0, velocityNoiseStdDev) * c.Power / 4.0f) * 1000f) / 1000f;
     Publish(message);
 }
Exemple #5
0
 private void WriteMessage()
 {
     message.data = Mathf.Round((c.Power + SimUtils.getRandNormal(0, velocityNoiseStdDev) * c.Power / 4.0f) * 1000f) / 1000f;
     Publish(message);
 }