File size: 1,354 Bytes
96da58e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import abc
import xml.etree.ElementTree as ET


class BaseParser(object):
    """
    Base class for Parser objects used by renderers.
    """

    def __init__(self, renderer, env):
        """
        Parse the mujoco xml and initialize iG renderer objects.

        Args:
            renderer: the renderer
            env : Mujoco env
        """

        self.renderer = renderer
        self.env = env
        self.xml_root = ET.fromstring(self.env.sim.model.get_xml())
        self.parent_map = {c: p for p in self.xml_root.iter() for c in p}
        self.visual_objects = {}

    @abc.abstractmethod
    def parse_textures(self):
        """
        Parse and load all textures and store them
        """
        raise NotImplementedError

    @abc.abstractmethod
    def parse_materials(self):
        """
        Parse all materials and use texture mapping to initialize materials
        """
        raise NotImplementedError

    def parse_cameras(self):
        """
        Parse cameras and initialize the cameras.
        """
        raise NotImplementedError

    def parse_meshes(self):
        """
        Create mapping of meshes.
        """
        raise NotImplementedError

    def parse_geometries(self):
        """
        Iterate through each geometry and load it in the renderer.
        """
        raise NotImplementedError