Skip to content

Commit

Permalink
Merge branch 'main' into fix/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jaagut authored Jan 25, 2024
2 parents 01ea3a3 + 9e5c0ed commit cb12761
Show file tree
Hide file tree
Showing 51 changed files with 82 additions and 910 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
uses: actions/checkout@v3

- name: Configure git to trust repository
run: git config --global --add safe.directory /__w/bitbots_meta/bitbots_meta
run: git config --global --add safe.directory /__w/bitbots_main/bitbots_main

- name: Pull source code for libraries and install dependencies
run: make install HTTPS=true ARGS="-ci"

- name: Set up colcon workspace
run: |
mkdir -p /colcon_ws/src
ln -s $(realpath .) /colcon_ws/src/bitbots_meta
ln -s $(realpath .) /colcon_ws/src/bitbots_main
- name: Build packages
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Bit-Bots Software Stack

[![Test if all packages build](https://github.com/bit-bots/bitbots_meta/actions/workflows/build.yml/badge.svg)](https://github.com/bit-bots/bitbots_meta/actions/workflows/build.yml)
[![Test if all packages build](https://github.com/bit-bots/bitbots_main/actions/workflows/build.yml/badge.svg)](https://github.com/bit-bots/bitbots_main/actions/workflows/build.yml)

This git repository contains all RoboCup-related code and documentation from the Hamburg Bit-Bots team.
All code is written as individual ROS 2 packages targeting Ubuntu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def cost_at_relative_xy(self, x: float, y: float) -> float:
# Transform point of interest to the map
point = self._blackboard.tf_buffer.transform(point, self.map_frame, timeout=Duration(seconds=0.3))
except (tf2.ConnectivityException, tf2.LookupException, tf2.ExtrapolationException) as e:
self._blackboard.node.get_logger().warn(e)
self._blackboard.node.get_logger().warn(str(e))
return 0.0

return self.get_cost_at_field_position(point.point.x, point.point.y)
Expand Down Expand Up @@ -338,7 +338,7 @@ def get_cost_of_kick_relative(self, x: float, y: float, direction: float, kick_l
pose = self._blackboard.tf_buffer.transform(pose, self.map_frame, timeout=Duration(seconds=0.3))

except (tf2.ConnectivityException, tf2.LookupException, tf2.ExtrapolationException) as e:
self._blackboard.node.get_logger().warn(e)
self._blackboard.node.get_logger().warn(str(e))
return 0.0
d = euler_from_quaternion(numpify(pose.pose.orientation))[2]
return self.get_cost_of_kick(pose.pose.position.x, pose.pose.position.y, d, kick_length, angular_range)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
Provides information about the current game state.
"""
from bitbots_utils.utils import get_parameters_from_other_node
from game_controller_hl_interfaces.msg import GameState
from rclpy.node import Node

from bitbots_msgs.msg import GameState


class GameStatusCapsule:
def __init__(self, node: Node):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_ball_position_uv(self) -> Tuple[float, float]:
ball, self.base_footprint_frame, timeout=Duration(seconds=0.2)
).point
except tf2.ExtrapolationException as e:
self._blackboard.node.get_logger().warn(e)
self._blackboard.node.get_logger().warn(str(e))
self._blackboard.node.get_logger().error("Severe transformation problem concerning the ball!")
return None
return ball_bfp.x, ball_bfp.y
Expand Down
2 changes: 2 additions & 0 deletions bitbots_behavior/bitbots_blackboard/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
<build_depend>bitbots_docs</build_depend>
<depend>bitbots_tf_listener</depend>
<depend>bitbots_utils</depend>
<depend>game_controller_hl_interfaces</depend>
<depend>python3-numpy</depend>
<depend>rclpy</depend>
<depend>ros2_numpy</depend>
<depend>tf_transformations</depend>
<exec_depend>bio_ik_msgs</exec_depend>
<exec_depend>bitbots_msgs</exec_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
from bitbots_blackboard.blackboard import BodyBlackboard
from bitbots_tf_listener import TransformListener
from dynamic_stack_decider.dsd import DSD
from game_controller_hl_interfaces.msg import GameState
from geometry_msgs.msg import PoseWithCovarianceStamped, Twist, TwistWithCovarianceStamped
from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
from rclpy.duration import Duration
from rclpy.executors import MultiThreadedExecutor
from rclpy.node import Node
from soccer_vision_3d_msgs.msg import RobotArray

from bitbots_msgs.msg import GameState, RobotControlState, TeamData
from bitbots_msgs.msg import RobotControlState, TeamData


class BodyDSD:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from bitbots_blackboard.blackboard import BodyBlackboard
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement

from bitbots_msgs.msg import GameState
from game_controller_hl_interfaces.msg import GameState


class GameStateDecider(AbstractDecisionElement):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ def __init__(self, blackboard, dsd, parameters=None):
super().__init__(blackboard, dsd, parameters)

def perform(self, reevaluate=False):
# Get nessesary data
red_cards = self.blackboard.gamestate.get_red_cards()
own_id = self.blackboard.misc.bot_id

# iterate through all red card states except the own one
for i in range(len(red_cards)):
if i != own_id:
if not red_cards[i]:
return "NO"
return "YES"
# Use generator comprehension to check if all red cards are true except our own
if all(x for i, x in enumerate(red_cards) if i != own_id):
return "YES"
else:
return "NO"

def get_reevaluate(self):
return True
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from bitbots_blackboard.blackboard import BodyBlackboard
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement

from bitbots_msgs.msg import GameState
from game_controller_hl_interfaces.msg import GameState


class SecondaryStateDecider(AbstractDecisionElement):
Expand Down
1 change: 1 addition & 0 deletions bitbots_behavior/bitbots_body_behavior/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<depend>bitbots_msgs</depend>
<depend>bitbots_utils</depend>
<depend>dynamic_stack_decider</depend>
<depend>game_controller_hl_interfaces</depend>
<depend>geometry_msgs</depend>
<depend>python3-numpy</depend>
<depend>rclpy</depend>
Expand Down
6 changes: 5 additions & 1 deletion bitbots_misc/bitbots_bringup/launch/highlevel.launch
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@

<!-- launch game controller -->
<group if="$(var game_controller)">
<include file="$(find-pkg-share humanoid_league_game_controller)/launch/game_controller.launch">
<include file="$(find-pkg-share game_controller_hl)/launch/game_controller.launch">
<arg name="sim" value="$(var sim)" />
<arg name="use_parameter_blackboard" value="true" />
<arg name="parameter_blackboard_name" value="parameter_blackboard" />
<arg name="team_id_param_name" value="team_id" />
<arg name="bot_id_param_name" value="bot_id" />
</include>
</group>

Expand Down
1 change: 1 addition & 0 deletions bitbots_misc/bitbots_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<exec_depend>bitbots_ros_control</exec_depend>
<exec_depend>bitbots_utils</exec_depend>
<exec_depend>bitbots_vision</exec_depend>
<exec_depend>game_controller_hl</exec_depend>
<exec_depend>humanoid_base_footprint</exec_depend>
<exec_depend>soccer_ipm</exec_depend>
<exec_depend>system_monitor</exec_depend>
Expand Down
12 changes: 6 additions & 6 deletions bitbots_misc/bitbots_containers/hlvs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ RUN sudo rosdep init
# pip3 install -U PyYAML construct defusedxml filterpy matplotlib numpy opencv-python \
# protobuf psutil pytorchyolo setuptools sklearn transforms3d

ADD --chown=robot:robot https://raw.githubusercontent.com/bit-bots/bitbots_meta/master/requirements/common.txt src/requirements_common.txt
ADD --chown=robot:robot https://raw.githubusercontent.com/bit-bots/bitbots_main/master/requirements/common.txt src/requirements_common.txt

RUN pip3 install -U -r src/requirements_common.txt --no-cache-dir && \
pip3 uninstall -y numpy

RUN cd src && \
git clone https://github.com/bit-bots/bitbots_meta.git && \
cd bitbots_meta && \
git clone https://github.com/bit-bots/bitbots_main.git && \
cd bitbots_main && \
make pull-init

# From here on, we don't want to cache anything. That's achieved by adding the current time.
ADD https://www.timeapi.io/api/Time/current/zone?timeZone=UTC /tmp/build-time

RUN cd src/bitbots_meta && \
RUN cd src/bitbots_main && \
make pull-all && \
rm -rf lib/udp_bridge bitbots_misc/bitbots_containers \
humanoid_league_visualization dynamic_stack_decider/dynamic_stack_decider_visualization bitbots_lowlevel \
Expand All @@ -69,13 +69,13 @@ RUN cd src/bitbots_meta && \

# Install ros dependencies with rosdep
RUN sudo apt update && rosdep update
RUN cd src/bitbots_meta && rosdep install --rosdistro=iron --from-paths . --ignore-src -r -y
RUN cd src/bitbots_main && rosdep install --rosdistro=iron --from-paths . --ignore-src -r -y

RUN . /opt/ros/iron/setup.sh && colcon build --cmake-args -DBUILD_TESTING=OFF

# TODO execute tests

RUN cp src/bitbots_meta/bitbots_wolfgang/wolfgang_robocup_api/scripts/start.sh .local/bin/start
RUN cp src/bitbots_main/bitbots_wolfgang/wolfgang_robocup_api/scripts/start.sh .local/bin/start

# Volume for logs
VOLUME /robocup-logs
Expand Down
2 changes: 1 addition & 1 deletion bitbots_misc/bitbots_docs/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and see if you can find something.

If you want to take a look at the code, our Github Organisation is also named `Bit-Bots
<https://github.com/bit-bots>`_.
The main repository is `bitbots_meta <https://github.com/bit-bots/bitbots_meta>`_ and everything is linked from there.
The main repository is `bitbots_main <https://github.com/bit-bots/bitbots_main>`_.

.. toctree::
:maxdepth: 1
Expand Down
2 changes: 1 addition & 1 deletion bitbots_misc/bitbots_docs/docs/manual/testing/sim_test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Test the complete software stack in simulation
.. code-block:: bash
ros2 launch bitbots_bringup simulator_teamplayer.launch
ros2 run humanoid_league_game_controller sim_gamestate.py
ros2 run game_controller_hl sim_gamestate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
How to document
===============

Our documentation is published under `doku.bit-bots.de <https://doku.bit-bots.de>`_ and `docs.bit-bots.de <https://docs.bit-bots.de>`_ and will automatically be regenerated from the package `bitbots_meta/bitbots_misc/bitbots_docs <https://github.com/bit-bots/bitbots_meta/tree/master/bitbots_misc/bitbots_docs>`_.
Our documentation is published under `doku.bit-bots.de <https://doku.bit-bots.de>`_ and `docs.bit-bots.de <https://docs.bit-bots.de>`_ and will automatically be regenerated from the package `bitbots_main/bitbots_misc/bitbots_docs <https://github.com/bit-bots/bitbots_main/tree/master/bitbots_misc/bitbots_docs>`_.

Installation of dependencies
============================
Expand All @@ -23,7 +23,7 @@ How to build the documentation

.. code-block:: bash
cd bitbots_meta/bitbots_misc/bitbots_docs
cd bitbots_main/bitbots_misc/bitbots_docs
2. Build the sphinx docs for the given package.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ As such you can lookup some of the needed requirements there.

- have an LDAP mafiasi account for access to the CLs
- have ros2 aliases setup (see linked docs)
- have github ssh access setup for bitbots_meta (see linked docs)
- have GitHub ssh access setup for bitbots_main (see linked docs)

**1. Setup and download our software**

- SSH into the ``cl0*`` with your mafiasi user
- setup bitbots_meta in your home directory
- setup bitbots_main in your home directory

.. code-block:: bash
mkdir -p "~/colcon_ws/src"
cd "~/colcon_ws/src"
git clone [email protected]:bit-bots/bitbots_meta.git && cd bitbots_meta
git clone [email protected]:bit-bots/bitbots_main.git && cd bitbots_main
make install-no-root
- set PATH and COLCON_WS (see `section 5 <https://docs.bit-bots.de/meta/manual/tutorials/install_software_ros2.html>`_)

**2. Compile the packages**

If while testing you are changing code or updating ``bitbots_meta`` via ``make pull-all``,
If while testing you are changing code or updating ``bitbots_main`` via ``make pull-all``,
this step needs to be done again.
For compilation of the whole meta repository run ``cba``, which is an alias for:
``cd $COLCON_WS; colcon build --symlink-install --continue-on-error``
Expand All @@ -47,7 +47,7 @@ In the simulator we should see a field with a single robot.

With ``game_controller:=false`` we ensure, that the game_controller_listener is not started as well, but instead
we will simulate the current gamestate by our own script (in another terminal):
``rr humanoid_league_game_controller sim_gamestate.py``
``rr game_controller_hl sim_gamestate.py``

Which allows us to simulate the current gamestate and different phases of the game.
Now everything is ready for some simulation testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ At a competition, follow these steps:
This needs to be done before the competition at the team area (see :doc:`competition_wifi`)!

#. **Checkout the latest code:**
In your local `bitbots_meta <https://github.com/bit-bots/bitbots_meta>`_ repo run:
In your local `bitbots_main <https://github.com/bit-bots/bitbots_main>`_ repo run:

#. Check that you are on the ``master`` branch
#. ``git pull`` to get the latest changes
#. ``make fresh-libs`` to clean and update all third party libraries

#. **Sync, configure, compile and launch software:**
In the ``bitbots_meta`` directory call the ``deploy_robots.py`` tool:
In the ``bitbots_main`` directory call the ``deploy_robots.py`` tool:

.. code-block:: bash
./scripts/deploy_robots.py <nuc* | robot_name | ALL>
This does the 5 following tasks:
- Synchronize/Copy the current state of your local bitbots_meta directory to the robot(s)
- Synchronize/Copy the current state of your local bitbots_main directory to the robot(s)
- Install ROS 2 dependencies using `rosdep` on the robot(s), if internet is available
- Configure game specific settings and the Wi-Fi connection on the robot(s)
- Build/Compile the source code you just synchronized to the robot(s)
- Launch the teamplayer software on the robot(s)

If you need help with this tool, or want other options, look at `this README <https://github.com/bit-bots/bitbots_meta/blob/master/scripts/README.md#deploy_robotspy>`_ for example usages or call:
If you need help with this tool, or want other options, look at `this README <https://github.com/bit-bots/bitbots_main/blob/master/scripts/README.md#deploy_robotspy>`_ for example usages or call:

.. code-block:: bash
Expand Down Expand Up @@ -116,9 +116,9 @@ Ansible will execute the playbook with the ``bitbots`` user on the robots and wi
LEGACY: Sync/Build the software using the ``robot_compile`` tool:
-----------------------------------------------------------------

We utilize a python script located in ``bitbots_meta/scripts/robot_compile.py`` to allow doing the following:
We utilize a python script located in ``bitbots_main/scripts/robot_compile.py`` to allow doing the following:

- sync the local code of the whole ``bitbots_meta`` or a single package onto a robot
- sync the local code of the whole ``bitbots_main`` or a single package onto a robot
- build the synced code on the robot afterwards
- automatically install required dependencies with ``rosdep install`` if the robot has an active internet connection
- clean the whole ``~/colcon_ws`` on a robot
Expand All @@ -131,7 +131,7 @@ A full overview all the options are viewable with the ``-h`` flag.

.. code-block:: bash
# full sync/build of bitbots_meta
# full sync/build of bitbots_main
./scripts/robot_compile.py nuc1
# rm everything before full sync/compile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ If you are not already using Ubuntu 22.04, consider installing it on your system
- Add your SSH key to GitHub to access and sync our repositories
- If you don't know what I am talking about or you don't yet have a SSH key, follow this guide: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys
- Go to your account settings and add your SSH key (the ``.pub`` file) for `GitHub <https://github.com/settings/keys>`_ AND `Gitea <https://git.mafiasi.de/user/settings/keys>`_
- Now, you can clone (download) our main code repository (repo) called `bitbots_meta <https://github.com/bit-bots/bitbots_meta>`_:
- Now, you can clone (download) our main code repository (repo) called `bitbots_main <https://github.com/bit-bots/bitbots_main>`_:
- Open a terminal and go to the directory where you want to download our code (typically ``~/git/bitbots/``)
- Create the directory with: ``mkdir -p ~/git/bitbots``
This is were your source code will live and grow.
- Move to this directory with: ``cd ~/git/bitbots``
- Clone the code repository with: ``git clone [email protected]:bit-bots/bitbots_meta.git``
- Clone the code repository with: ``git clone [email protected]:bit-bots/bitbots_main.git``
Confirm the host key by typing ``yes``, if asked.
- Move into the newly created directory with: ``cd bitbots_meta``
- Move into the newly created directory with: ``cd bitbots_main``
- Clone all code and other files by running: ``make install``
This will take a while, as it downloads all the code and other files from our repositories and additionally installs all missing dependencies (using rosdep and pip).
Finally, it will register pre-commit hooks (automatic code-formatting and warnings), which will be run every time you commit code to our repositories.
Expand All @@ -61,7 +61,7 @@ The colcon workspace is where your source code gets build and where we use colco

- Create colcon workspace directory (typically ``~/colcon_ws/``)
- Create directory with: ``mkdir -p ~/colcon_ws/src``
- Link our software contained in the bitbots_meta repo to the newly created ``src`` directory with: ``ln -s ~/git/bitbots/bitbots_meta/ ~/colcon_ws/src/bitbots_meta``
- Link our software contained in the bitbots_main repo to the newly created ``src`` directory with: ``ln -s ~/git/bitbots/bitbots_main/ ~/colcon_ws/src/bitbots_main``

**5. Final touches**

Expand Down
1 change: 0 additions & 1 deletion bitbots_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ rosidl_generate_interfaces(
"msg/Cpu.msg"
"msg/Filesystem.msg"
"msg/FootPressure.msg"
"msg/GameState.msg"
"msg/HeadMode.msg"
"msg/JointCommand.msg"
"msg/JointTorque.msg"
Expand Down
Loading

0 comments on commit cb12761

Please sign in to comment.