test model

This commit is contained in:
aarizona 2024-10-30 16:55:39 +03:00
parent 3aa4d6b3ea
commit 9a0f836d62
47 changed files with 1235 additions and 44 deletions

1095
app.log

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
X0 Z0
X0 Z100
X0 Z200
X100 Z200
X200 Z200
X200 Z100
X200 Z0
X100 Z0
X0 Y0
X0 Y100
X0 Y200
X100 Y200
X200 Y200
X200 Y100
X200 Y0
X100 Y0
X0 Z0

BIN
dist/client.zip vendored Normal file

Binary file not shown.

BIN
dist/client/_internal/base_library.zip vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/client/_internal/libbz2.so.1.0 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libcrypto.so.3 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libexpat.so.1 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libffi.so.8 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/liblzma.so.5 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libmpdec.so.3 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libpython3.10.so vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libssl.so.3 vendored Executable file

Binary file not shown.

BIN
dist/client/_internal/libz.so.1 vendored Executable file

Binary file not shown.

BIN
dist/client/client vendored Executable file

Binary file not shown.

2
dist/client/data.txt vendored Normal file
View File

@ -0,0 +1,2 @@
line,0,0,277.8,0,0,0
line,0,-50,50,0,0,0

0
dist/gitignore vendored Normal file
View File

1
dist/urdf_support vendored Symbolic link
View File

@ -0,0 +1 @@
urdf_support/

View File

@ -78,7 +78,7 @@ class MainContentComponent(QWidget):
layout.addWidget(self.rightPanel)
self.setLayout(layout)
self.setFixedSize(800, 600)
self.setFixedSize(800, 800)
self.initUI()
def initUI(self):

View File

@ -135,7 +135,9 @@ class MyApp:
return self.robot_app.set_command_type(type)
@check_robot_app
def command_wrapper(self):
def command_wrapper(self, *args, **kwargs):
logger.info(args)
logger.info(kwargs)
return self.robot_app.cycle_start()
@check_robot_app

View File

@ -36,7 +36,7 @@ class SocketRobotArm:
start_world_coordinates = []
remote_command_count = []
command_type = 'base'
command_type = "base"
command_data = None
def __init__(self, *args, **kwargs):
@ -73,6 +73,7 @@ class SocketRobotArm:
p.loadURDF("urdf/plane.urdf", physicsClientId=self.physics_client)
urdf_path = os.path.join("urdf", f"{self.urdf_filename}.urdf")
logger.info(urdf_path)
self.body_id = p.loadURDF(
urdf_path, [0, 0, 0], useFixedBase=1, physicsClientId=self.physics_client
)
@ -141,7 +142,7 @@ class SocketRobotArm:
self.get_world()
self.set_text(text=f"Мировые координаты {self.start_world_coordinates}")
time.sleep(0.5)
self.set_joint(self.convert_to_joint(self.start_world_coordinates[0:3]))
# self.set_joint(self.convert_to_joint(self.start_world_coordinates[0:3]))
self._get_command_count()
self.set_text(text=f"Команд в очереди {self.remote_command_count}")
@ -160,7 +161,9 @@ class SocketRobotArm:
time.sleep(0.5)
commands = (
self.steps_from_file() if self.command_type == "base" else self.convert_file_to_join()
self.steps_from_file()
if self.command_type == "base"
else self.convert_file_to_join()
)
self.add_rcc_list = (
@ -193,7 +196,7 @@ class SocketRobotArm:
[float(point) for point in [point["m0"], point["m1"], point["m2"]]]
)
# logger.info(f"point {point} {angles}")
self.set_joint(angles)
self.set_joint((*angles, point["m2"], point["m3"], point["m4"]))
time.sleep(1)
def convert_to_joint(self, coordinates):
@ -279,10 +282,10 @@ class SocketRobotArm:
def set_command_type(self, data):
self.command_type = data
def get_command_type(self):
return self.command_type
def get_command_data(self):
return self.command_data

View File

@ -10,5 +10,11 @@
"host": "192.168.70.65",
"slave_id": 22,
"urdf": "sample"
},
{
"name": "test (ip small)",
"host": "192.168.70.55",
"slave_id": 11,
"urdf": "borunte_macro"
}
]

82
run_local.py Normal file
View File

@ -0,0 +1,82 @@
import subprocess
import argparse
import sys
import signal
# Параметры для процессов
server_process = None
test_server_process = None
def usage():
"""Функция для отображения помощи"""
print("Usage: run_all.py [--test]")
sys.exit(1)
# Обработчик для сигналов выхода
def cleanup():
"""Функция для остановки серверов при выходе"""
print("Остановка серверов...")
if server_process:
server_process.terminate()
server_process.wait()
if test_server_process:
test_server_process.terminate()
test_server_process.wait()
print("Серверы остановлены.")
# Назначаем функции очистки для сигналов
signal.signal(signal.SIGINT, lambda *_: cleanup())
signal.signal(signal.SIGTERM, lambda *_: cleanup())
# Парсер аргументов командной строки
parser = argparse.ArgumentParser(description="Python launcher script.")
parser.add_argument("--test", action="store_true", help="Запуск в режиме тестирования")
args = parser.parse_args()
# Установка команды для pybullet_server
pybullet_command = [
"poetry",
"run",
"python",
"utils/pybullet_server.py",
"--test",
] # Путь к исполняемому файлу
# Если включен режим тестирования, добавляем флаг --test
if args.test:
pybullet_command.append("--test")
# Запуск pybullet_server.exe
print("Запуск pybullet_server...")
server_process = subprocess.Popen(pybullet_command)
# Проверяем успешный запуск сервера
if server_process.poll() is not None:
print("Ошибка при запуске pybullet_server")
sys.exit(1)
# Если включен режим тестирования, запускаем test_socket_server.exe
if args.test:
print("Запуск test_socket_server...")
test_server_process = subprocess.Popen(
["poetry", "run", "python", "utils/test_socket_server.py"]
) # Путь к исполняемому файлу
# Проверка успешного запуска тестового сервера
if test_server_process.poll() is not None:
print("Ошибка при запуске test_socket_server")
sys.exit(1)
# Запуск основного скрипта main.exe в режиме тестирования
subprocess.run(
["poetry", "run", "python", "main.py", "--mode", "test"]
) # Путь к исполняемому файлу
else:
# Запуск основного скрипта main.exe
subprocess.run(["poetry", "run", "python", "main.py"]) # Путь к исполняемому файлу
# Очистка после завершения
cleanup()

View File

@ -10,14 +10,14 @@
<link name="base_link">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/base_link.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/base_link.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
<material name="Black"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/base_link_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/base_link_collision.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
</collision>
@ -25,14 +25,14 @@
<link name="link_1">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_1.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_1.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
<material name="DarkRed"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_1_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_1_collision.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
</collision>
@ -44,14 +44,14 @@
<link name="link_2">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_2.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_2.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
<material name="DarkRed"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_2_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_2_collision.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
</collision>
@ -63,14 +63,14 @@
<link name="link_3">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_3.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_3.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0.01 0"/>
<material name="DarkRed"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_3_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_3_collision.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0.01 0"/>
</collision>
@ -82,14 +82,14 @@
<link name="link_4">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_4.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_4.stl"/>
</geometry>
<origin rpy="0.0 0.0 0.0" xyz="0 0 0"/>
<material name="DarkRed"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_4_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_4_collision.stl"/>
</geometry>
<origin rpy="0.0 0 0.0" xyz="0 0 0"/>
</collision>
@ -101,14 +101,14 @@
<link name="link_5">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_5.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_5.stl"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="DarkRed"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_5_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_5_collision.stl"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
</collision>
@ -120,14 +120,14 @@
<link name="link_6">
<visual>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_6.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_6.stl"/>
</geometry>
<origin rpy="0 0 0.0" xyz="0 0 0"/>
<material name="DarkRed"/>
</visual>
<collision>
<geometry>
<mesh filename="/home/aarizona/projects/modbus_test/urdf_support/borunte_support/meshes/link_6_collision.stl"/>
<mesh filename="../urdf_support/borunte_support/meshes/link_6_collision.stl"/>
</geometry>
<origin rpy="0 0 0.0" xyz="0 0 0"/>
</collision>

View File

@ -108,18 +108,18 @@
</link>
<!-- joints: main serial chain -->
<joint name="joint_1" type="revolute">
<limit effort="0" lower="-2.7925" upper="2.7925" velocity="3.1415" />
<origin rpy="0 0 0" xyz="0 0 0" />
<parent link="base_link" />
<child link="link_1" />
<axis xyz="0 0 1" />
<limit effort="0" lower="-2.7925" upper="2.7925" velocity="3.1415" />
</joint>
<joint name="joint_2" type="revolute">
<origin rpy="0 0 0" xyz="0.0170450 0 0.494600" />
<limit effort="0" lower="-0.5759" upper="2.6529" velocity="3.1415" />
<parent link="link_1" />
<child link="link_2" />
<axis xyz="0 1 0" />
<limit effort="0" lower="-0.5759" upper="2.6529" velocity="3.1415" />
<axis xyz="0 -1 0" />
<origin rpy="0 0 0" xyz="0.0170450 0 0.494600" />
</joint>
<joint name="joint_3" type="revolute">
<origin rpy="0 1.5708 0" xyz="0 0 0.729921" />
@ -129,24 +129,24 @@
<limit effort="0" lower="-2.6145" upper="2.8797" velocity="3.9269" />
</joint>
<joint name="joint_4" type="revolute">
<origin rpy="0 0 0" xyz="0 0 0.098277" />
<limit effort="0" lower="-3.3161" upper="3.3161" velocity="6.9813" />
<parent link="link_3" />
<child link="link_4" />
<axis xyz="-1 0 0" />
<limit effort="0" lower="-3.3161" upper="3.3161" velocity="6.9813" />
<axis xyz="0 0 1" />
<origin rpy="0 0 0" xyz="0 0 0.098277" />
</joint>
<joint name="joint_5" type="revolute">
<origin rpy="0 0 0" xyz="0.0 0 1.109039" />
<limit effort="0" lower="-2.0943" upper="2.0943" velocity="5.7595" />
<parent link="link_4" />
<child link="link_5" />
<axis xyz="0 -1 0" />
<limit effort="0" lower="-2.0943" upper="2.0943" velocity="5.7595" />
<axis xyz="0 1 0" />
<origin rpy="0 0 0" xyz="0.0 0 1.109039" />
</joint>
<joint name="joint_6" type="revolute">
<origin rpy="0 0 0" xyz="0.0 0 0.117" />
<limit effort="0" lower="-6.2831" upper="6.2831" velocity="8.3775" />
<parent link="link_5" />
<child link="link_6" />
<axis xyz="-1 0 0" />
<limit effort="0" lower="-6.2831" upper="6.2831" velocity="8.3775" />
<axis xyz="0 0 1" />
<origin rpy="0 0 0" xyz="0.0 0 0.117" />
</joint>
</robot>

View File

@ -32,5 +32,5 @@ if __name__ == "__main__":
# Если передан аргумент --test, устанавливаем тип подключения SHARED_MEMORY_SERVER
connection_type = "GUI_SERVER" if args.test else "SHARED_MEMORY_SERVER"
connection_type = "SHARED_MEMORY_SERVER"
# connection_type = "SHARED_MEMORY_SERVER"
main(connection_type)