Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
car-sim-remaster
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9631059
car-sim-remaster
Commits
9c80c572
Commit
9c80c572
authored
Jul 02, 2020
by
Danial KordModanlou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new balancing car + little data saver
parent
d663e669
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
303 additions
and
264 deletions
+303
-264
.gitignore
.gitignore
+2
-0
workspace.xml
.idea/.idea.car-sim-remaster/.idea/workspace.xml
+274
-260
DataSaver.cs
Assets/scripts/DataSaver.cs
+22
-2
Suspension.cs
Assets/scripts/Suspension.cs
+5
-2
No files found.
.gitignore
View file @
9c80c572
...
@@ -2,3 +2,5 @@
...
@@ -2,3 +2,5 @@
/.vs
/.vs
/Library
/Library
/Logs
/Logs
*.csv
*.csv.meta
.idea/.idea.car-sim-remaster/.idea/workspace.xml
View file @
9c80c572
This diff is collapsed.
Click to expand it.
Assets/scripts/DataSaver.cs
View file @
9c80c572
...
@@ -34,6 +34,8 @@ public class DataSaver : MonoBehaviour
...
@@ -34,6 +34,8 @@ public class DataSaver : MonoBehaviour
private
String
curentName
;
private
String
curentName
;
public
static
int
checkPoint
=
1
;
public
static
int
checkPoint
=
1
;
private
bool
newLineAdded
=
true
;
private
bool
newLineAdded
=
true
;
private
int
lastCheckPoint
=
0
;
// public static Action<String,Transform> OnCheckPoint;
// public static Action<String,Transform> OnCheckPoint;
private
bool
stable
=
false
;
private
bool
stable
=
false
;
...
@@ -129,8 +131,22 @@ public class DataSaver : MonoBehaviour
...
@@ -129,8 +131,22 @@ public class DataSaver : MonoBehaviour
rowDataTemp
[
10
]
=
"None"
;
rowDataTemp
[
10
]
=
"None"
;
rowDataTemp
[
11
]
=
"None"
;
rowDataTemp
[
11
]
=
"None"
;
}
}
string
newLine
=
string
.
Format
(
"{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}"
,
rowDataTemp
[
0
],
rowDataTemp
[
1
],
rowDataTemp
[
2
],
rowDataTemp
[
3
],
rowDataTemp
[
4
],
rowDataTemp
[
5
],
rowDataTemp
[
6
],
rowDataTemp
[
7
],
rowDataTemp
[
8
],
rowDataTemp
[
9
],
rowDataTemp
[
10
],
rowDataTemp
[
11
],
checkPoint
);
string
newLine
=
null
;
if
(
lastCheckPoint
!=
checkPoint
)
{
newLine
=
string
.
Format
(
"{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}"
,
rowDataTemp
[
0
],
rowDataTemp
[
1
],
rowDataTemp
[
2
],
rowDataTemp
[
3
],
rowDataTemp
[
4
],
rowDataTemp
[
5
],
rowDataTemp
[
6
],
rowDataTemp
[
7
],
rowDataTemp
[
8
],
rowDataTemp
[
9
],
rowDataTemp
[
10
],
rowDataTemp
[
11
],
"****"
);
}
else
{
newLine
=
string
.
Format
(
"{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}"
,
rowDataTemp
[
0
],
rowDataTemp
[
1
],
rowDataTemp
[
2
],
rowDataTemp
[
3
],
rowDataTemp
[
4
],
rowDataTemp
[
5
],
rowDataTemp
[
6
],
rowDataTemp
[
7
],
rowDataTemp
[
8
],
rowDataTemp
[
9
],
rowDataTemp
[
10
],
rowDataTemp
[
11
]);
}
timePassed
=
0
;
timePassed
=
0
;
csv
.
AppendLine
(
newLine
);
csv
.
AppendLine
(
newLine
);
...
@@ -172,6 +188,10 @@ public class DataSaver : MonoBehaviour
...
@@ -172,6 +188,10 @@ public class DataSaver : MonoBehaviour
csv
.
AppendLine
(
newLine2
);
csv
.
AppendLine
(
newLine2
);
newLineAdded
=
true
;
newLineAdded
=
true
;
}
}
else
{
lastCheckPoint
=
checkPoint
;
}
File
.
AppendAllText
(
filePath
,
csv
.
ToString
());
File
.
AppendAllText
(
filePath
,
csv
.
ToString
());
}
}
}
}
...
...
Assets/scripts/Suspension.cs
View file @
9c80c572
...
@@ -16,6 +16,9 @@ public class Suspension : MonoBehaviour
...
@@ -16,6 +16,9 @@ public class Suspension : MonoBehaviour
Rigidbody
m_rigidbody
;
Rigidbody
m_rigidbody
;
public
bool
setSus
;
public
bool
setSus
;
[
Range
(
0.001f
,
100
)]
public
float
divider
=
10f
;
// Start is called before the first frame update
// Start is called before the first frame update
void
Start
()
void
Start
()
{
{
...
@@ -44,9 +47,9 @@ public class Suspension : MonoBehaviour
...
@@ -44,9 +47,9 @@ public class Suspension : MonoBehaviour
if
(
spring
.
targetPosition
>
0
&&
setSus
)
if
(
spring
.
targetPosition
>
0
&&
setSus
)
{
{
wc
.
suspensionDistance
=
wc
.
sprungMass
*
Physics
.
gravity
.
magnitude
/
(
spring
.
targetPosition
*
spring
.
spring
);
wc
.
suspensionDistance
=
wc
.
sprungMass
*
Physics
.
gravity
.
magnitude
/
(
spring
.
targetPosition
*
spring
.
spring
*
divider
);
}
}
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment