Update Dockerfile and package naming

This commit is contained in:
e.rosendahl 2025-07-28 01:12:59 +02:00
parent 21e1b84e7a
commit be93645b4d
7 changed files with 50 additions and 29 deletions

View File

@ -1,9 +1,9 @@
{
"name": "ft_analytics",
"image": "ft_analytics:latest",
"workspaceFolder": "/workspaces/can_viewer",
"workspaceFolder": "/workspaces/ft_analytics",
"runArgs": [
"--net=host",
"--network=host",
"--privileged"
],
"settings": {},

View File

@ -3,7 +3,7 @@ FROM ubuntu:24.04
ENV PIP_BREAK_SYSTEM_PACKAGES=1 \
SHELL=/bin/bash
ARG USERNAME=can_viewer
ARG USERNAME=ft_analytics
ARG USER_UID=1000
ARG USER_GID=${USER_UID}
@ -18,34 +18,41 @@ RUN if id -u "${USER_UID}" >/dev/null 2>&1; then \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3-pip \
nano \
iproute2 \
can-utils \
lsb-release \
curl \
gnupg \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir python-can cantools python3-rosdep
&& apt-get install -y --no-install-recommends curl gnupg lsb-release ca-certificates
RUN echo "deb [signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key | gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& apt-get update \
&& apt-get install -y --no-install-recommends ros-jazzy-ros-core python3-colcon-common-extensions \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key | gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ros-jazzy-ros-core \
python3-colcon-common-extensions \
python3-pip \
nano \
iproute2 \
can-utils \
python3-rosdep \
build-essential \
cmake \
kmod \
&& rm -rf /var/lib/apt/lists/*
RUN echo "source /opt/ros/jazzy/setup.bash" >> /home/${USERNAME}/.bashrc \
&& echo "source /workspaces/can_viewer/install/setup.bash" >> /home/${USERNAME}/.bashrc
RUN pip3 install --no-cache-dir --upgrade --break-system-package \
python-can cantools
RUN echo "source /opt/ros/jazzy/setup.bash" >> /home/${USERNAME}/.bashrc \
&& echo "source /workspaces/ft_analytics/install/setup.bash" >> /home/${USERNAME}/.bashrc
WORKDIR /workspaces/ft_analytics
RUN mkdir -p /workspaces/ft_analytics/ros2_ws/src
WORKDIR /workspaces/can_viewer
COPY --chown=${USERNAME}:${USERNAME} ros2_ws/src ros2_ws/src
#RUN rosdep update \
# && rosdep install -r --rosdistro jazzy \
# --from-paths ros2_ws/src --ignore-src -y
RUN rosdep init \
&& apt-get update \
&& rosdep update \
&& rosdep install -r --rosdistro jazzy --from-paths ros2_ws/src --ignore-src -y
USER ${USERNAME}
CMD ["/bin/bash"]

4
launch.bash Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
ros2 run ft_analytics can_viewer_node foxglove_bridge foxglove_bridge \
--ros-args -p send_buffer_limit:=1000000000

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(ft_can_viewer)
project(ft_analytics)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra)

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>ft_can_viewer</name>
<name>ft_analytics</name>
<version>0.1.0</version>
<description>CAN - ROS2 Publisher für Foxglove mit Transceiver-Lib</description>
<maintainer email="elias.rosendahl@fasttube.com">Elias</maintainer>

View File

@ -2,12 +2,13 @@
#include <rclcpp/rclcpp.hpp>
#include <std_msgs/msg/float64.hpp>
#include <std_msgs/msg/bool.hpp>
#include </workspaces/can_viewer/ros2_ws/src/ft_can_transceiver_lib/include/ft_can_transceiver_lib/transceiver.h>
#include </workspaces/can_viewer/ros2_ws/src/ft_can_transceiver_lib/include/ft_can_transceiver_lib/can1.h>
#include </workspaces/ft_analytics/ros2_ws/src/ft_can_transceiver_lib/include/ft_can_transceiver_lib/transceiver.h>
#include </workspaces/ft_analytics/ros2_ws/src/ft_can_transceiver_lib/include/ft_can_transceiver_lib/can1.h>
#include <vector>
class CanViewerNode : public rclcpp::Node {
public:
CanViewerNode() : Node("can_viewer_node"), transceiver_("vcan0", {}) {
CanViewerNode() : Node("can_viewer_node"), transceiver_("slcan0", {{}}) {
allow_torque_pub_ = this->create_publisher<std_msgs::msg::Bool>("can/telemetrie/allow_torque", 10);
brake_ok_pub_ = this->create_publisher<std_msgs::msg::Bool>("can/telemetrie/brake_ok", 10);
torque_limit_pub_ = this->create_publisher<std_msgs::msg::Float64>("can/telemetrie/torque_limit", 10);

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# 1 000 Frames, 10 ms Abstand
for i in $(seq 0 999); do
# Zufallswert 0-255 → zweistelliges Hex
v=$(printf '%02X' $((RANDOM % 256)))
# Byte0 Byte1 Byte2=[$v] rest = 0
cansend slcan0 720#0001${v}00000000
sleep 0.01
done