Coding Period Week 5: June 25 ~ July 01
On Monday’s meeting, we discussed possible cases for a composed block. Last week, I created the composed block functionality in that whenever a link exists in both input and output ports, the original link is removed, and a new link with the input/output block attached is added. However, this could cause a problem if someone mistakenly selects a port with internal wiring, potentially causing the robotics application to malfunction. Therefore, blocks with existing wiring should not be shown in the block selection dialog box. Additionally, an input port cannot have multiple wires, as this would create issues in determining which link to use. However, an output port can have multiple links, allowing data to be shared across both links. These changes need to be made this week, and I also need to refine the messy code. Dr. Jose Maria also discussed creating a demo application this week.
Goals
- Modify the composed block to follow specific rules
- Refine the previous block composition code
- Create demo applications with composed blocks
Accomplishment and Challenges
-
Solving the global block input links issue and extending block composition for every block
As discussed above, we should not have more than one link at the input port, and we need to hide input ports with internal wiring from the block composition dialog box. I modified the globalInputOutput function to segregate ports based on links and port types. In last week’s code, only code blocks were supported, so I made changes to support every block. I also observed an issue with the text being fetched from the package, which was taking a 40-character name. I modified it to take the name port from the labels of the blocks.
-
Solving the global block output links issue and refining existing code
For blocks with multiple wiring at the output side, a new link needs to be added with the respective global input/output attached. Unlike the global input block issue, this requires the parent global output block ID and the respective link ID so that the existing link is not modified. These changes were extensive and altered last week’s code, so I refined the overall code. After refinement, the entire global input/output block was tested with all cases and is working as expected.