working model
This commit is contained in:
parent
bc0672d6f8
commit
8b05ef6852
|
@ -4,7 +4,7 @@ __pycache__/
|
||||||
build/
|
build/
|
||||||
data/*
|
data/*
|
||||||
/dist/**/*
|
/dist/**/*
|
||||||
app.log
|
|
||||||
dist.zip
|
dist.zip
|
||||||
.venv
|
.venv
|
||||||
*.log
|
*.log
|
||||||
|
log/*
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
0.00632926238978882
|
|
||||||
|
|
||||||
0.006367644030288622
|
|
||||||
|
|
||||||
0.006349076001385698
|
|
4
main.py
4
main.py
|
@ -141,8 +141,8 @@ class MyApp:
|
||||||
|
|
||||||
@check_robot_app
|
@check_robot_app
|
||||||
def command_wrapper(self, *args, **kwargs):
|
def command_wrapper(self, *args, **kwargs):
|
||||||
logger.info(args)
|
# logger.info(args)
|
||||||
logger.info(kwargs)
|
# logger.info(kwargs)
|
||||||
return self.robot_app.cycle_start()
|
return self.robot_app.cycle_start()
|
||||||
|
|
||||||
@check_robot_app
|
@check_robot_app
|
||||||
|
|
|
@ -35,8 +35,11 @@ class PrepareRobotData:
|
||||||
}
|
}
|
||||||
if type == "line" or type == "free":
|
if type == "line" or type == "free":
|
||||||
pairs = zip(start_coordinates, point)
|
pairs = zip(start_coordinates, point)
|
||||||
|
data = []
|
||||||
|
for pair in pairs:
|
||||||
|
data.append(round(sum(pair), 3))
|
||||||
|
|
||||||
m0, m1, m2, m3, m4, m5 = [round(sum(i), 3) for i in pairs]
|
m0, m1, m2, m3, m4, m5 = data
|
||||||
if type == "line":
|
if type == "line":
|
||||||
step.update({"action": "10"})
|
step.update({"action": "10"})
|
||||||
if type == "free":
|
if type == "free":
|
||||||
|
@ -267,28 +270,12 @@ class SocketRobotArm:
|
||||||
p.resetJointState(self.urdf_manager.body_id, i, worldJointPoses[i])
|
p.resetJointState(self.urdf_manager.body_id, i, worldJointPoses[i])
|
||||||
|
|
||||||
calcWorldPosition = p.getLinkState(
|
calcWorldPosition = p.getLinkState(
|
||||||
self.urdf_manager.body_id,
|
self.urdf_manager.body_id, num_joints - 1, computeForwardKinematics=True
|
||||||
num_joints - 1,
|
|
||||||
computeForwardKinematics=True
|
|
||||||
)
|
)
|
||||||
calcWorldPosition = list(
|
calcWorldPosition = list(
|
||||||
[p * 1000 for p in calcWorldPosition[0]]
|
[p * 1000 for p in calcWorldPosition[0]]
|
||||||
+ [np.degrees(p) for p in p.getEulerFromQuaternion(calcWorldPosition[1])]
|
+ [np.degrees(p) for p in p.getEulerFromQuaternion(calcWorldPosition[1])]
|
||||||
)
|
)
|
||||||
# logger.info(calcWorldPosition)
|
|
||||||
# for i, pos in enumerate(zip(calcWorldPosition, self.world_coordinates)):
|
|
||||||
# logger.info(f"delta by WORLD {i} {pos[0] - pos[1]}")
|
|
||||||
position_diff = np.linalg.norm(self.world_coordinates[:3] - np.array(calcWorldPosition[:3]))
|
|
||||||
print("Position Difference:", position_diff)
|
|
||||||
with open('delta.json', 'a') as f:
|
|
||||||
f.write(f'\n{position_diff}\n')
|
|
||||||
|
|
||||||
# logger.info('-------')
|
|
||||||
|
|
||||||
# for i, pos in enumerate(zip(axisJointPoses, worldJointPoses)):
|
|
||||||
# logger.info(f"delta by JOINT {i} {pos[0] - pos[1]}")
|
|
||||||
|
|
||||||
# time.sleep(1)
|
|
||||||
|
|
||||||
self._get_command_count()
|
self._get_command_count()
|
||||||
self.set_text(text=f"Команд в очереди {self.remote_command_count}")
|
self.set_text(text=f"Команд в очереди {self.remote_command_count}")
|
||||||
|
@ -311,7 +298,7 @@ class SocketRobotArm:
|
||||||
if self.command_type == "base"
|
if self.command_type == "base"
|
||||||
else self.convert_file_to_joint()
|
else self.convert_file_to_joint()
|
||||||
)
|
)
|
||||||
with open(f"{self.command_type}.log", "w") as myfile:
|
with open(f"log/{self.command_type}.json", "w") as myfile:
|
||||||
myfile.write(json.dumps(commands))
|
myfile.write(json.dumps(commands))
|
||||||
|
|
||||||
self.add_rcc_list = (
|
self.add_rcc_list = (
|
||||||
|
@ -493,11 +480,10 @@ class SocketRobotArm:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
points = np.degrees(pj)
|
points = np.degrees(pj)
|
||||||
# points[1] = points[1] + 60
|
start_position = [0, 60, -100, 0, 40, 0]
|
||||||
# points[2] = points[2] - 100
|
start_position = [0, 0, 0, 0, 0, 0]
|
||||||
# points[4] = points[4] - 40
|
|
||||||
result.append(
|
result.append(
|
||||||
self.prepare_data.make_step("free", points, [0, 0, 0, 0, 0, 0])
|
self.prepare_data.make_step("free", points, start_position)
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ c_angles = [
|
||||||
"world": [1396.525, 1.687, 1322.697, 0, 90, 0],
|
"world": [1396.525, 1.687, 1322.697, 0, 90, 0],
|
||||||
"axis": [0, -0.002, -0.002, 0.003, -0.001, 0],
|
"axis": [0, -0.002, -0.002, 0.003, -0.001, 0],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"world": [1396.513, 1.758, 1322.749, -0.002, 90, 0],
|
"world": [1396.513, 1.758, 1322.749, -0.002, 90, 0],
|
||||||
"axis": [0.002, -0.001, 0, 0, 0, 0],
|
"axis": [0.002, -0.001, 0, 0, 0, 0],
|
||||||
|
@ -62,8 +61,33 @@ c_angles = [
|
||||||
"axis": [0, -0.001, 0, 0.002, 0, 90.003],
|
"axis": [0, -0.001, 0, 0.002, 0, 90.003],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
c_angles = [
|
||||||
|
{
|
||||||
|
"world": [
|
||||||
|
894.159973,
|
||||||
|
-738.295654,
|
||||||
|
782.748047,
|
||||||
|
172.274109,
|
||||||
|
28.079031,
|
||||||
|
120.377357,
|
||||||
|
],
|
||||||
|
"axis": [-39.428261, 10.391139, -32.562145, 176.81929, 38.895988, -159.779755],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"world": [
|
||||||
|
1100.071655,
|
||||||
|
-347.347412,
|
||||||
|
782.754578,
|
||||||
|
172.284241,
|
||||||
|
28.079557,
|
||||||
|
142.505508,
|
||||||
|
],
|
||||||
|
"axis": [-17.409513, 10.897068, -33.003525, 176.892288, 38.957874, -159.934479],
|
||||||
|
},
|
||||||
|
]
|
||||||
coordinates_index = 0
|
coordinates_index = 0
|
||||||
|
|
||||||
|
|
||||||
def handle_client(conn, addr):
|
def handle_client(conn, addr):
|
||||||
print(f"Connected by {addr}")
|
print(f"Connected by {addr}")
|
||||||
try:
|
try:
|
||||||
|
@ -109,7 +133,6 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
s.listen()
|
s.listen()
|
||||||
print(f"Server listening on {HOST}:{PORT}")
|
print(f"Server listening on {HOST}:{PORT}")
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
conn, addr = s.accept()
|
conn, addr = s.accept()
|
||||||
handle_client(conn, addr)
|
handle_client(conn, addr)
|
||||||
|
|
Loading…
Reference in New Issue