Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/ros gateway cell voltage #207

Merged
merged 3 commits into from
Nov 6, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/actions/build-gateway/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ runs:
env:
ROS_DISTRO: ${{ inputs.ros_distro }}
PLATFORMS: ${{ steps.builder.outputs.platforms }}
DOCKER_BUILDER: ${{ steps.builder.outputs.name }}
BUILDER: ${{ steps.builder.outputs.name }}
VERSION_TAGS: ${{ inputs.tags }}
6 changes: 3 additions & 3 deletions ros-gateway/ros-package/gateway/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, battery_monitor):
def __publish_cell_voltages(self, msg):
# If first message received is for the last 3 cells, skip it
# If something went wrong with the reception order, we also skip it
if (msg.data[0] == 1 and len(self.cell_voltages) <= 3) or (
if (msg.data[0] == 1 and len(self.cell_voltages) < 3) or (
msg.data[0] == 0 and len(self.cell_voltages) > 0
):
self.cell_voltages.clear()
Expand All @@ -79,9 +79,9 @@ def __publish_cell_voltages(self, msg):
if len(self.cell_voltages) >= 6:
cell_voltage_msg = msgtype.UInt16MultiArray()
cell_voltage_msg.data = self.cell_voltages
self.publisher.publish(cell_voltage_msg)
self.cell_voltages_publisher.publish(cell_voltage_msg)
self.get_logger().debug(
f'Publishing {self.topic}: "{cell_voltage_msg.data}"'
f'Publishing {self.cell_voltages_topic}: "{cell_voltage_msg.data}"'
)

self.cell_voltages.clear()
Expand Down
30 changes: 22 additions & 8 deletions scripts/build-ros-gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Build the ros-gateway docker image. Requires docker to be installed
and usable without sudo.

args:
--help show this help
--push push containers
--help show this help
--local build local version for testing with tag "rover-ros-gateway-test"
--push push containers

default env vars:
ROS_DISTRO=jazzy ROS distro codename to build
Expand All @@ -39,6 +40,11 @@ while [[ $# -gt 0 ]]; do
exit 0
;;

--local)
LOCAL="true"
shift 1
;;

--push)
PUSH="true"
shift 1
Expand Down Expand Up @@ -88,9 +94,17 @@ if ! docker buildx ls | grep "${BUILDER}" >/dev/null; then
--bootstrap
fi

docker buildx --builder "${BUILDER}" build \
-f "${DOCKERFILE}" \
--platform "${PLATFORMS}" \
--build-arg ROS_DISTRO="${ROS_DISTRO}" \
"${TAG_ARGS[@]}" "${OUTPUT_ARGS[@]}" "${CI_ARGS[@]}" \
"${BUILD_CONTEXT}"
if [[ -z ${LOCAL} ]]; then
docker buildx --builder "${BUILDER}" build \
-f "${DOCKERFILE}" \
--platform "${PLATFORMS}" \
--build-arg ROS_DISTRO="${ROS_DISTRO}" \
"${TAG_ARGS[@]}" "${OUTPUT_ARGS[@]}" "${CI_ARGS[@]}" \
"${BUILD_CONTEXT}"
else
docker build \
-f "${DOCKERFILE}" \
-t rover-ros-gateway-test \
--build-arg ROS_DISTRO="${ROS_DISTRO}" \
"${BUILD_CONTEXT}"
fi