Skip to content

robot_order

RobotOrderEntity #

Bases: QEntity

A robot entity to display to order position.

Attributes:

Name Type Description
color QColor

Robot color

Source code in cogip/entities/robot_order.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class RobotOrderEntity(Qt3DCore.QEntity):
    """
    A robot entity to display to order position.

    Attributes:
        color: Robot color
    """

    color: QtGui.QColor = QtGui.QColor.fromRgb(10, 77, 18, 100)

    def __init__(self, parent: Qt3DCore.QEntity, robot_id: int = 1):
        """
        Class constructor.
        """
        super().__init__(parent)

        mesh = Qt3DRender.QMesh(self)
        mesh.setSource(QtCore.QUrl(f"file:assets/{'robot' if robot_id == 1 else 'pami'}2024.stl"))

        self.transform = Qt3DCore.QTransform(self)

        self.material = Qt3DExtras.QDiffuseSpecularMaterial(self)
        self.material.setShininess(1.0)
        self.material.setDiffuse(self.color)
        self.material.setSpecular(self.color)

        self.addComponent(mesh)
        self.addComponent(self.transform)
        self.addComponent(self.material)

__init__(parent, robot_id=1) #

Class constructor.

Source code in cogip/entities/robot_order.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def __init__(self, parent: Qt3DCore.QEntity, robot_id: int = 1):
    """
    Class constructor.
    """
    super().__init__(parent)

    mesh = Qt3DRender.QMesh(self)
    mesh.setSource(QtCore.QUrl(f"file:assets/{'robot' if robot_id == 1 else 'pami'}2024.stl"))

    self.transform = Qt3DCore.QTransform(self)

    self.material = Qt3DExtras.QDiffuseSpecularMaterial(self)
    self.material.setShininess(1.0)
    self.material.setDiffuse(self.color)
    self.material.setSpecular(self.color)

    self.addComponent(mesh)
    self.addComponent(self.transform)
    self.addComponent(self.material)