Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Javinator9889 committed Jun 24, 2021
2 parents 384de72 + db551e8 commit 36ff54a
Show file tree
Hide file tree
Showing 15 changed files with 311 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,5 @@ fabric.properties
*.gz

build.sh
AppDir
appimage-builder-cache/
82 changes: 82 additions & 0 deletions AppImageBuilder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: 1
script:
# Remove any previous build
- rm -rf AppDir | true
# Make usr and icons dirs
- mkdir -p AppDir/usr/{share/{applications/icons},src}
# Copy the python application code into the AppDir
- cp app.py AppDir/usr/src -r
- cp pArm/ AppDir/usr/src/ -r
- cp robot-arm.svg AppDir/usr/share/icons
- cp es.upm.etsisi.parm.desktop AppDir/usr/share/applications
# Install application dependencies
- python3 -m pip install --ignore-installed --prefix=/usr --root=AppDir -r ./requirements.txt


AppDir:
path: ./AppDir

app_info:
id: es.upm.etsisi.parm
name: pArm
icon: utilities-terminal
version: 1.0.0
# Set the python executable as entry point
exec: usr/bin/python3
# Set the application main script path as argument. Use '$@' to forward CLI parameters
exec_args: "$APPDIR/usr/src/app.py $@"

apt:
arch: amd64
sources:
- sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse'
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32'

include:
- python3
- python3-pyqt5
- python3-pkg-resources
- qt5-default
- libfreetype6
- libfontconfig1
exclude: []

runtime:
version: "continuous"
env:
PATH: '${APPDIR}/usr/bin:${PATH}'
# Set python home
# See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME
PYTHONHOME: '${APPDIR}/usr'
# Path to the site-packages dir or other modules dirs
# See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH
PYTHONPATH: '${APPDIR}/usr/lib/python3.8/site-packages'
# Qt5 LD library path
LD_LIBRARY_PATH: "${APPIMAGE_LIBRARY_PATH}:${APPDIR}/usr/lib:${APPDIR}/lib:${LD_LIBRARY_PATH}"

test:
fedora:
image: appimagecrafters/tests-env:fedora-30
command: ./AppRun
use_host_x: true
debian:
image: appimagecrafters/tests-env:debian-stable
command: ./AppRun
use_host_x: true
arch:
image: appimagecrafters/tests-env:archlinux-latest
command: ./AppRun
use_host_x: true
centos:
image: appimagecrafters/tests-env:centos-7
command: ./AppRun
use_host_x: true
ubuntu:
image: appimagecrafters/tests-env:ubuntu-xenial
command: ./AppRun
use_host_x: true

AppImage:
update-information: 'gh-releases-zsync|AppImageCrafters|python-appimage-example|latest|python-appimage-*x86_64.AppImage.zsync'
sign-key: None
arch: x86_64
11 changes: 11 additions & 0 deletions es.upm.etsisi.parm.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=pArm
Comment=Centro de control del pArm
Icon=robot-arm.svg
Exec=pArm %F
Terminal=false
Categories=Application;Development;
Keywords=Python;Editor;microbit;micro:bit;
StartupWMClass=mu
MimeType=text/x-python3;text/x-python3;
Binary file added pArm-1.0.0-x86_64.AppImage
Binary file not shown.
Binary file added pArm-1.0.0-x86_64.AppImage.zsync
Binary file not shown.
Binary file added pArm.ico.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions pArm/GUI/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
def inverse_kinematics(x_coord, y_coord, z_coord):
"""
This function performs the calculations related to inverse
kinematic model, which are used to graphically draw the
kinematic model, which are used to graphically draw the
position of the arm on the GUI.
:params x, y, z coord: Cartesian coordinates of the point to which
:params x, y, z coord: Cartesian coordinates of the point to which
inverse kinematics is applied.
"""
try:
Expand Down Expand Up @@ -121,8 +121,8 @@ def __init__(self, control: ControlInterface):
qt_logger = QTextEditLogger(edit_text=self.logger_box)
add_handler(qt_logger,
logger_name="Roger",
level=logging.INFO,
log_format="%(asctime)s | [%(""levelname)s]: %(message)s")
level=logging.INFO)
# log_format="%(asctime)s | [%(""levelname)s]: %(message)s")
self.log = logging.getLogger("Roger")

self.top_view = self.findChild(PlotWidget, 'TopView')
Expand Down Expand Up @@ -272,7 +272,7 @@ def top_view_mouse_control(self, event):
update the graphical representation of the arm, as well as the sliders's and
spinboxes's value.
:param event: Event generated when the user moves the mouse within
:param event: Event generated when the user moves the mouse within
the top view widget.
"""
if self.mouse_enabler:
Expand Down Expand Up @@ -303,7 +303,7 @@ def side_view_mouse_control(self, event):
update the graphical representation of the arm, as well as the sliders's and
spinboxes's value.
:param event: Event generated when the user moves the mouse within
:param event: Event generated when the user moves the mouse within
the side view widget.
"""
if self.mouse_enabler:
Expand Down Expand Up @@ -342,7 +342,7 @@ def disable_mouse_control(self, _):
def adjust_widget_value(self,type, sliders: QtWidgets.QSlider, spin_boxes: QtWidgets.QDoubleSpinBox,
graphics: QtWidgets.QGraphicsView, index: int, id):
"""
This method adjust the value of the spinboxes when the sliders are moved and viceversa.
This method adjust the value of the spinboxes when the sliders are moved and viceversa.
When this happens, the graphical representation of the arm is uptaded. This function is
called when a signal is emitted.
Expand Down Expand Up @@ -637,7 +637,7 @@ def draw_view_from_angle(self,
*args):
"""
This method perform the calculations need to draw the arm preview. This
calculations are made from the angles selected by the user and by using
calculations are made from the angles selected by the user and by using
the shortened direct kinematics model.
:param graphics: List of graphic views widgets.
Expand Down Expand Up @@ -731,7 +731,7 @@ def draw_view_from_cartesian(self,
*args):
"""
This method perform the calculations need to draw the arm preview. This
calculations are made from the cartesian coordinates selected by the user and by using
calculations are made from the cartesian coordinates selected by the user and by using
the inverse kinematics model
:param graphics: List of graphic views widgets.
Expand Down Expand Up @@ -842,7 +842,7 @@ def set_serial_port(self, port_id:QAction):
This method is used to set the serial port that is going to
be used to communicate the GUI app with the PCB. When the user
select a port in the GUI, this function is executed and
the port selected is passed to the logic communication code
the port selected is passed to the logic communication code
using the handler object.
Expand All @@ -858,7 +858,7 @@ def set_serial_port(self, port_id:QAction):

def future_callback(self, ft: Future, button: QtWidgets.QPushButton):
"""
This method is executed when the future object created in the
This method is executed when the future object created in the
execute movement process is finally returned, which means that
this method is a call back.
Expand Down
8 changes: 2 additions & 6 deletions pArm/GUI/progress_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,10 @@ def create_worker(self, time_object: AtomicFloat):
"""
thread = QtCore.QThread()
worker = Worker(time_object)
worker.update_progress.connect(
lambda progress: self.handle_progress(progress)
)
worker.update_progress.connect(self.handle_progress)
worker.moveToThread(thread)
thread.started.connect(worker.work)
worker.limit_values.connect(
lambda limits: self.handle_limits(limits)
)
worker.limit_values.connect(self.handle_limits)
worker.finished.connect(thread.quit)
QtCore.QMetaObject.connectSlotsByName(self)

Expand Down
8 changes: 5 additions & 3 deletions pArm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
import sys
from concurrent.futures import ThreadPoolExecutor

logging.basicConfig(level=logging.NOTSET)
# logging.basicConfig(level=logging.NOTSET)


def main():
try:
init_logging("Roger", log_file="p-Arm.log")
init_logging("Roger", log_file="p-Arm.log",
file_level=logging.WARN,
enable_console_logging=True)
app = QtWidgets.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon("yo.jpg"))
app.setWindowIcon(QtGui.QIcon("robot-arm.svg"))

executor = ThreadPoolExecutor()

Expand Down
22 changes: 4 additions & 18 deletions pArm/control/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,24 @@ def err_fn(self, fn: Callable[[int, str], None]):
@x.setter
def x(self, x):
# if LOWEST_X_VALUE <= x <= HIGHEST_X_VALUE:
if True:
self._x = x
else:
print("X value out of bounds")
self._x = x

@y.setter
def y(self, y):
# if LOWEST_Y_VALUE <= y <= HIGHEST_Y_VALUE:
if True:
self._y = y
else:
print("Y value out of bounds")
self._y = y

@z.setter
def z(self, z):
# if LOWEST_Z_VALUE <= z <= HIGHEST_Z_VALUE:
if True:
self._z = z
else:
print("Z value out of bounds")
self._z = z

@port.setter
def port(self, port):
self.connection.port = port

def move_to_xyz(self, x, y, z,
time_object: Optional[AtomicFloat] = None) -> \
Future:
time_object: Optional[AtomicFloat] = None) -> Future:
"""
Triggers the needed procedures to move the arm to the cartesian position
that is indicated in its parameters.
Expand Down Expand Up @@ -135,10 +125,6 @@ def move_to_thetas(self,
theta2_in_radians = theta2 * (pi/180)
theta3_in_radians = theta3 * (pi/180)

log.debug(theta1_in_radians)
log.debug(theta2_in_radians)
log.debug(theta3_in_radians)

byte_stream = generator.generate_theta_movement(theta1_in_radians,
theta2_in_radians,
theta3_in_radians)
Expand Down
3 changes: 2 additions & 1 deletion pArm/logger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from ..logger.logger import init_logging, add_handler
# from ..logger.logger import init_logging, add_handler
from .logger import init_logging, add_handler
from ..logger.PyQtHandler import QTextEditLogger

0 comments on commit 36ff54a

Please sign in to comment.