Skip to content

Commit

Permalink
added fourth week update
Browse files Browse the repository at this point in the history
  • Loading branch information
BkPankaj committed Jun 24, 2024
1 parent be562c7 commit 7cece80
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 3 deletions.
59 changes: 59 additions & 0 deletions docs/_posts/2024-06-10-code-w4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: "Coding Period Week 4: June 18 ~ June 24"
categories:
- Blog
permalink: /coding-week4/
toc_label: Table of Content
toc: true
sidebar:
nav: "docs"
---

In the fourth week's Monday meeting, I showed a working demo and discussed the previous week's tasks. The mentors suggested working on block composition for global input/output. The other nested issue is quite complex and needs more time, so this task is postponed to other week.
## Goals
- [x] Complete the first Selenium-based global test
- [x] Modification of VC block compostion for Global Input Output

## Accomplishment and Challenges

* #### Pasting .vc3 file and opening the file in VC
I first tried putting the circuit file in the Selenium Docker container through a Python script, but it wasn't a great solution, so I decided to put the circuit file through YAML using Docker commands. After solving this, I needed to open the file from a particular directory in the file manager dialog box. For this, OS-level control was needed, so I used the pyautogui library for opening the file in Visual Circuit.

* #### Building and solving inseure download issue
There were many errors when building the project as the backend was running on localhost on the local machine and had to be accessed from the Docker container, resulting in fetch errors. These were resolved after modifying setting.py and .env. After that, the browser wasn't allowing downloads as Chrome considered the HTTP frontend insecure. After some Googling and searching on StackOverflow, I found a solution. Finally, the whole process was completed automatically by Selenium. The complete process is shown in the GIF below.
Selenium based first automated global test:

![](../assets/images/six.gif)

* #### Improving fetch Global Input and Output function
In the previous week, I was able to fetch the port data from all blocks, but it was using more iterations and not proper internal functions for fetching the data. So I improved the global input/output function and also added the submit and checklist handlers to pass data to other scripts.

* #### Creating input output blocks automatically from checkbox data
Depending on the port chosen by the user, the particular global input/output block is generated automatically. It checks the port type, and according to that, the input or output block is generated with the same name. Initially, the global input/output block position is the same as the initial position, and the links are null.


* #### Modification of Links and creating respective input output block
I researched the internal structure of the model and tried to access the links and respective link IDs of each block. After this, I wrote down all possible cases for creating a circuit by the user. One case is where the global input/output has zero links, so one link has to be created, and the source and target assigned. Another case is that there is already a link connected with the block, so according to the port type, the particular source or target has to be removed and a new one assigned. Apart from that, there are other cases that need to be tested in the future, such as if there are two links at the same port, which one to choose. I want to ask the mentors about these cases.

* #### Saving and retriving old blocks function
Before generating the .vc3 composed block file, the old model has to be saved so the user can continue working on the circuit without worrying about the blocks global input/output. The model and project info are saved in the stack, and whenever the build is completed, the old model is loaded. There were constant errors, such as storing the data in the stack but it was changing with changes, as I was storing this.activModel directly in the stack, causing changes in the stack. For that, I tried several methods using deepCopy, custom functions, and cloneDeep. Both deepCopy and custom functions didn't work, so I used the cloneDeep library, which worked without any errors. Similar to the "Save as" functionality, I used that part of the code for generating .vc3 file.


Normal circuit to be converted for block:
![](../assets/images/eight.png)

Global input ouput port selection :
![](../assets/images/nine.png)

Generated block:
![](../assets/images/seven.png)

Internal block structure:
![](../assets/images/ten.png)


## Commits
1. [https://github.com/JdeRobot/VisualCircuit/commit/f9bd5007fa83a4ee2503e1780006a425c1994372](https://github.com/JdeRobot/VisualCircuit/commit/f9bd5007fa83a4ee2503e1780006a425c1994372)
2. [https://github.com/JdeRobot/VisualCircuit/commit/51c82737938e5370e1e3047b5ee9d9bdeb117940](https://github.com/JdeRobot/VisualCircuit/commit/51c82737938e5370e1e3047b5ee9d9bdeb117940)
3. [https://github.com/JdeRobot/VisualCircuit/commit/0d3759b154f110318e6b6b7e29fa61012262238a](https://github.com/JdeRobot/VisualCircuit/commit/0d3759b154f110318e6b6b7e29fa61012262238a)

63 changes: 61 additions & 2 deletions docs/_site/feed.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.5">Jekyll</generator><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/" rel="alternate" type="text/html" /><updated>2024-06-17T21:26:03+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/feed.xml</id><title type="html">GSoC 2024 VisualCircuit Block Library - JdeRobot</title><author><name>Pankaj Keshav Borade</name></author><entry><title type="html">Coding Period Week 2: June 04 ~ June 10</title><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week2/" rel="alternate" type="text/html" title="Coding Period Week 2: June 04 ~ June 10" /><published>2024-06-10T00:00:00+05:30</published><updated>2024-06-10T00:00:00+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/code-w2</id><content type="html" xml:base="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week2/"><![CDATA[<p>Welcome to the second week of Coding Week progress. In the Monday meeting, we discussed the minimum tasks required for the midterm evaluation, reviewed the previous tasks, and assigned tasks for the next week. One of the issues in VisualCircuit is that it doesn’t generate internal scripts for nested blocks. This issue prevents the creation of complex robotics applications. To address this, I will be modifying the block composition this week. Additionally, I created a basic frontend test and installation process within GitHub Actions. This week, I will work on the first global test with GitHub Actions.</p>
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.5">Jekyll</generator><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/" rel="alternate" type="text/html" /><updated>2024-06-24T21:47:25+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/feed.xml</id><title type="html">GSoC 2024 VisualCircuit Block Library - JdeRobot</title><author><name>Pankaj Keshav Borade</name></author><entry><title type="html">Coding Period Week 2: June 04 ~ June 10</title><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week2/" rel="alternate" type="text/html" title="Coding Period Week 2: June 04 ~ June 10" /><published>2024-06-10T00:00:00+05:30</published><updated>2024-06-10T00:00:00+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/code-w2</id><content type="html" xml:base="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week2/"><![CDATA[<p>Welcome to the second week of Coding Week progress. In the Monday meeting, we discussed the minimum tasks required for the midterm evaluation, reviewed the previous tasks, and assigned tasks for the next week. One of the issues in VisualCircuit is that it doesn’t generate internal scripts for nested blocks. This issue prevents the creation of complex robotics applications. To address this, I will be modifying the block composition this week. Additionally, I created a basic frontend test and installation process within GitHub Actions. This week, I will work on the first global test with GitHub Actions.</p>

<h2 id="goals">Goals</h2>
<ul class="task-list">
Expand Down Expand Up @@ -91,7 +91,66 @@
<h2 id="previous-pr-updates">Previous PR Updates</h2>
<ol>
<li>Merged - <a href="https://github.com/JdeRobot/VisualCircuit-resources/pull/12">https://github.com/JdeRobot/VisualCircuit-resources/pull/12</a></li>
</ol>]]></content><author><name>Pankaj Keshav Borade</name></author><category term="Blog" /><summary type="html"><![CDATA[On the 10th of June, during Monday’s meeting, Dr. JoseMaria explained the Global Input Output issue. Whenever the user creates a Robotics Application circuit, if it needs to generate a block, the user needs to modify the circuit, which is very time-consuming. Therefore, we need to implement the functionality for generating both the block and the circuit without modifying the circuit. This functionality will improve user performance on VC. Additionally, the tasks from the previous week were only partially completed, so they have been reassigned for this week. Goals Modification of VC block compostion for Global Input Output [In Progress] Create first global test workflow [In Progress] Solve the issue of nested block [In Progress]]]></summary></entry><entry><title type="html">Coding Period Week 1: May 27 ~ June 03</title><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week1/" rel="alternate" type="text/html" title="Coding Period Week 1: May 27 ~ June 03" /><published>2024-06-03T00:00:00+05:30</published><updated>2024-06-03T00:00:00+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/code-w1</id><content type="html" xml:base="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week1/"><![CDATA[<p>From here onwards Coding period begins, During the Monday meeting, mentors discussed the blocks in VisualCircuit resources and initial tests with GitHub Actions. Additionally, I had some doubts about the VC resources repository, which were clarified by the mentors.</p>
</ol>]]></content><author><name>Pankaj Keshav Borade</name></author><category term="Blog" /><summary type="html"><![CDATA[On the 10th of June, during Monday’s meeting, Dr. JoseMaria explained the Global Input Output issue. Whenever the user creates a Robotics Application circuit, if it needs to generate a block, the user needs to modify the circuit, which is very time-consuming. Therefore, we need to implement the functionality for generating both the block and the circuit without modifying the circuit. This functionality will improve user performance on VC. Additionally, the tasks from the previous week were only partially completed, so they have been reassigned for this week. Goals Modification of VC block compostion for Global Input Output [In Progress] Create first global test workflow [In Progress] Solve the issue of nested block [In Progress]]]></summary></entry><entry><title type="html">Coding Period Week 4: June 18 ~ June 24</title><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week4/" rel="alternate" type="text/html" title="Coding Period Week 4: June 18 ~ June 24" /><published>2024-06-10T00:00:00+05:30</published><updated>2024-06-10T00:00:00+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/code-w4</id><content type="html" xml:base="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week4/"><![CDATA[<p>In the fourth week’s Monday meeting, I showed a working demo and discussed the previous week’s tasks. The mentors suggested working on block composition for global input/output. The other nested issue is quite complex and needs more time, so this task is postponed to other week.</p>
<h2 id="goals">Goals</h2>
<ul class="task-list">
<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />Complete the first Selenium-based global test</li>
<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />Modification of VC block compostion for Global Input Output</li>
</ul>

<h2 id="accomplishment-and-challenges">Accomplishment and Challenges</h2>

<ul>
<li>
<h4 id="pasting-vc3-file-and-opening-the-file-in-vc">Pasting .vc3 file and opening the file in VC</h4>
<p>I first tried putting the circuit file in the Selenium Docker container through a Python script, but it wasn’t a great solution, so I decided to put the circuit file through YAML using Docker commands. After solving this, I needed to open the file from a particular directory in the file manager dialog box. For this, OS-level control was needed, so I used the pyautogui library for opening the file in Visual Circuit.</p>
</li>
<li>
<h4 id="building-and-solving-inseure-download-issue">Building and solving inseure download issue</h4>
<p>There were many errors when building the project as the backend was running on localhost on the local machine and had to be accessed from the Docker container, resulting in fetch errors. These were resolved after modifying setting.py and .env. After that, the browser wasn’t allowing downloads as Chrome considered the HTTP frontend insecure. After some Googling and searching on StackOverflow, I found a solution. Finally, the whole process was completed automatically by Selenium. The complete process is shown in the GIF below.
Selenium based first automated global test:</p>
</li>
</ul>

<p><img src="../assets/images/six.gif" alt="" /></p>

<ul>
<li>
<h4 id="improving-fetch-global-input-and-output-function">Improving fetch Global Input and Output function</h4>
<p>In the previous week, I was able to fetch the port data from all blocks, but it was using more iterations and not proper internal functions for fetching the data. So I improved the global input/output function and also added the submit and checklist handlers to pass data to other scripts.</p>
</li>
<li>
<h4 id="creating-input-output-blocks-automatically-from-checkbox-data">Creating input output blocks automatically from checkbox data</h4>
<p>Depending on the port chosen by the user, the particular global input/output block is generated automatically. It checks the port type, and according to that, the input or output block is generated with the same name. Initially, the global input/output block position is the same as the initial position, and the links are null.</p>
</li>
<li>
<h4 id="modification-of-links-and-creating-respective-input-output-block">Modification of Links and creating respective input output block</h4>
<p>I researched the internal structure of the model and tried to access the links and respective link IDs of each block. After this, I wrote down all possible cases for creating a circuit by the user. One case is where the global input/output has zero links, so one link has to be created, and the source and target assigned. Another case is that there is already a link connected with the block, so according to the port type, the particular source or target has to be removed and a new one assigned. Apart from that, there are other cases that need to be tested in the future, such as if there are two links at the same port, which one to choose. I want to ask the mentors about these cases.</p>
</li>
<li>
<h4 id="saving-and-retriving-old-blocks-function">Saving and retriving old blocks function</h4>
<p>Before generating the .vc3 composed block file, the old model has to be saved so the user can continue working on the circuit without worrying about the blocks global input/output. The model and project info are saved in the stack, and whenever the build is completed, the old model is loaded. There were constant errors, such as storing the data in the stack but it was changing with changes, as I was storing this.activModel directly in the stack, causing changes in the stack. For that, I tried several methods using deepCopy, custom functions, and cloneDeep. Both deepCopy and custom functions didn’t work, so I used the cloneDeep library, which worked without any errors. Similar to the “Save as” functionality, I used that part of the code for generating .vc3 file.</p>
</li>
</ul>

<p>Normal circuit to be converted for block:
<img src="../assets/images/eight.png" alt="" /></p>

<p>Global input ouput port selection :
<img src="../assets/images/nine.png" alt="" /></p>

<p>Generated block:
<img src="../assets/images/seven.png" alt="" /></p>

<p>Internal block structure:
<img src="../assets/images/ten.png" alt="" /></p>

<h2 id="commits">Commits</h2>
<ol>
<li><a href="https://github.com/JdeRobot/VisualCircuit/commit/f9bd5007fa83a4ee2503e1780006a425c1994372">https://github.com/JdeRobot/VisualCircuit/commit/f9bd5007fa83a4ee2503e1780006a425c1994372</a></li>
<li><a href="https://github.com/JdeRobot/VisualCircuit/commit/51c82737938e5370e1e3047b5ee9d9bdeb117940">https://github.com/JdeRobot/VisualCircuit/commit/51c82737938e5370e1e3047b5ee9d9bdeb117940</a></li>
<li><a href="https://github.com/JdeRobot/VisualCircuit/commit/0d3759b154f110318e6b6b7e29fa61012262238a">https://github.com/JdeRobot/VisualCircuit/commit/0d3759b154f110318e6b6b7e29fa61012262238a</a></li>
</ol>]]></content><author><name>Pankaj Keshav Borade</name></author><category term="Blog" /><summary type="html"><![CDATA[In the fourth week’s Monday meeting, I showed a working demo and discussed the previous week’s tasks. The mentors suggested working on block composition for global input/output. The other nested issue is quite complex and needs more time, so this task is postponed to other week. Goals Complete the first Selenium-based global test Modification of VC block compostion for Global Input Output]]></summary></entry><entry><title type="html">Coding Period Week 1: May 27 ~ June 03</title><link href="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week1/" rel="alternate" type="text/html" title="Coding Period Week 1: May 27 ~ June 03" /><published>2024-06-03T00:00:00+05:30</published><updated>2024-06-03T00:00:00+05:30</updated><id>http://localhost:4000/gsoc2024-Pankaj_Borade/code-w1</id><content type="html" xml:base="http://localhost:4000/gsoc2024-Pankaj_Borade/coding-week1/"><![CDATA[<p>From here onwards Coding period begins, During the Monday meeting, mentors discussed the blocks in VisualCircuit resources and initial tests with GitHub Actions. Additionally, I had some doubts about the VC resources repository, which were clarified by the mentors.</p>

<h2 id="goals">Goals</h2>
<ul class="task-list">
Expand Down
Loading

0 comments on commit 7cece80

Please sign in to comment.