JerOhm Posted June 23, 2020 Share Posted June 23, 2020 Hi, I'm trying to run the sample scenes for the SRWorks v9.3.0 but I keep getting this error message: FormatException: Input string was not in a correct format. System.Number.ParseSingle (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) (at <437ba245d8404784b9fbab9b439ac908>:0) System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <437ba245d8404784b9fbab9b439ac908>:0) System.Single.Parse (System.String s) (at <437ba245d8404784b9fbab9b439ac908>:0) Vive.Plugin.SR.ViveSR_DualCameraCalibrationTool.LoadParamsValue (System.Int32 angle_index, System.Single default_value) (at Assets/ViveSR/Scripts/ViveSR_DualCameraCalibrationTool.cs:196) Vive.Plugin.SR.ViveSR_DualCameraCalibrationTool.LoadDeviceParameter () (at Assets/ViveSR/Scripts/ViveSR_DualCameraCalibrationTool.cs:136) Vive.Plugin.SR.ViveSR_DualCameraRig.Initial () (at Assets/ViveSR/Scripts/ViveSR_DualCameraRig.cs:179) Vive.Plugin.SR.ViveSR.UpdateWhileWorking () (at Assets/ViveSR/Scripts/ViveSR.cs:328) Vive.Plugin.SR.ViveSR.Update () (at Assets/ViveSR/Scripts/ViveSR.cs:175) It looks like there is something wrong when trying to read the parameters in the calibration file. @Daniel_Y, @reneeclchen Link to comment Share on other sites More sharing options...
JerOhm Posted July 7, 2020 Author Share Posted July 7, 2020 Does anyone have the same problem? @Daniel_Y @Jad Link to comment Share on other sites More sharing options...
reneeclchen Posted July 15, 2020 Share Posted July 15, 2020 Hi @JerOhm, In SRWorks v0.9.3.0, we changed the format of this file: C:\Users\(USER NAME)\AppData\LocalLow\HTC Corporation\SR_Config\calibration_params.bin. You may have an old .bin file, and therefore the old format, from an old version of SRWorks. Kindly delete the file. SRWorks will regenerate it in the format that can be correctly parsed. 1 Link to comment Share on other sites More sharing options...
JerOhm Posted July 20, 2020 Author Share Posted July 20, 2020 Hi @reneeclchen, I tried your solution and it works for the first execution after deleting the file because there is no calibration file to read. However, I still get the same error the following executions. For some reason, the format of the new calibration file still cannot be parsed. Any ideas why? Link to comment Share on other sites More sharing options...
reneeclchen Posted July 21, 2020 Share Posted July 21, 2020 @JerOhm, Would you be so kind as to open the .bin file in Notepad and share the string in it with us? Thank you! Link to comment Share on other sites More sharing options...
JerOhm Posted July 21, 2020 Author Share Posted July 21, 2020 (edited) @reneeclchen, This is the string: 0.0,0.0,0.0,0.0,0.0,0.0 There is a weird symbol at the beginning of the string but I couldn't paste it. Thank you! Edited July 21, 2020 by JerOhm Link to comment Share on other sites More sharing options...
reneeclchen Posted July 22, 2020 Share Posted July 22, 2020 @JerOhm, It's most likely just how Unity's binaryreader and -writer work in different machines or operation systems. Since the calibration tool is an old feature and will be removed in later versions, I suggest these two steps: (1) Remove the .bin file, and (2) In ViveSR_DualCameraCalibrationTool.cs, slash out line 159 like this: //SaveParamValue(relative_angle, absolute_angle); The .bin file will then not be saved or loaded. It's not used anyway. 1 Link to comment Share on other sites More sharing options...
carlhyde Posted February 7, 2023 Share Posted February 7, 2023 System.FormatException is a type of exception in the .NET framework. It is thrown when an invalid format is encountered while parsing a string representation of a data type. For example, if you try to parse a string that is not a valid integer representation using the int.Parse() method (string to int) , it will throw a System.FormatException. The exception indicates that the string does not conform to the expected format for the type being parsed. To fix a System.FormatException in your code, you need to handle the exception and provide an appropriate solution based on the scenario Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now