Skip to content

Commit

Permalink
Merge remote-tracking branch 'pycram/dev' into costmaps
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/pycram-ci.yml
tomsch420 committed Mar 26, 2024
2 parents 6b23750 + b3bba13 commit 0b42af9
Showing 6 changed files with 137 additions and 128 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/new-pycram-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: pycram_docker_ci
defaults:
run:
shell: bash -ieo pipefail {0}

on:
push:
branches:
- dev
- master
pull_request:
branches:
- master
- dev
workflow_dispatch: # For manual debugging
inputs:
debug_enabled:
type: boolean
required: false
default: false
description: "Run tmate session"

jobs:
build_and_run_tests:
runs-on: ubuntu-20.04
container:
image: "pycram/pycram:dev"
steps:
- name: Checkout PyCRAM
uses: actions/checkout@v3
with:
path: "ros/src/pycram"
repository: ${{ github.repository }}
ref: ${{ github.ref }}
submodules: "recursive"

# For debugging
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Update PyCRAM source files
run: |
rm -rf /opt/ros/overlay_ws/src/pycram/*
cd /opt/ros/overlay_ws/src/pycram
rm -rf .git .github .gitignore .gitmodules .readthedocs.yaml
mv /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ros/src/pycram /opt/ros/overlay_ws/src
- name: Remake workspace & start roscore
run: |
sudo -s
source /opt/ros/noetic/setup.bash
cd /opt/ros/overlay_ws
catkin_make
source /opt/ros/overlay_ws/devel/setup.bash
roslaunch pycram ik_and_description.launch &
- name: Install python dependencies
run: |
pip3 install --upgrade pip --root-user-action=ignore
cd /opt/ros/overlay_ws/src/pycram
pip3 install -r requirements.txt
- name: Install pytest, pyjpt & mlflow
run: |
pip3 install --ignore-installed pytest pyjpt mlflow
- name: Run tests
run: |
source /opt/ros/overlay_ws/devel/setup.bash
roscd pycram
pytest -v test
89 changes: 0 additions & 89 deletions .github/workflows/pycram-ci.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/update-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: update_docker_image
on:
push:
branches:
- master
- dev
paths:
- 'requirements.txt'
# only run when a commit has changes in the requirements.txt file

jobs:
build_and_push_docker_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: log into Docker Hub #Set repository secrets in github secrets
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./docker
push: true
tags: ${{ vars.DOCKER_IMAGE }}
21 changes: 21 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG FROM_IMAGE=ros:noetic-ros-core
ARG OVERLAY_WS=/opt/ros/overlay_ws

FROM $FROM_IMAGE as cacher
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS/src

RUN apt-get update && apt-get install python3-pip python3-vcstool git -y && pip3 install pip --upgrade
RUN pip3 install rosdep && rosdep init

RUN vcs import --input https://raw.githubusercontent.com/cram2/pycram/dev/pycram-https.rosinstall --recursive --skip-existing $OVERLAY_WS/src
RUN rosdep update && rosdep install --from-paths $OVERLAY_WS/src --ignore-src -r -y

RUN . /opt/ros/noetic/setup.sh && cd $OVERLAY_WS && catkin_make
RUN echo "source $OVERLAY_WS/devel/setup.bash" >> ~/.bashrc

RUN pip3 install --upgrade pip
WORKDIR $OVERLAY_WS/src/pycram
RUN pip3 install -r requirements.txt

EXPOSE 11311
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -15,3 +15,4 @@ SQLAlchemy>=2.0.9
tqdm==4.66.1
psutil==5.9.7
lxml==4.9.1
typing_extensions==4.9.0
51 changes: 12 additions & 39 deletions src/pycram/designators/actions/actions.py
Original file line number Diff line number Diff line change
@@ -40,13 +40,19 @@ class ActionAbstract(ActionDesignatorDescription.Action, abc.ABC):
@abc.abstractmethod
def perform(self) -> None:
"""
Perform the action. Will be overwritten by each action.
Perform the action.
Will be overwritten by each action.
"""
pass

def to_sql(self) -> Action:
"""
Convert this action to its ORM equivalent. Will be overwritten by each action.
Convert this action to its ORM equivalent.
Needs to be overwritten by an action if it didn't overwrite the orm_class attribute with its ORM equivalent.
:return: An instance of the ORM equivalent of the action with the parameters set
"""
# get all class parameters (ignore inherited ones)
class_variables = {key: value for key, value in vars(self).items()
@@ -66,9 +72,12 @@ def insert(self, session: Session, **kwargs) -> Action:
"""
Insert this action into the database.
Needs to be overwritten by an action if the action has attributes that do not exist in the orm class
equivalent. In that case, the attributes need to be inserted into the session manually.
:param session: Session with a database that is used to add and commit the objects
:param kwargs: Possible extra keyword arguments
:return: The completely instanced ORM object
:return: The completely instanced ORM action that was inserted into the database
"""

action = super().insert(session)
@@ -105,9 +114,6 @@ class MoveTorsoActionPerformable(ActionAbstract):
Target position of the torso joint
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMMoveTorsoAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -129,9 +135,6 @@ class SetGripperActionPerformable(ActionAbstract):
The motion that should be set on the gripper
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMSetGripperAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -182,9 +185,6 @@ class ParkArmsActionPerformable(ActionAbstract):
Entry from the enum for which arm should be parked
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMParkArmsAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -233,9 +233,6 @@ class PickUpActionPerformable(ActionAbstract):
not updated when the BulletWorld object is changed.
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMPickUpAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -323,9 +320,6 @@ class PlaceActionPerformable(ActionAbstract):
Pose in the world at which the object should be placed
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMPlaceAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -359,9 +353,6 @@ class NavigateActionPerformable(ActionAbstract):
Location to which the robot should be navigated
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMNavigateAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -387,9 +378,6 @@ class TransportActionPerformable(ActionAbstract):
Target Location to which the object should be transported
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMTransportAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -432,9 +420,6 @@ class LookAtActionPerformable(ActionAbstract):
Position at which the robot should look, given as 6D pose
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMLookAtAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -452,9 +437,6 @@ class DetectActionPerformable(ActionAbstract):
Object designator loosely describing the object, e.g. only type.
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMDetectAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -476,9 +458,6 @@ class OpenActionPerformable(ActionAbstract):
Arm that should be used for opening the container
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMOpenAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -503,9 +482,6 @@ class CloseActionPerformable(ActionAbstract):
Arm that should be used for closing
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMCloseAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:
@@ -530,9 +506,6 @@ class GraspingActionPerformable(ActionAbstract):
Object Designator for the object that should be grasped
"""
orm_class: Type[ActionAbstract] = field(init=False, default=ORMGraspingAction)
"""
The ORM class that is used to insert this action into the database
"""

@with_tree
def perform(self) -> None:

0 comments on commit 0b42af9

Please sign in to comment.