diff --git a/compose-files/fit-demo/docker-compose.yml b/compose-files/fit-demo/docker-compose.yml index 399c7911..1697b55c 100644 --- a/compose-files/fit-demo/docker-compose.yml +++ b/compose-files/fit-demo/docker-compose.yml @@ -1,6 +1,6 @@ services: fit-demo-arserver: - image: arcor2/arcor2_arserver:1.3.0 + image: arcor2/arcor2_arserver:1.3.1 container_name: fit-demo-arserver depends_on: fit-demo-project: diff --git a/compose-files/ur-demo/docker-compose.yml b/compose-files/ur-demo/docker-compose.yml index b8de9f80..d58482b9 100644 --- a/compose-files/ur-demo/docker-compose.yml +++ b/compose-files/ur-demo/docker-compose.yml @@ -15,7 +15,7 @@ services: memlock: 8428281856 # network_mode: host ur-demo-arserver: - image: arcor2/arcor2_arserver:1.3.0 + image: arcor2/arcor2_arserver:1.3.1 container_name: ur-demo-arserver depends_on: ur-demo-project: diff --git a/src/docker/arcor2_arserver/BUILD b/src/docker/arcor2_arserver/BUILD index 6f6566dc..b2fde689 100644 --- a/src/docker/arcor2_arserver/BUILD +++ b/src/docker/arcor2_arserver/BUILD @@ -1,5 +1,5 @@ shell_source(name="start.sh", source="start.sh") docker_image( - name="arcor2_arserver", repository="arcor2/arcor2_arserver", dependencies=[":start.sh"], image_tags=["1.3.0"] + name="arcor2_arserver", repository="arcor2/arcor2_arserver", dependencies=[":start.sh"], image_tags=["1.3.1"] ) diff --git a/src/docker/arcor2_arserver/Dockerfile b/src/docker/arcor2_arserver/Dockerfile index cfc41a60..ed13fe27 100644 --- a/src/docker/arcor2_arserver/Dockerfile +++ b/src/docker/arcor2_arserver/Dockerfile @@ -1,15 +1,15 @@ FROM python:3.11.10-bookworm as deps COPY src.python.arcor2_arserver.scripts/arserver.pex /binary.pex -RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python /binary.pex venv --scope=deps --compile /bin/app +RUN PEX_TOOLS=1 /usr/local/bin/python /binary.pex venv --scope=deps --compile /bin/app FROM python:3.11.10-bookworm as srcs COPY src.python.arcor2_arserver.scripts/arserver.pex /binary.pex -RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python /binary.pex venv --scope=srcs --compile /bin/app +RUN PEX_TOOLS=1 /usr/local/bin/python /binary.pex venv --scope=srcs --compile /bin/app FROM python:3.11.10-bookworm RUN apt-get update \ - && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u2 \ + && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u3 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/src/docker/arcor2_arserver/start.sh b/src/docker/arcor2_arserver/start.sh index 73501ddd..55cb109d 100755 --- a/src/docker/arcor2_arserver/start.sh +++ b/src/docker/arcor2_arserver/start.sh @@ -2,4 +2,4 @@ mkdir -p "${ARCOR2_AREDITOR_LOGS_FOLDER:-/root/logs}" python3 -m uploadserver --directory "${ARCOR2_AREDITOR_LOGS_FOLDER:-/root/logs}" 6799 & -/bin/app/pex +PYTHONOPTIMIZE=1 /bin/app/pex diff --git a/src/docker/arcor2_build/Dockerfile b/src/docker/arcor2_build/Dockerfile index 13282c0d..e652e3ab 100644 --- a/src/docker/arcor2_build/Dockerfile +++ b/src/docker/arcor2_build/Dockerfile @@ -10,7 +10,7 @@ FROM python:3.11.10-bookworm # curl is for healthcheck RUN apt-get update \ - && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u2 curl=7.88.1-10+deb12u5 \ + && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u3 curl=7.88.1-10+deb12u5 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/src/docker/arcor2_calibration/Dockerfile b/src/docker/arcor2_calibration/Dockerfile index 4073cb03..05ce0f16 100644 --- a/src/docker/arcor2_calibration/Dockerfile +++ b/src/docker/arcor2_calibration/Dockerfile @@ -11,7 +11,7 @@ FROM python:3.11.10-bookworm # libgomp1 and libusb-1.0-0 are because of Open3D # curl is for healthcheck RUN apt-get update \ - && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u2 libgomp1=12.2.0-14 libusb-1.0-0=2:1.0.26-1 curl=7.88.1-10+deb12u5 \ + && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u3 libgomp1=12.2.0-14 libusb-1.0-0=2:1.0.26-1 curl=7.88.1-10+deb12u5 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/src/docker/arcor2_dobot/Dockerfile b/src/docker/arcor2_dobot/Dockerfile index eca31f63..3824c1ed 100644 --- a/src/docker/arcor2_dobot/Dockerfile +++ b/src/docker/arcor2_dobot/Dockerfile @@ -10,7 +10,7 @@ FROM python:3.11.10-bookworm # curl is for healthcheck RUN apt-get update \ - && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u2 libgomp1=12.2.0-14 libusb-1.0-0=2:1.0.26-1 curl=7.88.1-10+deb12u5 \ + && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u3 libgomp1=12.2.0-14 libusb-1.0-0=2:1.0.26-1 curl=7.88.1-10+deb12u5 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/src/docker/arcor2_execution/Dockerfile b/src/docker/arcor2_execution/Dockerfile index 751bebbe..0a47cbc8 100644 --- a/src/docker/arcor2_execution/Dockerfile +++ b/src/docker/arcor2_execution/Dockerfile @@ -9,7 +9,7 @@ RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python /binary.pex venv --scope= FROM python:3.11.10-bookworm RUN apt-get update \ - && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u2 \ + && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u3 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/src/docker/arcor2_scene/Dockerfile b/src/docker/arcor2_scene/Dockerfile index 0f8437e4..e184a9c3 100644 --- a/src/docker/arcor2_scene/Dockerfile +++ b/src/docker/arcor2_scene/Dockerfile @@ -11,7 +11,7 @@ FROM python:3.11.10-bookworm # libgomp1 and libusb-1.0-0 are because of Open3D # curl is for healthcheck RUN apt-get update \ - && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u2 libgomp1=12.2.0-14 libusb-1.0-0=2:1.0.26-1 curl=7.88.1-10+deb12u5 \ + && apt-get install -y -q --no-install-recommends libgl1-mesa-glx=22.3.6-1+deb12u1 libglib2.0-0=2.74.6-2+deb12u3 libgomp1=12.2.0-14 libusb-1.0-0=2:1.0.26-1 curl=7.88.1-10+deb12u5 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/src/python/arcor2/cached.py b/src/python/arcor2/cached.py index a8a0ab83..1edf223b 100644 --- a/src/python/arcor2/cached.py +++ b/src/python/arcor2/cached.py @@ -674,6 +674,8 @@ def remove_joints(self, joints_id: str) -> cmn.ProjectRobotJoints: def upsert_action_point( self, ap_id: str, name: str, position: cmn.Position, parent: None | str = None ) -> cmn.BareActionPoint: + assert parent != "" + try: ap = self.bare_action_point(ap_id) ap.name = name diff --git a/src/python/arcor2_arserver/CHANGELOG.md b/src/python/arcor2_arserver/CHANGELOG.md index 6e6a543b..a0857f93 100644 --- a/src/python/arcor2_arserver/CHANGELOG.md +++ b/src/python/arcor2_arserver/CHANGELOG.md @@ -2,6 +2,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +## [1.3.1] - 2024-10-23 + +### Fixed + +- Handling of useless changes in `UpdateActionPointParent`. + ## [1.3.0] - 2024-09-12 ### Changed diff --git a/src/python/arcor2_arserver/VERSION b/src/python/arcor2_arserver/VERSION index 589268e6..6261a05b 100644 --- a/src/python/arcor2_arserver/VERSION +++ b/src/python/arcor2_arserver/VERSION @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.3.1 \ No newline at end of file diff --git a/src/python/arcor2_arserver/rpc/project.py b/src/python/arcor2_arserver/rpc/project.py index fceaa66f..4e54b56e 100644 --- a/src/python/arcor2_arserver/rpc/project.py +++ b/src/python/arcor2_arserver/rpc/project.py @@ -447,7 +447,8 @@ async def update_action_point_parent_cb(req: srpc.p.UpdateActionPointParent.Requ ap = proj.bare_action_point(req.args.action_point_id) # some super basic checks (not involving other objects) are performed before locking anything - if req.args.new_parent_id == ap.parent: + if req.args.new_parent_id == ("" if ap.parent is None else ap.parent): + logger.warn(f"Attempted useless update of parent from {ap.parent} to {req.args.new_parent_id} on AP {ap.name}.") return None if req.args.new_parent_id == ap.id: @@ -473,10 +474,12 @@ async def update_action_point_parent_cb(req: srpc.p.UpdateActionPointParent.Requ if not ap.parent and req.args.new_parent_id: # AP position and all orientations will become relative to the parent updated_aps = tr.make_global_ap_relative(scene, proj, ap, req.args.new_parent_id) + assert ap.parent == req.args.new_parent_id elif ap.parent and not req.args.new_parent_id: # AP position and all orientations will become absolute updated_aps = tr.make_relative_ap_global(scene, proj, ap) + assert ap.parent is None else: assert ap.parent # AP position and all orientations will become relative to another parent @@ -867,6 +870,11 @@ async def add_action_point_cb(req: srpc.p.AddActionPoint.Request, ui: WsClient) scene = glob.LOCK.scene_or_exception() proj = glob.LOCK.project_or_exception() + # TODO workaround for issue with parent + # best solution would be probably to make it non-optional everywhere + if req.args.parent == "": + req.args.parent = None + async with ctx_write_lock(glob.LOCK.SpecialValues.PROJECT, glob.USERS.user_name(ui)): hlp.is_valid_identifier(req.args.name) unique_name(req.args.name, proj.action_points_names) diff --git a/src/python/arcor2_arserver/tests/test_project_ap.py b/src/python/arcor2_arserver/tests/test_project_ap.py index 45acd8a2..14602f0f 100644 --- a/src/python/arcor2_arserver/tests/test_project_ap.py +++ b/src/python/arcor2_arserver/tests/test_project_ap.py @@ -70,6 +70,48 @@ def test_project_ap_rpcs(start_processes: None, ars: ARServer) -> None: child_ap_evt = event(ars, events.p.ActionPointChanged) assert child_ap_evt.data.parent == parent_ap_evt.data.id + assert ars.call_rpc( + rpc.p.UpdateActionPointParent.Request( + get_id(), rpc.p.UpdateActionPointParent.Request.Args(child_ap_evt.data.id, parent_ap_evt.data.id) + ), + rpc.p.UpdateActionPointParent.Response, + ).result + + lock_object(ars, child_ap_evt.data.id) + + assert ars.call_rpc( + rpc.p.UpdateActionPointParent.Request( + get_id(), rpc.p.UpdateActionPointParent.Request.Args(child_ap_evt.data.id, "") + ), + rpc.p.UpdateActionPointParent.Response, + ).result + + update_ap_parent_evt = event(ars, events.p.ActionPointChanged) + assert update_ap_parent_evt.data.parent is None + + event(ars, events.lk.ObjectsUnlocked) + + assert ars.call_rpc( + rpc.p.UpdateActionPointParent.Request( + get_id(), rpc.p.UpdateActionPointParent.Request.Args(child_ap_evt.data.id, "") + ), + rpc.p.UpdateActionPointParent.Response, + ).result + + lock_object(ars, child_ap_evt.data.id) + + assert ars.call_rpc( + rpc.p.UpdateActionPointParent.Request( + get_id(), rpc.p.UpdateActionPointParent.Request.Args(child_ap_evt.data.id, parent_ap_evt.data.id) + ), + rpc.p.UpdateActionPointParent.Response, + ).result + + update_ap_parent_evt = event(ars, events.p.ActionPointChanged) + assert update_ap_parent_evt.data.parent == parent_ap_evt.data.id + + event(ars, events.lk.ObjectsUnlocked) + lock_object(ars, child_ap_evt.data.id) assert ars.call_rpc(