6 Commits

5 changed files with 21 additions and 23 deletions

8
flake.lock generated
View File

@@ -24,16 +24,16 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1775216071, "lastModified": 1770108954,
"narHash": "sha256-PrPW70Fh1uLx3JxNV/NLeXjUhgfrZmi7ac8LJOlS0q4=", "narHash": "sha256-VBj6bd4LPPSfsZJPa/UPPA92dOs6tmQo0XZKqfz/3W4=",
"owner": "lopsided98", "owner": "lopsided98",
"repo": "nix-ros-overlay", "repo": "nix-ros-overlay",
"rev": "197a2b55c4ed24f8b885a5b20b65f426fb6d57ca", "rev": "3d05d46451b376e128a1553e78b8870c75d7753a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "lopsided98", "owner": "lopsided98",
"ref": "master", "ref": "develop",
"repo": "nix-ros-overlay", "repo": "nix-ros-overlay",
"type": "github" "type": "github"
} }

View File

@@ -2,7 +2,7 @@
description = "Development environment for ASTRA Anchor"; description = "Development environment for ASTRA Anchor";
inputs = { inputs = {
nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay/master"; nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay/develop";
nixpkgs.follows = "nix-ros-overlay/nixpkgs"; # IMPORTANT!!! nixpkgs.follows = "nix-ros-overlay/nixpkgs"; # IMPORTANT!!!
treefmt-nix = { treefmt-nix = {
@@ -98,8 +98,7 @@
); );
nixConfig = { nixConfig = {
# Cache to pull ros packages from extra-substituters = [ "https://ros.cachix.org" ];
extra-substituters = [ "https://ros.cachix.org" "https://attic.iid.ciirc.cvut.cz/ros" ]; extra-trusted-public-keys = [ "ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=" ];
extra-trusted-public-keys = [ "ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=" "ros:JR95vUYsShSqfA1VTYoFt1Nz6uXasm5QrcOsGry9f6Q=" ];
}; };
} }

View File

@@ -3,7 +3,7 @@
repo_root="$(git rev-parse --show-toplevel)" repo_root="$(git rev-parse --show-toplevel)"
if [[ -z $repo_root ]]; then if [[ -z $repo_root ]]; then
echo "script must be run from within a git repo" >&2 echo "script must be run from within the rover-ros2 repo" >&2
exit 1 exit 1
fi fi

View File

@@ -22,15 +22,15 @@ class Anchor(Node):
""" """
Publishers: Publishers:
* /anchor/from_vic/debug * /anchor/from_vic/debug
- Every string received from the MCU is published here for debugging - Every string received from the MCU is published here for debugging (String)
* /anchor/from_vic/core * /anchor/from_vic/core
- VicCAN messages for Core node - VicCAN messages for Core node
* /anchor/from_vic/arm * /anchor/from_vic/arm
- VicCAN messages for Arm node - VicCAN messages for Arm node (also receives digit messages)
* /anchor/from_vic/bio * /anchor/from_vic/bio
- VicCAN messages for Bio node - VicCAN messages for Bio node (also receives digit messages)
* /anchor/to_vic/debug * /anchor/to_vic/debug
- A string copy of the messages published to ./relay are published here - String copy of all messages sent to the connector
Subscribers: Subscribers:
* /anchor/from_vic/mock_mcu * /anchor/from_vic/mock_mcu
@@ -38,10 +38,9 @@ class Anchor(Node):
* /anchor/to_vic/relay * /anchor/to_vic/relay
- Core, Arm, and Bio publish VicCAN messages to this topic to send to the MCU - Core, Arm, and Bio publish VicCAN messages to this topic to send to the MCU
* /anchor/to_vic/relay_string * /anchor/to_vic/relay_string
- Send raw strings to connectors. Does not work for connectors that require conversion (like CANConnector) - Send raw strings to connectors. Does not work for CANConnector
* /anchor/relay * /anchor/relay
- Legacy method for talking to connectors. Takes String as input, but does not send the raw strings to connectors. - (Deprecated) Legacy topic. Takes String, converts to VicCAN, then sends to connector
Instead, it converts them to VicCAN messages first.
""" """
connector: Connector connector: Connector
@@ -51,7 +50,7 @@ class Anchor(Node):
logger = self.get_logger() logger = self.get_logger()
# ROS2 Parameter Setup # ROS2 parameter setup
self.declare_parameter( self.declare_parameter(
"connector", "connector",
@@ -86,7 +85,7 @@ class Anchor(Node):
), ),
) )
# Determine which connector to use. Options are Mock, Serial, and CAN # determine which connector to use. options are Mock, Serial, and CAN
connector_select = ( connector_select = (
self.get_parameter("connector").get_parameter_value().string_value self.get_parameter("connector").get_parameter_value().string_value
) )
@@ -126,9 +125,9 @@ class Anchor(Node):
) )
exit(1) exit(1)
# ROS2 Topic Setup # ROS2 topic setup
# Publishers # publishers
self.fromvic_debug_pub_ = self.create_publisher( # only used by serial self.fromvic_debug_pub_ = self.create_publisher( # only used by serial
String, String,
"/anchor/from_vic/debug", "/anchor/from_vic/debug",
@@ -149,14 +148,14 @@ class Anchor(Node):
"/anchor/from_vic/bio", "/anchor/from_vic/bio",
20, 20,
) )
# Debug publisher # debug publisher for outgoing messages
self.tovic_debug_pub_ = self.create_publisher( self.tovic_debug_pub_ = self.create_publisher(
String, String,
"/anchor/to_vic/debug", "/anchor/to_vic/debug",
20, 20,
) )
# Subscribers # subscribers
self.tovic_sub_ = self.create_subscription( self.tovic_sub_ = self.create_subscription(
VicCAN, VicCAN,
"/anchor/to_vic/relay", "/anchor/to_vic/relay",

View File

@@ -429,7 +429,7 @@ class CANConnector(Connector):
class MockConnector(Connector): class MockConnector(Connector):
def __init__(self, logger: RcutilsLogger, clock: Clock): def __init__(self, logger: RcutilsLogger, clock: Clock):
super().__init__(logger, clock) super().__init__(logger, clock)
# No hardware interface for MockConnector. Publish to `/anchor/from_vic/mock_mcu` instead. # no hardware interface for MockConnector. publish to `/anchor/from_vic/mock_mcu` instead
def read(self) -> tuple[VicCAN | None, str | None]: def read(self) -> tuple[VicCAN | None, str | None]:
return (None, None) return (None, None)