ROS package that uses python-daly-bms driver data to read information from Daly BMS devices and publishes it using robotnik_msgs/BatteryStatus message type.
command -v vcs >/dev/null 2>&1 || (sudo apt update && sudo apt install -y python3-vcstool)
command -v pip3 >/dev/null 2>&1 || (sudo apt update && sudo apt install -y python3-pip)
mkdir -p robot_ws/src
cd robot_ws/src
git clone -b ros2-devel git@github.com:RobotnikAutomation/daly_bms.git
vcs import \
--input daly_bms/common.repos.yaml \
--shallow \
.
pip3 install -r daly_bms/requirements.txt
cd ..
rosdep install
cd src/daly_bms
colcon build
source install/setup.bash
ros2 launch daly_bms daly_bms.launch.xml
The launch file accepts the following arguments:
port
ROBOT_BMS_PORT
, or /dev/ttyUSB_BMS
if not set.ros2 launch daly_bms daly_bms.launch.xml port:=/dev/ttyUSB0
node_name
NODE_NAME
, or battery_estimator
if not set.ros2 launch daly_bms daly_bms.launch.xml node_name:=my_bms_node
robot_id
ROBOT_ID
, or robot
if not set.ros2 launch daly_bms daly_bms.launch.xml robot_id:=my_robot
log_level
LOG_LEVEL
, or INFO
if not set.ros2 launch daly_bms daly_bms.launch.xml log_level:=DEBUG
/dev/ttyUSB_BMS
): Serial port of the deviceThe container setup is controlled by the setup-container.yaml
file. This file contains essential variables for creating the required Docker image files. Review and edit this file as needed before proceeding with the setup.
---
images:
version: devel
sites:
local: docker-hub
# local: robotnik
ros:
general:
distro: humble
domain_id: 50
robot_id: robot
log_level: INFO
bms:
port: /dev/ttyUSB_BMS
images.version
: Specifies the version tag for the Docker image.images.sites
: Defines the Docker registry locations for local environment. (Options are docker-hub
or robotnik
)ros.general
: Contains ROS 2 specific configurations, including the distribution and robot settings.ros.bms
: Specifies hardware-related settings, such as the BMS port.To create the container files use the following command
setup-container/scripts/setup.sh
This script will process the setup-container.yaml
file and create all required Docker-related files in the appropriate directories.
To build the container, navigate to the builder directory and use Docker Compose. This step compiles the necessary images based on the Dockerfile provided in the directory.
cd container/builder
docker compose build
To run the Daly BMS application inside a Docker container, execute the following commands. This will start the container in detached mode, allowing the application to run in the background.
cd container/run
docker compose up -d
For debugging purposes, you can access the container's shell. This allows you to interact with the application directly, inspect logs, and troubleshoot issues. the source is mounted on your container and you can edit with your favourite ide.
cd container/debug
docker compose up -d
docker compose exec bms bash
To generate Debian packages:
cd container/debs
docker compose up --build
To run the unitary tests:
cd container/test
docker compose build
This package includes an udev rule to find the USB device using its model and vendor identifiers. This is useful to bind the device to a specific port, independently of the actual physical port where the device is plugged. To add this udev rule to your system, just copy it into your /etc/udev/rules.d directory.