For the past week, I have been trying to add in more subcomponents to the RoCo system for the Furniture project. The shape that I have been working on is Pentagon. There are various problems that I encountered while trying to create this new component. The codes below are the python codes I wrote up for the Pentagon Component.

Figure 1: This is the face module for the Pentagon component.

Figure 2: This is the python code for the Pentagon Component.

A new Component will follow the basic coding structure of defining its parameter, face, and interface (Figure 1). Each new component would also need a new face module that will define its face interface (Figure 2). I follow this coding format and created a new Pentagon component. However, when I try to use the add_subcomponent function to create a Pentagon component, I would get the following error (Figure 3).

Figure 3: This is the error message I got when I tried to create a Pentagon component.

To figure out what is causing this problem, I created a test.py component, which have the exact same code as the Rectangle component, and tried to create this new component in RoCo. The reason why I used the same code as the Rectangle component is becasue I know that the code for Rectangle component is bug free, therefore, if I got the same error message, then the error is not cause by the code in the Pentagon.py. I end up getting the same error message shown in Figure 3. From this, I know that the cause of this error message is not because of the code I wrote since we know that the Rectangle component is working properly. With more debugging, I figure out that the problem is caused by the format of the file and class name. The class name of the component has to be camel case (First letter is upper case) and the file name have to have the same name as the class name.

After I made this change to the Test.py component, I was able to add the new Test component using add_subcomponent. However, when I applied this correction to the Pentagon Component, I still got the same error message. I will continue working on the code to figure out cause of the problem.

Next Post Previous Post