Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
山
山西检定流水线数字孪生项目
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨泽宇
山西检定流水线数字孪生项目
Commits
2f1e5df6
Commit
2f1e5df6
authored
May 15, 2024
by
杨泽宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新AGV
parent
eb01de77
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2991 additions
and
2801 deletions
+2991
-2801
CloudiaMapDecoderV2.cs
Assets/Scripts/Components/AGV/CloudiaMapDecoderV2.cs
+31
-13
advancedPointList.json
Assets/Scripts/Components/AGV/advancedPointList.json
+5
-1
1_Main.unity
Assets/_Scenes/1_Main.unity
+2955
-2787
No files found.
Assets/Scripts/Components/AGV/CloudiaMapDecoderV2.cs
View file @
2f1e5df6
...
...
@@ -7,37 +7,55 @@ using System.Linq;
public
class
CloudiaMapDecoderV2
:
CloudiaMapDecoder
{
public
new
TextAsset
DataFile
;
public
override
List
<
DTMapTargetPosition
>
DecodeMapKeyPositionInfo
()
{
JsonData
nodes
=
JsonMapper
.
ToObject
(
DataFile
.
text
);
JsonData
data
=
JsonMapper
.
ToObject
(
DataFile
.
text
);
JsonData
advancedPointLists
=
data
[
"advancedPointList"
];
List
<
DTMapTargetPosition
>
result
=
new
List
<
DTMapTargetPosition
>();
foreach
(
JsonData
node
in
node
s
)
foreach
(
JsonData
advancedPointList
in
advancedPointList
s
)
{
DTMapTargetPosition
p
=
(
new
GameObject
()).
AddComponent
<
DTMapTargetPosition
>();
p
.
name
=
node
[
"instanceName"
].
ToString
();
p
.
name
=
advancedPointList
[
"instanceName"
].
ToString
();
float
x
=
0f
;
float
y
=
0f
;
// 如果JSON数据中的坐标是整数类型,则将其转换为float
if
(
node
[
"pos"
][
"x"
].
IsInt
)
x
=
(
float
)(
int
)
node
[
"pos"
][
"x"
];
else
if
(
node
[
"pos"
][
"x"
].
IsDouble
)
x
=
(
float
)(
double
)
node
[
"pos"
][
"x"
];
if
(
advancedPointList
[
"pos"
][
"x"
].
IsInt
)
x
=
(
float
)(
int
)
advancedPointList
[
"pos"
][
"x"
];
else
if
(
advancedPointList
[
"pos"
][
"x"
].
IsDouble
)
x
=
(
float
)(
double
)
advancedPointList
[
"pos"
][
"x"
];
if
(
node
[
"pos"
][
"y"
].
IsInt
)
y
=
(
float
)(
int
)
node
[
"pos"
][
"y"
];
else
if
(
node
[
"pos"
][
"y"
].
IsDouble
)
y
=
(
float
)(
double
)
node
[
"pos"
][
"y"
];
if
(
advancedPointList
[
"pos"
][
"y"
].
IsInt
)
y
=
(
float
)(
int
)
advancedPointList
[
"pos"
][
"y"
];
else
if
(
advancedPointList
[
"pos"
][
"y"
].
IsDouble
)
y
=
(
float
)(
double
)
advancedPointList
[
"pos"
][
"y"
];
p
.
RealPosition
=
new
Vector3
(
x
,
y
,
0
);
result
.
Add
(
p
);
}
if
(
data
.
ContainsKey
(
"advancedCurveList"
))
{
JsonData
advancedCurveLists
=
data
[
"advancedCurveList"
];
foreach
(
JsonData
advancedCurveList
in
advancedCurveLists
)
{
string
instanceName
=
advancedCurveList
[
"instanceName"
].
ToString
();
string
[]
instanceNames
=
instanceName
.
Split
(
"-"
);
string
srcInstanceName
=
instanceNames
[
0
];
string
dstInstanceName
=
instanceNames
[
1
];
var
s_objs
=
(
from
x
in
result
where
x
.
name
==
srcInstanceName
select
x
).
ToArray
();
var
d_objs
=
(
from
x
in
result
where
x
.
name
==
dstInstanceName
select
x
).
ToArray
();
if
(
s_objs
.
Length
>
0
&&
d_objs
.
Length
>
0
)
{
s_objs
[
0
].
NextPositions
.
Add
(
d_objs
[
0
]);
}
}
}
return
result
;
}
}
Assets/Scripts/Components/AGV/advancedPointList.json
View file @
2f1e5df6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Assets/_Scenes/1_Main.unity
View file @
2f1e5df6
This diff is collapsed.
Click to expand it.
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