Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing framework #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions driverless_ws/src/planning/testing_framework/ex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"blue_cones": [
{
"x": 1,
"y": 2,
"z": 3
},
{
"x": 3,
"y": 2,
"z": 1
}
],
"yellow_cones": [
{
"x": 1,
"y": 2,
"z": 3
}
]
}
27 changes: 27 additions & 0 deletions driverless_ws/src/planning/testing_framework/readfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from eufs_msgs.msg import ConeArray as ConeArray
from geometry_msgs.msg import Point
import json

def pointList(cones):
lst = []
for cone in cones:
p = Point()
p.x = float(cone["x"])
p.y = float(cone["y"])
p.z = float(cone["z"])
lst.append(p)
return lst

def read():
f = open("ex.json")
json_data = json.load(f)
f.close()
blue_cones = json_data["blue_cones"]
yellow_cones = json_data["yellow_cones"]
cones = ConeArray()
cones.blue_cones = pointList(blue_cones)
cones.yellow_cones = pointList(yellow_cones)
return cones

if __name__ == '__main__':
print(read())
Loading