waypoints: reconstruir o pacote perdido como RECONSTRUCAO DECLARADA

O gitlink src/waypoints (sha 115553cfa8c2ace122414ac5a9b235cd2e225693) apontava
para codigo que nao existe em nenhum remoto conhecido (Gitea, GitHub, maquina,
web) e que o autor ja nao tem. O resultado era concreto: `rosrun waypoints
waypoints_server`, que guide.txt manda correr, nao resolvia num clone limpo, e a
unica saida honesta era reconstruir ou documentar a falta. O autor autorizou a
reconstrucao ("ja nao tenho waypoints, se conseguires criar um, agradecia"),
por isso o gitlink e substituido por conteudo dentro do repositorio
(`git rm --cached src/waypoints` + ficheiros commitados), escrito a partir das
pistas que sobreviveram:

  * guide.txt: nome do pacote (`waypoints`) e do executavel
    (`waypoints_server`), sem argumentos - o unico contrato documentado;
  * p3dx_navigation.rviz: as classes `waypoints/waypointPanel` (painel) e
    `waypoints/Waypoints` (ferramenta, `Topic: waypoint`) provam que o original
    tambem trazia plugins rviz em C++ e que o topico `waypoint` era usado.

O que fica e uma RECONSTRUCAO DECLARADA, nao o trabalho original: Python (o
autor pediu legibilidade, e um no C++ com interface adivinhada nao poderia ser
compilado nem testado aqui), um servidor de waypoints conservador
(`geometry_msgs/PoseStamped` em `waypoint` -> `geometry_msgs/PoseArray`
latched em `waypoints`), e um README dentro do pacote que diz o que e certo
(o nome do no), o que e inferido (topicos, tipos, parametros), que os plugins
rviz do original NAO foram reproduzidos e que quem reutilizar isto deve
confirmar o interface antes de confiar nele.

Os documentos passam a dizer isto: README.md (seccao do waypoints e linha da
tabela de licencas: GPLv3, como o resto do repo), tests/known-gaps.txt (a
lacuna deixa de ser o codigo e passa a ser o ORIGINAL, e o `darknet_ros` do
guide.txt continua por resolver) e tests/run.sh + tests/negative.sh (8
verificacoes novas, incluindo as negativas em copias mktemp: apagar o no,
tirar o package.xml, tirar o +x, renomear o no, estragar o Python, tirar a
declaracao e voltar a fazer gitlink). O .gitmodules nao muda: so `rosaria`
continua a ser submodulo, e como `waypoints` era o ultimo gitlink sem
mapeamento, `git submodule status` deixa de se queixar e o clone limpo deixa de
trazer um diretorio vazio.

O que isto NAO prova, e fica dito: nao houve ROS neste ambiente, portanto nao
houve catkin_make nem rosrun. So a estrutura, o nome do no e a sintaxe
(python3 -m py_compile) foram verificados.
This commit is contained in:
dsh
2026-10-08 16:58:17 +01:00
parent 0305718a67
commit 0148385266
9 changed files with 571 additions and 38 deletions
+43 -28
View File
@@ -16,7 +16,7 @@ vendored under `src/` keep their own licences:
| `urg_node`, `urg_c`, `laser_proc`, `rgbd_launch` | BSD | | `urg_node`, `urg_c`, `laser_proc`, `rgbd_launch` | BSD |
| `object_detection`, `p3dx_navigation`, `p3dx_slam` | not declared (`TODO` in `package.xml`) | | `object_detection`, `p3dx_navigation`, `p3dx_slam` | not declared (`TODO` in `package.xml`) |
| `rosaria` | **GPL-2.0-only** (declared in the upstream `package.xml`; the upstream repository has no licence file) | | `rosaria` | **GPL-2.0-only** (declared in the upstream `package.xml`; the upstream repository has no licence file) |
| `waypoints` | no content in any known remote — see above | | `waypoints` | GPL-3.0 (`GPLv3` in `package.xml`) — a **declared reconstruction**, not the original; see [`src/waypoints/README.md`](src/waypoints/README.md) |
MIT is not possible here: the GPL-3.0 package `p3dx_description` and the LGPL-3.0 MIT is not possible here: the GPL-3.0 package `p3dx_description` and the LGPL-3.0
`robot`/`estop` impose their own obligations on the combined work. `robot`/`estop` impose their own obligations on the combined work.
@@ -43,12 +43,15 @@ ignored by git so it will not be committed again.
## Submodules: a clean clone must bring code, not empty directories ## Submodules: a clean clone must bring code, not empty directories
`src/rosaria` and `src/waypoints` are recorded in this repository's history as `src/rosaria` and `src/waypoints` were both recorded in this repository's history as
**gitlinks** (index mode `160000`, i.e. submodule entries), not as plain **gitlinks** (index mode `160000`, i.e. submodule entries), not as plain
directories. A gitlink stores only a commit id — the code itself lives in another directories. A gitlink stores only a commit id — the code itself lives in another
repository. For a clone to bring that code, each gitlink needs a matching entry in repository. For a clone to bring that code, each gitlink needs a matching entry in
`.gitmodules`; without one, `git clone` simply creates an **empty directory**. `.gitmodules`; without one, `git clone` simply creates an **empty directory**.
Only `src/rosaria` is still a gitlink today. `src/waypoints` was replaced by in-tree
content written as a **declared reconstruction** of the lost original — see below.
That was the state of this repository until this fix, and it broke the build: That was the state of this repository until this fix, and it broke the build:
`src/robot/package.xml` declares `<depend>rosaria</depend>`, so while `src/rosaria` `src/robot/package.xml` declares `<depend>rosaria</depend>`, so while `src/rosaria`
was empty a clean clone could not be built. was empty a clean clone could not be built.
@@ -69,14 +72,16 @@ cd p3dx-catkin
git submodule update --init -- src/rosaria git submodule update --init -- src/rosaria
``` ```
**Note the `-- src/rosaria`.** The untargeted `git submodule update --init` still **Note the `-- src/rosaria`.** While `src/waypoints` was still a gitlink with no
aborts, because `src/waypoints` is a gitlink with no `.gitmodules` mapping and git `.gitmodules` mapping, the untargeted `git submodule update --init` aborted — git could
cannot resolve a URL for it. The same applies to a bare `git submodule status`. not resolve a URL for it — and the same happened to a bare `git submodule status`. That
Initialising by path works today and keeps working once `waypoints` is sorted out. is fixed: initialising by path still works, and the untargeted `git submodule update
--init` and `git submodule status` no longer complain, because every remaining gitlink
is declared.
### `src/waypoints` — origin NOT identified; the author must supply it ### `src/waypoints` — the original is LOST; what is there now is a declared reconstruction
`src/waypoints` points at commit `115553cfa8c2ace122414ac5a9b235cd2e225693`, but `src/waypoints` used to point at commit `115553cfa8c2ace122414ac5a9b235cd2e225693`, but
**that code does not exist in any remote that could be found** — this was checked, **that code does not exist in any remote that could be found** — this was checked,
not assumed. It is not: not assumed. It is not:
@@ -88,24 +93,25 @@ not assumed. It is not:
- on the web — the commit `115553c…` is not reachable from any candidate repository. - on the web — the commit `115553c…` is not reachable from any candidate repository.
Because the origin is unknown, **no `.gitmodules` entry was invented for it**: a Because the origin is unknown, **no `.gitmodules` entry was invented for it**: a
guessed URL would be worse than an honest gap. `tests/run.sh` reports it as a *known guessed URL would be worse than an honest gap. The author was asked, no longer has the
gap* and fails only if that list grows (see `tests/known-gaps.txt`). code, and authorised a reconstruction, so the gitlink was replaced by in-tree content
(`git rm --cached src/waypoints` plus the committed files) — the second of the two
honest ways out. That content is **a reconstruction, not the original work**:
The consequence is concrete: `guide.txt` tells you to run > **[`src/waypoints/README.md`](src/waypoints/README.md)** is the declaration. It names
`rosrun waypoints waypoints_server`, and in a clean clone that does **not** resolve, > the lost commit, says what is documented (`guide.txt` runs
because `src/waypoints` is empty. > `rosrun waypoints waypoints_server`, so the package name and the node name are
> certain) and what is inferred (every topic, message type and parameter), says why it
> is Python, and tells anyone who reuses it to confirm the interface before trusting it.
Only the author has this code, and there are two honest ways to close the gap. Both What is genuinely missing now is the **original** `waypoints` package — and with it the
are his call: rviz plugins that `p3dx_navigation.rviz` expects (`waypoints/waypointPanel`,
`waypoints/Waypoints`), which the reconstruction deliberately does not reproduce. The
1. **Create a repository for it** (Gitea is the natural home), push the package, then consequence is concrete: a clean clone now brings a real `src/waypoints/` directory
add the `[submodule "src/waypoints"]` section to `.gitmodules` with its path and instead of an empty one, so `rosrun waypoints waypoints_server` resolves structurally —
URL; or but the interface is a guess, and `p3dx_navigation.rviz` still reports the waypoint
2. **Bring the directory into this repository** — `git rm --cached src/waypoints` and panel and tool as unknown classes. If the original ever reappears, it should replace the
commit the real files, so the package is plain content and needs no submodule. reconstruction. Both gaps are recorded in [`tests/known-gaps.txt`](tests/known-gaps.txt).
Either way, once it is fixed, remove the `src/waypoints` line from
`tests/known-gaps.txt`: the suite reports the baseline as stale until you do.
## `guide.txt` also runs a package that is not in this workspace ## `guide.txt` also runs a package that is not in this workspace
@@ -132,12 +138,21 @@ the index has `package.xml` and `CMakeLists.txt`, that package names are present
unique, that `src/CMakeLists.txt` is catkin's toplevel symlink, that every gitlink is unique, that `src/CMakeLists.txt` is catkin's toplevel symlink, that every gitlink is
either declared in `.gitmodules` or a documented known gap, that `src/rosaria` either declared in `.gitmodules` or a documented known gap, that `src/rosaria`
resolves at the pinned commit, that the declared submodule URL is the verified one, resolves at the pinned commit, that the declared submodule URL is the verified one,
that every in-tree `<depend>` points at a package that exists, and that every known that every in-tree `<depend>` points at a package that exists, that every known gap is
gap is documented here. `tests/negative.sh` proves the suite has teeth by breaking one documented here, and (section 8) that the reconstructed `waypoints` package is
thing at a time in a throwaway copy. complete: no gitlink any more, a `package.xml` declaring `waypoints`, a `CMakeLists.txt`,
the node that `guide.txt` names present, executable and initialising itself under that
same name, its Python accepted by `python3 -m py_compile`, a README that declares it a
reconstruction and names the lost commit, and a `git submodule status` that no longer
fails. `tests/negative.sh` proves the suite has teeth by breaking one thing at a time in
a throwaway copy — including deleting the reconstructed node, taking its `package.xml`
away, making the node non-executable, renaming the node it initialises, corrupting its
Python, dropping the declaration, and committing the gitlink back.
They do **not** prove that the workspace builds — no ROS was available where they were They do **not** prove that the workspace builds — no ROS was available where they were
written, so `catkin_make` was never run. written, so `catkin_make` was never run — nor that the reconstructed `waypoints` node
does anything useful when it runs: only its structure, its node name and its syntax are
checked, and its topics are inferred (see [`src/waypoints/README.md`](src/waypoints/README.md)).
**On `rosaria`:** its upstream (`amor-ros-pkg/rosaria`) declares `GPLv2` with no "or later" **On `rosaria`:** its upstream (`amor-ros-pkg/rosaria`) declares `GPLv2` with no "or later"
clause, which is **incompatible with the GPL-3.0 of this repository** for a combined work. It is clause, which is **incompatible with the GPL-3.0 of this repository** for a combined work. It is
Submodule src/waypoints deleted from 115553cfa8
+23
View File
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.0.2)
project(waypoints)
## DECLARED RECONSTRUCTION - not the original package. See README.md.
##
## This package is Python only: one node, no libraries and no messages of its
## own, so the catkin side is just "install the script".
##
## Note what is deliberately NOT here: the rviz configuration used by
## p3dx_navigation references classes that the original package must have
## provided (waypoints/waypointPanel, waypoints/Waypoints), i.e. it built C++
## rviz plugins and exported a plugin description. Those plugins are not
## reproduced: inventing them would be an unverifiable guess, and rviz would
## fail to load them anyway. See README.md.
find_package(catkin REQUIRED)
catkin_package()
catkin_install_python(PROGRAMS
scripts/waypoints_server
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
+102
View File
@@ -0,0 +1,102 @@
# `waypoints` — a DECLARED RECONSTRUCTION
**This is not the original `waypoints` package.** The original is lost. What is
in this directory was written from the clues that survived in `p3dx-catkin`, on
the author's request ("já não tenho waypoints, se conseguires criar um,
agradecia, senão deixa estar. documenta em falta."). It says so here, in
`package.xml`, in `CMakeLists.txt` and in the node itself, so that nobody
mistakes it for the author's work. If the original ever turns up, it should
replace this directory.
## What is known — verified, with the evidence
1. **The original was a gitlink with no content anywhere.** This repository
recorded `src/waypoints` as index mode `160000` pointing at commit
**`115553cfa8c2ace122414ac5a9b235cd2e225693`**. That code does not exist in
any remote that could be found: not in the Gitea instance (`aneto/*`), not in
the author's GitHub account, not on the machine the check was run on, and not
on the web — the commit is not reachable from any candidate repository. The
author no longer has it. So the *original* is the thing that is missing now.
2. **Package name and node name** come from `guide.txt`, the only documented
interface:
```sh
source devel/setup.bash && rosrun waypoints waypoints_server
```
That gives, with certainty: the package is named `waypoints`, the executable
is named `waypoints_server`, and it is run with **no arguments**.
3. **There was a C++ rviz plugin side.** The rviz configuration that
`p3dx_navigation` loads (`src/p3dx_navigation/rviz/p3dx_navigation.rviz`)
references classes only this package could have provided:
- a panel: `Class: waypoints/waypointPanel`
- a tool: `Class: waypoints/Waypoints`, with `Topic: waypoint`
That is evidence that the original package built rviz plugins (rviz plugins
are C++) and that the topic name `waypoint` was in use.
## What is inferred — NOT verified
Everything about how the node actually talks is a guess. Where the guess is
anchored in a clue above, it says so.
| item | value here | why |
|---|---|---|
| language of the node | Python | the rviz classes prove C++ *plugins*, not a C++ *node*; see below |
| input topic | `waypoint` | the name the rviz tool publishes on — the only topic-name evidence in the repo |
| input type | `geometry_msgs/PoseStamped` | one pose per clicked point; the tool could just as well have sent a `PoseArray` |
| output topic | `waypoints` | the plural of the evidenced name; **not** evidenced |
| output type | `geometry_msgs/PoseArray` | the conventional "list of poses" message |
| latched output, `~publish_rate` 1 Hz | | a list that a late subscriber still needs |
| behaviour | append each incoming pose to a list; re-publish the whole list | the smallest thing that makes it a *server of waypoints* |
| parameters | `~frame_id` (`map`), `~input_topic`, `~output_topic`, `~publish_rate`, `~waypoints` | ROS convention, and useful for testing without rviz |
Nothing here was recovered from the original. No service, no action, no goal
dispatched to `move_base`, no message type and no rviz plugin of the original is
reproduced, because none of them is evidenced. In particular, **the rviz plugin
gap is not closed**: open `p3dx_navigation.rviz` without the original package and
rviz still reports `waypoints/Waypoints` / `waypoints/waypointPanel` as unknown
classes.
## Why Python, when the clues point at C++
The `waypoints/*` rviz classes prove the original built **C++ plugins**, but they
say nothing about the language of the node `waypoints_server`. The only surviving
part of the node's contract is `rosrun waypoints waypoints_server`: `rosrun`
selects an executable by *name*, and a Python script with that name satisfies it
exactly. Python is also the only part of this that can be checked in the
environment where it was written (`python3 -m py_compile` — there is no ROS and
no compiler toolchain there): a C++ node whose interface is a guess could not be
compiled or tested, so it would only be a more expensive guess. If the author or
the original plugins ever point at C++, `scripts/waypoints_server` is short
enough to rewrite.
## Before you rely on this
**Confirm the interface first.** Do not treat `waypoint` / `waypoints` as a
contract: ask the author, or use the original if it reappears, before pointing
another package at these topics. `tests/run.sh` only checks that this package is
structurally complete and that the node name matches what `guide.txt` runs; it
cannot check the interface, because no ROS was available where it was written.
## Running it (as reconstructed)
```sh
source devel/setup.bash
rosrun waypoints waypoints_server
```
Then, from another shell:
```sh
rostopic pub -1 /waypoint geometry_msgs/PoseStamped \
'{header: {frame_id: map}, pose: {position: {x: 1.0, y: 0.0}}}'
rostopic echo /waypoints
```
## Licence
GPL-3.0, like the rest of this repository (Copyright (C) 2024 André Neto) — see
[`../../LICENSE`](../../LICENSE). This directory makes no copyright claim over
the lost original; it is a reconstruction that declares itself.
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<package format="2">
<!--
DECLARED RECONSTRUCTION - this is NOT the original `waypoints` package.
The original was recorded in p3dx-catkin as a gitlink (index mode 160000)
pointing at commit 115553cfa8c2ace122414ac5a9b235cd2e225693, and that code
does not exist in any remote that could be found. What is in this directory
was written from the clues that survived in the repository. Read README.md
here before relying on the interface: only the package name and the node
name are documented; the rest is inferred.
-->
<name>waypoints</name>
<version>0.0.1</version>
<description>
Simple waypoint list server for the P3DX (Pioneer 3-DX) workspace: it keeps a
list of 2-D waypoints and publishes it as a geometry_msgs/PoseArray.
THIS PACKAGE IS A RECONSTRUCTION, NOT THE ORIGINAL WORK. The original
`waypoints` package was lost (the gitlink pointed at commit
115553cfa8c2ace122414ac5a9b235cd2e225693, which is not in any known remote).
See README.md in this package for what is known, what is inferred and what
is still missing.
</description>
<!-- Taken from this repository's git history; correct it if it is wrong. -->
<maintainer email="mail.me@ags-neto.com">Andre Neto</maintainer>
<license>GPLv3</license>
<author email="mail.me@ags-neto.com">Andre Neto</author>
<!-- Only what scripts/waypoints_server actually imports. -->
<buildtool_depend>catkin</buildtool_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<export>
</export>
</package>
+133
View File
@@ -0,0 +1,133 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# waypoints_server - keep a list of 2-D waypoints and publish it as a PoseArray.
#
# Copyright (C) 2024 Andre Neto
# SPDX-License-Identifier: GPL-3.0-only
#
# Part of the p3dx-catkin workspace, licensed GPL-3.0; see ../../LICENSE.
#
# RECONSTRUCTION, NOT THE ORIGINAL. The original `waypoints` package was lost
# (gitlink commit 115553cfa8c2ace122414ac5a9b235cd2e225693, absent from every
# known remote). Only the node name below is documented - guide.txt runs
# `rosrun waypoints waypoints_server`. Every topic name, message type and
# parameter is inferred. Read README.md next to this file before depending on
# the interface.
"""waypoints_server: append incoming poses to a list and publish the list.
Interface (inferred except the node name; see README.md):
subscribes ~input_topic (default "waypoint") geometry_msgs/PoseStamped
publishes ~output_topic (default "waypoints") geometry_msgs/PoseArray (latched)
Parameters:
~frame_id frame of the published PoseArray (default "map")
~input_topic topic carrying one geometry_msgs/PoseStamped per waypoint
~output_topic topic carrying the whole list as geometry_msgs/PoseArray
~publish_rate how often, in Hz, the list is re-published (default 1.0;
<= 0 publishes only when a waypoint arrives)
~waypoints optional seed list, e.g. [[1.0, 0.0], [2.0, 1.0, 1.57]]
The published list is latched, so a subscriber that starts later still gets it.
Nothing is published while the list is empty. Incoming frames are NOT
transformed: a pose is taken as it arrives (a warning is logged once if its
frame differs from ~frame_id).
"""
import math
import rospy
from geometry_msgs.msg import Pose, PoseArray, PoseStamped
def _quaternion_to_yaw(quaternion):
"""Yaw (radians) of a quaternion, ignoring roll and pitch."""
siny_cosp = 2.0 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y)
cosy_cosp = 1.0 - 2.0 * (quaternion.y * quaternion.y + quaternion.z * quaternion.z)
return math.atan2(siny_cosp, cosy_cosp)
def _yaw_to_quaternion(yaw):
"""Quaternion (x, y, z, w) for a pure yaw rotation."""
return 0.0, 0.0, math.sin(yaw / 2.0), math.cos(yaw / 2.0)
class WaypointsServer(object):
def __init__(self):
self.frame_id = rospy.get_param('~frame_id', 'map')
input_topic = rospy.get_param('~input_topic', 'waypoint')
output_topic = rospy.get_param('~output_topic', 'waypoints')
rate = float(rospy.get_param('~publish_rate', 1.0))
self.waypoints = [] # list of (x, y, yaw)
self.warned_about_frame = False
for item in rospy.get_param('~waypoints', []):
waypoint = self._parse_waypoint(item)
if waypoint is not None:
self.waypoints.append(waypoint)
self.publisher = rospy.Publisher(output_topic, PoseArray, queue_size=1, latch=True)
self.subscriber = rospy.Subscriber(input_topic, PoseStamped,
self._on_waypoint, queue_size=10)
rospy.loginfo('waypoints_server (RECONSTRUCTION, not the original package): '
'%d seed waypoint(s); %s -> %s, frame "%s"',
len(self.waypoints), input_topic, output_topic, self.frame_id)
self.timer = None
if rate > 0.0:
self.timer = rospy.Timer(rospy.Duration(1.0 / rate), self._publish)
@staticmethod
def _parse_waypoint(item):
"""Accept [x, y], [x, y, theta], {'x':, 'y':, 'theta':} - else None."""
try:
if isinstance(item, dict):
return (float(item['x']), float(item['y']), float(item.get('theta', 0.0)))
return (float(item[0]), float(item[1]),
float(item[2]) if len(item) > 2 else 0.0)
except (TypeError, IndexError, KeyError, ValueError) as exc:
rospy.logwarn('waypoints_server: ignoring malformed waypoint %s (%s)', item, exc)
return None
def _on_waypoint(self, message):
position = message.pose.position
frame = message.header.frame_id
if frame and frame != self.frame_id and not self.warned_about_frame:
rospy.logwarn('waypoints_server: waypoint arrives in frame "%s" but this node '
'publishes in "%s" and does NOT transform frames', frame, self.frame_id)
self.warned_about_frame = True
self.waypoints.append((position.x, position.y,
_quaternion_to_yaw(message.pose.orientation)))
rospy.loginfo('waypoints_server: waypoint %d added (%.3f, %.3f)',
len(self.waypoints), position.x, position.y)
self._publish(None)
def _publish(self, _event):
if not self.waypoints:
return
array = PoseArray()
array.header.stamp = rospy.Time.now()
array.header.frame_id = self.frame_id
for x, y, yaw in self.waypoints:
pose = Pose()
pose.position.x = x
pose.position.y = y
pose.position.z = 0.0
(pose.orientation.x, pose.orientation.y,
pose.orientation.z, pose.orientation.w) = _yaw_to_quaternion(yaw)
array.poses.append(pose)
self.publisher.publish(array)
def main():
rospy.init_node('waypoints_server')
WaypointsServer()
rospy.spin()
if __name__ == '__main__':
main()
+22 -5
View File
@@ -1,5 +1,11 @@
# Gitlinks (index mode 160000) that are KNOWN to have no `.gitmodules` entry. # Gitlinks (index mode 160000) that are KNOWN to have no `.gitmodules` entry.
# #
# THERE ARE NONE ANY MORE. Every gitlink left in the index (`src/rosaria`) is
# declared in `.gitmodules`, and the historical `src/waypoints` gitlink was
# replaced by in-tree content written as a DECLARED RECONSTRUCTION (see
# `src/waypoints/README.md`). tests/run.sh fails if a gitlink turns up that is
# not declared, so an unmapped one cannot come back unnoticed.
#
# One path per line, relative to the repository root. Blank lines and lines # One path per line, relative to the repository root. Blank lines and lines
# starting with '#' are ignored. # starting with '#' are ignored.
# #
@@ -7,8 +13,19 @@
# regression), and only prints a NOTE if a path listed here is no longer a gap # regression), and only prints a NOTE if a path listed here is no longer a gap
# (meaning this baseline is stale and should be pruned). # (meaning this baseline is stale and should be pruned).
# #
# src/waypoints - the package is a gitlink in this repository's history, but its # What is genuinely missing now is NOT the waypoints code (that was
# origin could not be identified anywhere (not in Gitea, not in the author's # reconstructed) but the ORIGINAL, plus a documentation-conformance gap:
# GitHub account, not on the machine, not on the web). No `.gitmodules` entry #
# could be written without inventing a URL. See README.md. # * The original `waypoints` package. The gitlink commit
src/waypoints # 115553cfa8c2ace122414ac5a9b235cd2e225693 exists in no known remote (not in
# Gitea, not in the author's GitHub account, not on the machine, not on the
# web) and the author no longer has it, so the original work is still lost -
# and with it the rviz plugins that p3dx_navigation.rviz expects
# (`waypoints/waypointPanel`, `waypoints/Waypoints`), which the declared
# reconstruction in `src/waypoints/` does not reproduce.
#
# * `darknet_ros`, which the OBJECT DETECTION part of guide.txt runs
# (`roslaunch darknet_ros darknet_ros.launch`) and which is not under `src/`:
# a documentation-conformance gap, not a gitlink.
#
# Both are recorded in README.md and are not fixed here.
+44 -1
View File
@@ -5,7 +5,8 @@
# Each case copies the working tree into a temporary directory, breaks exactly # Each case copies the working tree into a temporary directory, breaks exactly
# one thing THERE, and asserts that tests/run.sh then fails with the expected # one thing THERE, and asserts that tests/run.sh then fails with the expected
# check id. Nothing in the real repository is modified: every mutation happens # check id. Nothing in the real repository is modified: every mutation happens
# in the throwaway copy. # in the throwaway copy (one of them even commits there, to turn src/waypoints
# back into a gitlink).
# #
# Usage: tests/negative.sh # Usage: tests/negative.sh
# Exit status: 0 = every case behaved as expected. # Exit status: 0 = every case behaved as expected.
@@ -53,6 +54,41 @@ mut_add_orphan_entry() {
# a declared package that lost a required file # a declared package that lost a required file
mut_break_package() { mv src/robot/CMakeLists.txt src/robot/CMakeLists.txt.hidden; } mut_break_package() { mv src/robot/CMakeLists.txt src/robot/CMakeLists.txt.hidden; }
# --- the waypoints package (the declared reconstruction) -------------------
# the node that guide.txt runs is gone
mut_drop_waypoints_node() { rm -f src/waypoints/scripts/waypoints_server; }
# the package lost its package.xml
mut_drop_waypoints_package_xml() { mv src/waypoints/package.xml src/waypoints/package.xml.hidden; }
# the node is not executable any more, so rosrun would not run it
mut_waypoints_node_not_executable() { chmod -x src/waypoints/scripts/waypoints_server; }
# the node no longer initialises itself under the name guide.txt runs
mut_waypoints_node_renamed() {
sed -i "s/init_node('waypoints_server')/init_node('something_else')/" \
src/waypoints/scripts/waypoints_server
}
# the node stops being valid Python
mut_waypoints_syntax_error() {
printf '\ndef broken(:\n' >> src/waypoints/scripts/waypoints_server
}
# the reconstruction stops declaring itself
mut_waypoints_no_declaration() { rm -f src/waypoints/README.md; }
# the fix is undone: src/waypoints goes back to being a gitlink with no content
mut_waypoints_back_to_gitlink() {
rm -rf src/waypoints
git rm -r --cached --quiet src/waypoints >/dev/null 2>&1
git update-index --add --cacheinfo \
160000,115553cfa8c2ace122414ac5a9b235cd2e225693,src/waypoints
git -c user.name=negative -c user.email=negative@invalid commit \
--quiet -m "back to a gitlink" >/dev/null 2>&1
}
# --- runner --------------------------------------------------------------- # --- runner ---------------------------------------------------------------
case_expect() { case_expect() {
@@ -100,6 +136,13 @@ case_expect mut_drop_rosaria_entry gitlink-undeclared
case_expect mut_hide_gitmodules gitmodules-missing case_expect mut_hide_gitmodules gitmodules-missing
case_expect mut_add_orphan_entry gitmodules-orphan case_expect mut_add_orphan_entry gitmodules-orphan
case_expect mut_break_package cmakelists-missing case_expect mut_break_package cmakelists-missing
case_expect mut_drop_waypoints_node waypoints-node-present
case_expect mut_drop_waypoints_package_xml waypoints-package-xml
case_expect mut_waypoints_node_not_executable waypoints-node-executable
case_expect mut_waypoints_node_renamed waypoints-node-name
case_expect mut_waypoints_syntax_error waypoints-python-syntax
case_expect mut_waypoints_no_declaration waypoints-declared
case_expect mut_waypoints_back_to_gitlink waypoints-still-gitlink
echo echo
if [ "$fails" -eq 0 ]; then if [ "$fails" -eq 0 ]; then
+166 -3
View File
@@ -18,9 +18,11 @@
# #
# Exit status: 0 = every check passed; non-zero = at least one check failed. # Exit status: 0 = every check passed; non-zero = at least one check failed.
# Note: src/waypoints is a gitlink with no .gitmodules mapping (see # Note: src/rosaria is a submodule declared in .gitmodules, but the UNTARGETED
# tests/known-gaps.txt), and that makes the UNTARGETED `git submodule # `git submodule update --init` is still not used here: initialise the declared
# update --init` abort. Initialise the declared submodule by path, as above. # submodule by path, as above. (The historical src/waypoints gitlink - the one
# that used to make the untargeted command abort - is gone: it is now in-tree
# content written as a DECLARED RECONSTRUCTION. See section 8.)
# #
set -uo pipefail set -uo pipefail
@@ -259,6 +261,167 @@ for p in $known; do
done done
echo echo
# --- 8. the waypoints package: a DECLARED RECONSTRUCTION -------------------
# src/waypoints used to be a gitlink (index mode 160000) pointing at commit
# 115553cfa8c2ace122414ac5a9b235cd2e225693, and that code does not exist in any
# known remote - the ORIGINAL is lost for good. It is now plain in-tree content,
# written from the clues that survived this repository and declared as a
# reconstruction (src/waypoints/README.md).
#
# What these checks prove: the package is complete, the node it ships is the one
# guide.txt runs, it is executable, and its Python parses. What they CANNOT
# prove: that it runs, that a workspace builds (there is no ROS here), or that
# the interface is the original one - the topics are inferred, not recovered.
wp=src/waypoints
# 8a. the gitlink is gone: the path must be in-tree content now
wpmode=$(git ls-tree HEAD src/waypoints 2>/dev/null | awk '{print $1}' | head -1)
if [ "$wpmode" = "160000" ]; then
fail "waypoints-still-gitlink" "$wp is still a gitlink (mode 160000): its code lives elsewhere and a clean clone brings an empty directory"
elif [ -n "$wpmode" ]; then
pass "waypoints-in-tree" "$wp is tracked as in-tree content (mode $wpmode), not as a gitlink"
else
fail "waypoints-in-tree" "$wp is not tracked in the index at all"
fi
# 8b. the node name is read FROM guide.txt, never hard-coded in this suite
wpnode=$(sed -n 's/.*rosrun[[:space:]][[:space:]]*waypoints[[:space:]][[:space:]]*\([^[:space:]]\{1,\}\).*/\1/p' guide.txt 2>/dev/null | head -1 | tr -d '\r')
if [ -z "$wpnode" ]; then
fail "waypoints-guide-node" "guide.txt no longer shows 'rosrun waypoints <node>'; this suite lost its anchor"
else
pass "waypoints-guide-node" "guide.txt runs 'rosrun waypoints $wpnode'"
fi
# 8c. package.xml + CMakeLists.txt (section 1 covers tracked packages in
# general; this repeats it for waypoints so the reconstruction is checked even
# if that general check is ever loosened)
if [ -f "$wp/package.xml" ]; then
wpname=$(sed -n 's:.*<name>[[:space:]]*\([^<]*\)</name>.*:\1:p' "$wp/package.xml" | head -1 | tr -d ' \t\r')
if [ "$wpname" = "waypoints" ]; then
pass "waypoints-package-xml" "$wp/package.xml declares <name>waypoints</name>"
else
fail "waypoints-package-xml" "$wp/package.xml declares <name>${wpname:-<nothing>}</name>, expected 'waypoints' (the name in guide.txt)"
fi
else
fail "waypoints-package-xml" "$wp has no package.xml"
fi
if [ -f "$wp/CMakeLists.txt" ]; then
pass "waypoints-cmakelists" "$wp/CMakeLists.txt exists"
else
fail "waypoints-cmakelists" "$wp has no CMakeLists.txt"
fi
# 8d. the executable guide.txt names, executable and self-consistent
wpnode_path=""
if [ -n "$wpnode" ]; then
for cand in "$wp/scripts/$wpnode" "$wp/bin/$wpnode" "$wp/$wpnode"; do
if [ -f "$cand" ]; then wpnode_path="$cand"; break; fi
done
fi
pyfiles=""
if [ -n "$wpnode_path" ]; then
pass "waypoints-node-present" "the node guide.txt runs is at $wpnode_path"
nodemode=$(git ls-files -s -- "$wpnode_path" | awk '{print $1}' | head -1)
if [ "$nodemode" = "100755" ] && [ -x "$wpnode_path" ]; then
pass "waypoints-node-executable" "$wpnode_path is executable (index mode 100755 and +x on disk), so rosrun can find it"
else
fail "waypoints-node-executable" "$wpnode_path has index mode ${nodemode:-<untracked>} and is$( [ -x "$wpnode_path" ] || printf ' not') +x; rosrun needs an executable"
fi
if head -1 -- "$wpnode_path" 2>/dev/null | grep -q '^#!.*python'; then
pyfiles="$pyfiles $wpnode_path"
if grep -q "init_node(['\"]$wpnode['\"]" "$wpnode_path"; then
pass "waypoints-node-name" "$wpnode_path initialises the node as '$wpnode', the name guide.txt runs"
else
fail "waypoints-node-name" "$wpnode_path does not call init_node('$wpnode')"
fi
elif grep -q "ros::init([^;]*[\"']$wpnode[\"']" "$wpnode_path" 2>/dev/null; then
pass "waypoints-node-name" "$wpnode_path initialises the node as '$wpnode', the name guide.txt runs"
else
fail "waypoints-node-name" "$wpnode_path initialises no node named '$wpnode' (neither init_node nor ros::init)"
fi
else
fail "waypoints-node-present" "no executable named '${wpnode:-<unknown>}' under $wp (scripts/, bin/ or the package root)"
fi
# 8e. every Python file in the package parses (python3 -m py_compile, with the
# .pyc thrown away in a temp dir so the tree stays clean), or - if the package
# is C++ - it has the obvious ROS structure. Neither proves it BUILDS.
while IFS= read -r f; do
[ -f "$f" ] || continue
case "$f" in
*.py) pyfiles="$pyfiles $f" ;;
esac
done < <(git ls-files -- "$wp")
pyfiles=$(printf '%s\n' $pyfiles | sort -u | tr '\n' ' ')
if [ -n "${pyfiles// /}" ]; then
if command -v python3 >/dev/null 2>&1; then
pycdir=$(mktemp -d)
badpy=""
for f in $pyfiles; do
if ! python3 -c 'import py_compile, sys; py_compile.compile(sys.argv[1], cfile=sys.argv[2], doraise=True)' \
"$f" "$pycdir/out.pyc" >/dev/null 2>&1; then
badpy="$badpy $f"
fi
done
rm -rf "$pycdir"
if [ -z "$badpy" ]; then
pass "waypoints-python-syntax" "python3 -m py_compile accepts:$pyfiles"
else
fail "waypoints-python-syntax" "python3 -m py_compile rejects:$badpy"
fi
else
note "waypoints-python-syntax" "python3 is not available, syntax check skipped"
fi
else
cppfiles=$(git ls-files -- "$wp" | grep -E '\.(cpp|cc|cxx)$' | tr '\n' ' ')
if [ -n "${cppfiles// /}" ]; then
badcpp=""
for f in $cppfiles; do
if ! grep -q '#include *<ros/ros.h>' "$f" || ! grep -q 'int *main' "$f"; then
badcpp="$badcpp $f"
fi
done
if [ -z "$badcpp" ]; then
pass "waypoints-cpp-structure" "every C++ source includes <ros/ros.h> and defines main():$cppfiles"
else
fail "waypoints-cpp-structure" "C++ source without the obvious ROS structure:$badcpp"
fi
else
fail "waypoints-node-source" "$wp has no Python file and no C++ source"
fi
fi
# 8f. the reconstruction must declare itself and name the sha it replaces
if [ -f "$wp/README.md" ]; then
if grep -qi 'reconstruct' "$wp/README.md"; then
pass "waypoints-declared" "$wp/README.md calls the package a reconstruction"
else
fail "waypoints-declared" "$wp/README.md does not call the package a reconstruction"
fi
sha=115553cfa8c2ace122414ac5a9b235cd2e225693
if grep -q "$sha" "$wp/README.md" && grep -q "$sha" "$wp/package.xml"; then
pass "waypoints-declares-lost-sha" "the lost gitlink commit $sha is named in $wp/README.md and $wp/package.xml"
else
fail "waypoints-declares-lost-sha" "the lost gitlink commit $sha is not named in both $wp/README.md and $wp/package.xml"
fi
else
fail "waypoints-declared" "$wp has no README.md declaring the package a reconstruction"
fi
if grep -q 'src/waypoints/README.md' README.md 2>/dev/null; then
pass "waypoints-repo-readme" "the repository README points at src/waypoints/README.md"
else
fail "waypoints-repo-readme" "the repository README does not point at src/waypoints/README.md"
fi
# 8g. and git itself must no longer complain about a gitlink with no mapping:
# this is the check that the empty-directory-in-a-clean-clone problem is gone
if git submodule status >/dev/null 2>&1; then
pass "submodule-status-clean" "'git submodule status' succeeds: no gitlink in the index lacks a .gitmodules mapping"
else
fail "submodule-status-clean" "'git submodule status' still fails: $(git submodule status 2>&1 | tr '\n' ' ' | tr -s ' ')"
fi
echo
if [ "$failed" -eq 0 ]; then if [ "$failed" -eq 0 ]; then
echo "ALL CHECKS PASSED" echo "ALL CHECKS PASSED"
exit 0 exit 0