The following warnings occurred:
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 94 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "lockoutexpiry" - Line: 573 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 573 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $can_access_moderationqueue - Line: 752 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 752 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $awaitingusers - Line: 34 - File: global.php(959) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(959) : eval()'d code 34 errorHandler->error
/global.php 959 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 1024 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 1024 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5308 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5308 errorHandler->error
/global.php 1024 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1474 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1474 errorHandler->error
/inc/functions.php 1429 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Forums
Reinstate maximum steering angle (PATCH) - Printable Version

+- Forums (https://www.vdrift.net/Forum)
+-- Forum: Community (https://www.vdrift.net/Forum/forumdisplay.php?fid=3)
+--- Forum: Bugs (https://www.vdrift.net/Forum/forumdisplay.php?fid=7)
+--- Thread: Reinstate maximum steering angle (PATCH) (/showthread.php?tid=1139)



Reinstate maximum steering angle (PATCH) - fudje - 06-26-2009

This has been missing for the entire "refactor" - and is really annoying (to me at least. Should be to others too).
To reproduce, just drive any car on any track. All cars currently steer to 45°, which is both useless and unrealistic.

Patch to fix is very small. I've tried to keep this to the current coding style (header seem to have a lot of implementation code in them - what's with that? It could be driving up compilation times, btw):

Code:
Index: include/cardynamics.h
===================================================================
--- include/cardynamics.h    (revision 2505)
+++ include/cardynamics.h    (working copy)
@@ -196,7 +196,8 @@
    std::vector <CARBRAKE <T> > brake;
    std::vector <CARTIRE <T> > tire;
    std::vector <CARAERO <T> > aerodynamics;
-    
+    T maxangle;
+
    //set at load time
    std::list <std::pair <T, MATHVECTOR <T> > > mass_only_particles;
    enum
@@ -1416,9 +1417,6 @@
    ///set the steering angle to "value", where 1.0 is maximum right lock and -1.0 is maximum left lock.
    void SetSteering(const T value)
    {
-        //TODO: load in max steering angle
-        T maxangle = 45.0;
-        
        T steerangle = value * maxangle; //steering angle in degrees
        
        //ackermann stuff
@@ -1448,13 +1446,18 @@
        wheel[FRONT_RIGHT].SetSteerAngle(right_wheel_angle);
    }
    
-    //TODO: load in max steering angle
    ///Get the maximum steering angle in degrees
    T GetMaxSteeringAngle() const
    {
-        return 45.0;
+        return maxangle;
    }
    
+    ///Set the mavimum steering angle in degrees
+    void SetMaxSteeringAngle(const T value){
+      maxangle = value;
+    }
+
+    
    ///get the worldspace engine position
    MATHVECTOR <T> GetEnginePosition()
    {
Index: src/car.cpp
===================================================================
--- src/car.cpp    (revision 2505)
+++ src/car.cpp    (working copy)
@@ -1068,6 +1068,15 @@
        }
    }

+    //load the max steering angle
+    {
+        float maxangle = 45.0;
+        if (!GetConfigfileParam(error_output, c, "steering.max-angle", maxangle))
+            return false;
+        
+        dynamics.SetMaxSteeringAngle(maxangle);
+    }
+
    //load the driver
    {
        float mass;

Compiled and Tested on Ubuntu Karmic with gcc 4.4.0 - The bits I've added should compile on any C++ compiler ever made though Smile

Cheers,
fudje


Re: Reinstate maximum steering angle (PATCH) - joevenzon - 06-26-2009

fudje Wrote:I've tried to keep this to the current coding style (header seem to have a lot of implementation code in them - what's with that? It could be driving up compilation times, btw)

The cardynamics.h file defines a templated CARDYNAMICS class. The only reason I made it a template was so I could easily switch between floats and doubles as the primary "real" type, but this would have been much better served with a typedef instead of a template (woops, poor design on my part). As a result the implementation of the class is in the header since that's the easiest way to do template classes. Of course, there are fairly simple ways to separate out the implementation and header with template functions, and even better I could just refactor to use a typedef, but I haven't bothered yet. If you're interested in doing this let me know and I'll set you up with SVN access (the patch looks good and I'm applying it now).


- joevenzon - 06-27-2009

OK, your patch is in R2506. Thanks!


- fudje - 06-27-2009

Ah, of course, the templating.
I don't really understand C++ templates enough to do anything much about it at this point (though I fear I am going to have to learn) - mostly what I know is they're much more hackish than in, say, Java or C#.

You're very welcome to have the patch. Thanks for applying to SVN Smile