Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This experiment stays on RAMM; it has no sync hooks.
local root = oslo.direnv.dir() or oslo.sys.pwd()
oslo.direnv.nix_develop { flake = "path:" .. root }
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ inventory.yaml.bak
persist.json
calibration*.yaml
camera_calibration/

/.logs/
/config/
/state/
/captures/
46 changes: 46 additions & 0 deletions .make.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
local make = oslo.make

-- Invoke ROS tools in this project's Nix environment; no shell wrapper needed.
local function ros(...)
local argv = { "nix", "develop", "path:.", "--accept-flake-config", "--command" }
for _, value in ipairs({ ... }) do argv[#argv + 1] = value end
return oslo.run(argv)
end

make.recipe {
name = "build",
desc = "Build Vixel with ROS 2 Lyrical",
run = function()
assert(ros("colcon", "build", "--symlink-install", "--parallel-workers", "2",
"--cmake-args", "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_TESTING=ON").ok,
"Vixel build failed")
end,
}

make.recipe {
name = "test",
desc = "Run Vixel tests and show their results",
run = function()
local tests = ros("colcon", "test", "--return-code-on-test-failure")
local results = ros("colcon", "test-result", "--verbose")
assert(tests.ok and results.ok, "Vixel tests failed; see the results above")
end,
}

make.recipe {
name = "run",
desc = "Launch Vixel and its dashboard on localhost:8080",
run = function()
local vision = oslo.run {
"systemctl", "--user", "is-active", "--quiet", "smartweg-vision.service",
capture = true,
}
assert(not vision.ok,
"Stop the camera GUI first: systemctl --user stop smartweg-vision.service")
local root = oslo.sys.pwd()
assert(ros("ros2", "launch", "vixel", "cameras_launch.py",
"machine_file:=" .. root .. "/config/machine.yaml",
"inventory_file:=" .. root .. "/state/inventory.yaml",
"web_preview:=true", "web_port:=8080").ok, "Vixel launch failed")
end,
}
101 changes: 101 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
description = "RAMM-only Vixel experiment with ROS 2 Lyrical";
inputs = {
nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay/master";
nixpkgs.follows = "nix-ros-overlay/nixpkgs";
};
outputs = { self, nixpkgs, nix-ros-overlay }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; overlays = [ nix-ros-overlay.overlays.default ]; };
ros = pkgs.rosPackages.lyrical;
rosEnv = ros.buildEnv {
underlay = true;
paths = with ros; [ ros-core ament-cmake ament-cmake-core ament-cmake-gtest ament-cmake-python
rosidl-default-generators rosidl-default-runtime camera-info-manager cv-bridge
rclcpp rclcpp-action rclpy sensor-msgs std-msgs geometry-msgs action-msgs
builtin-interfaces tf2-ros tf2-ros-py launch launch-ros ros2launch ];
};
in {
devShells.${system}.default = pkgs.mkShell {
packages = [ rosEnv pkgs.colcon pkgs.cmake pkgs.ninja pkgs.pkg-config
pkgs.aravis pkgs.glib pkgs.libxml2 pkgs.zlib pkgs.libusb1 pkgs.yaml-cpp pkgs.nlohmann_json pkgs.opencv
pkgs.meson pkgs.git pkgs.nodejs pkgs.linuxptp pkgs.ethtool pkgs.iproute2
pkgs.python3Packages.pytest pkgs.python3Packages.pyyaml pkgs.python3Packages.setuptools ];
shellHook = ''
export ROS_DOMAIN_ID=42
export ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST
export VIXEL_ROOT="$PWD"
export PYTHONNOUSERSITE=1
if [ -f "$VIXEL_ROOT/install/local_setup.bash" ]; then
source "$VIXEL_ROOT/install/local_setup.bash"
fi
'';
};
};
nixConfig = {
extra-substituters = [ "https://ros.cachix.org" "https://attic.iid.ciirc.cvut.cz/ros" ];
extra-trusted-public-keys = [
"ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo="
"ros:JR95vUYsShSqfA1VTYoFt1Nz6uXasm5QrcOsGry9f6Q="
];
};
}