Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC31_Control Relays through GPIO socket on Nano and Pi #40

Merged
merged 265 commits into from
Oct 17, 2024

Conversation

Ahelsamahy
Copy link
Collaborator

In this update, we have redesigned the control box to a smaller size by removing the 2 four-channel relays previously connected to the PI and Nano, which were placed underneath. The functionality of these relays is now managed using the GPIO pins of each microcomputer. However, as there are still some existing boxes that utilize the old relay setup, a new settings menu has been added. This menu allows users to select the appropriate configuration based on their setup, ensuring compatibility and smooth operation regardless of the hardware version in use.

Changes:

  • Added a settings menu to the user interface for relay selection.
  • Implemented logic to detect and switch between old relay setups and GPIO-based control.
  • Updated documentation to guide users on configuring the settings menu.

Ahelsamahy and others added 30 commits July 23, 2024 11:27
I had to remove the loaded elements js action (as the elements will be all loaded ones the page is called in AJAX call) will work on proofing the code by removing extra conditions and work on the navigation for each nav in the hamburger menu
To be able to change the css styles directly from a `.css` file rather than from `.js`
The contents for mobile controller will be displayed in the middle of screen. There is no need to navigate for the new page
There are more functions that can be added to displaying the data, but I will wait for the 45 UC doc. In the meantime, I will work on the basic layout.

Next step will be working on mobile controller layout
add icon for the navs and work on the animation for the closing toggle
for the new added user menus
I will try to ditch Pixi using and depend solely on vanilla JS and CSS. This code is just a base for the new movement.

I will start refactoring the code from JS side to remove the handlers for function buttons (as they are now in hamburger menu)
It is just a start for the UI. will need to implement more buttons state and the backend for the ball movement
there is no need to draw the shapes with pixi and to have files for triangles and dots. I did override it with vanilla js and css
It needs more code refactoring, but I'm doing the base for now and will do the  refactoring later
It has been bugging me that when i select something on the normal UI, the distance meters on screen, gets highlighted also. This needed to be in its own commit
Thanks Ahmed, you are the best
Added two buttons, changed font, edited fieldset styling, added image to screen (not yet perfected)
plus extra changes in the styles. I will change the implementation of tail following a ball, to have an anchor point to show where the ball was
can now detect if the ball goes from one square to the other, while on touch. I'm trying to push the mouse controls, but there are some problems with it
smoothing isn't working. It was done by Orestis. I will need to check it and probably change in it to accommodate for the changes in mc js
as I added the utils/ssh.py fiel that would get the ssid from the router using ssh and not through terminal command. Will need to refactor this part to save it in the config.ini file then read the data from it. This is a new thing not related to the code now
The idea is to have a streamlined code for index.js that is imported only from index.html. the mc js files should be only one file that is included from index.js (or mc html page) but is always loaded and gets the element only when the page is loaded. Why not just import the file when the mobile controller page is loaded? because there are elements on both mc and nc that needs to be manipulated by mc js and if i import mc js only in mc html, then it will limit the js file to manipulate DOM elements of mc html only.

The code for nc page is written in mixed language of jQuery and js so I need to control on what page to pull the look for elements and where not to
These markers were made on the screen based on the type of the used vehicle. right now, we are only using rover one.
Still, there isn't a stream
the mobile now is using the same socket that the normal ui is using it
I gave priority for the mobile controller to send the commands if they are the active. Will need to implement take over mobile controller in the future
page button for the logbox still missing
as all the commands are now sent through the ctl endpoint
As the mobile controller was always the one in control. I made it here that the second user is always in control.
the second user would be another device
will work on the buttons and their functions
I wasn't planning to start the process of common folder shared between the services here. This is just for now.

I decided to make a new docker image because the existing one was running python 3.5, which i couldn't do string interpolation in it. As far as i know, this was the only service (on both nano and pi) that had python version older than 3.7.

I don't know why it was using debian instead of ubuntu, but I think it was made on early implementation when the GPIO pins on the pi were being used (you can see on the archived folder).

The current change with the BYODR_UTILS folder will be removed, and i will use this one as the base for other nano and when I implement the common folder CLI shell script
it turns out that the installation coded the current firmware of the vescs in pyvesc while installing it. I don't know how it would get the firmware of a connected USB before it even starts the pi to see what is connected to it. Instead of trying to adopt my solution to work with the new implementation of set Duty cycle, I decided to go back to the old solution. I tried to change and fetch the firmware from inside, but couldn't do it. I won't waste more time on it. Maybe i will return later for it
Will move it inside the nano folder
I explained what the file does in the pr
I was trying to push a new image on the pi, after changing the directories. I image couldn't build and showed that all the system dependencies links are not reachable.

I went into the base image (from mmastrac) and found out that it is 4 years old and the encoding used in it is deprecated by raspi official github repo. I decided to create a new one from the bottom up with an upgraded python version (3.9) and upgraded debian release (I left the option to use an older release)

I will wrap this docker image later into a build image on mwlvdev account
After changing the entry point as I have made in the docker image
I would upload while i'm running local mode, which would upload the whole utils folder, this wouldn't have an impact as I would remove it later, but it is annoying to be there
@Ahelsamahy
Copy link
Collaborator Author

I have upgraded the docker images for the following services:

  • stream in pi and now it is using a better encoder V4L2 than the old one OMX. Also a higher python version of 3.9
  • servos in pi with python version of 3.9

The reason for having the new docker images for the pi services is that the builds that were made on centipede2donald docker hub, they had the common folder inside the builds. That means that the pi docker images, were using a common folder that was made at least 2 years ago. Through the process of working on the nano and adding new service (FOL), we have added more functions to the common folder, which needs to be also existing on the pi

MWLCDev
MWLCDev previously approved these changes Oct 17, 2024
@Ahelsamahy Ahelsamahy dismissed MWLCDev’s stale review October 17, 2024 07:49

The merge-base changed after approval.

@Ahelsamahy Ahelsamahy self-assigned this Oct 17, 2024
MWLCDev
MWLCDev previously approved these changes Oct 17, 2024
@Ahelsamahy Ahelsamahy merged commit 0212c78 into master Oct 17, 2024
4 checks passed
@Ahelsamahy Ahelsamahy dismissed MWLCDev’s stale review October 17, 2024 07:55

The merge-base changed after approval.

@Ahelsamahy Ahelsamahy deleted the RFC31_RealyControlGPIO branch October 17, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants