Skip to content

Commit

Permalink
Merge branch 'ClemensElflein:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ene9ba authored Aug 3, 2024
2 parents 6d8c934 + 1d9fe79 commit 4214f7c
Show file tree
Hide file tree
Showing 108 changed files with 94,855 additions and 98,347 deletions.
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BasedOnStyle: Google
ColumnLimit: 120
AllowShortFunctionsOnASingleLine: None
AllowShortCaseLabelsOnASingleLine: true
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
web/* linguist-vendored

7 changes: 0 additions & 7 deletions .github/pr-labeler.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clear_github_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
cache_id: cache.id,
})
}
console.log("Clear completed")
console.log("Clear completed")
11 changes: 0 additions & 11 deletions .github/workflows/label-prs.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ CATKIN_IGNORE

cmake-build-debug/
.vscode

25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
exclude: '^(config|web)/.+$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: pretty-format-json
args: [--autofix, --no-sort-keys]
- id: check-merge-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: forbid-new-submodules
- id: mixed-line-ending
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: [--style=file, -i]
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,3 @@ the avoidance of doubt, this paragraph does not form part of the
public licenses.

Creative Commons may be contacted at creativecommons.org.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,3 @@ Copy the settings for **Build directory** and **CMake options**. Everything else
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.

Feel free to use the design in your private/educational projects, but don't try to sell the design or products based on it without getting my consent first. The idea here is to share knowledge, not to enable others to simply sell my work. Thank you for understanding.

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

16 changes: 14 additions & 2 deletions devenv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ ARG MY_USER
RUN groupadd -g ${MY_GID} -o ${MY_USER}

# Create a new user, assign it to the group, and set its shell to bash
RUN useradd -m -u ${MY_UID} -g ${MY_GID} -o -s /bin/bash ${MY_USER}
RUN useradd -m -u ${MY_UID} -g ${MY_GID} -o -s /bin/bash ${MY_USER} && yes ${MY_USER} | passwd ${MY_USER}

RUN apt-get update && apt-get install -y zsh git
RUN apt-get update && apt-get install -y zsh git sudo ssh gdb rsync
RUN echo "$MY_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PermitRootLogin yes'; \
echo 'PasswordAuthentication yes'; \
echo 'ListenAddress 0.0.0.0:2222'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_clion \
&& mkdir /run/sshd
RUN bash -c "ssh-keygen -A"

# Update rosdep package manager for ROS
RUN rosdep update --rosdistro $ROS_DISTRO
Expand All @@ -36,3 +47,4 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*


CMD ["sudo", "/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_clion"]
2 changes: 1 addition & 1 deletion devenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ A Dockerized version of ros-noetic-desktop-full.

## How to use
- run `./start_devenv.sh` to build and run the ROS container. This will start the container in the background, you can attach to it later.
- run `./attach.sh` to attach to the container. You should be able to do `catkin_make` and also use tools like `rviz`
- run `./attach.sh` to attach to the container. You should be able to do `catkin_make` and also use tools like `rviz`
1 change: 0 additions & 1 deletion devenv/attach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ export MY_UID=$(id -u)
export MY_GID=$(id -g)
export MY_USER=${USER}
docker compose exec -it ros /ros_entrypoint.sh bash

4 changes: 1 addition & 3 deletions devenv/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ services:
- MY_UID=${MY_UID:-1000}
- MY_GID=${MY_GID:-1000}
- MY_USER=${MY_USER:-dev}
# this will block forever and keep the container running
command: tail -F /dev/null
environment:
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
Expand All @@ -17,4 +15,4 @@ services:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ../:/workspace:rw
user: "${MY_UID:-1000}:${MY_GID:-1000}"

network_mode: "host"
1 change: 0 additions & 1 deletion devenv/start_devenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export MY_GID=$(id -g)
export MY_USER=${USER}
docker compose down
docker compose up --build -d --wait

2 changes: 1 addition & 1 deletion docker/assets/mosquitto.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ allow_anonymous true

listener 9001
protocol websockets
allow_anonymous true
allow_anonymous true
Binary file added pre-commit
Binary file not shown.
2 changes: 2 additions & 0 deletions src/lib/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DisableFormat: true
SortIncludes: Never
2 changes: 1 addition & 1 deletion src/lib/slic3r_coverage_planner
2 changes: 1 addition & 1 deletion src/lib/xbot_driver_gps
2 changes: 1 addition & 1 deletion src/lib/xbot_monitoring
2 changes: 1 addition & 1 deletion src/lib/xbot_msgs
Submodule xbot_msgs updated 1 files
+3 −0 msg/RobotState.msg
164 changes: 71 additions & 93 deletions src/mower_comms/src/COBS.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifndef SRC_COBS_H
#define SRC_COBS_H


/// \brief A Consistent Overhead Byte Stuffing (COBS) Encoder.
///
/// Consistent Overhead Byte Stuffing (COBS) is an encoding that removes all 0
Expand All @@ -24,106 +23,85 @@
/// \sa http://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
/// \sa https://github.com/jacquesf/COBS-Consistent-Overhead-Byte-Stuffing
/// \sa http://www.jacquesf.com/2011/03/consistent-overhead-byte-stuffing
class COBS
{
public:
/// \brief Encode a byte buffer with the COBS encoder.
/// \param buffer A pointer to the unencoded buffer to encode.
/// \param size The number of bytes in the \p buffer.
/// \param encodedBuffer The buffer for the encoded bytes.
/// \returns The number of bytes written to the \p encodedBuffer.
/// \warning The encodedBuffer must have at least getEncodedBufferSize()
/// allocated.
static size_t encode(const uint8_t* buffer,
size_t size,
uint8_t* encodedBuffer)
{
size_t read_index = 0;
size_t write_index = 1;
size_t code_index = 0;
uint8_t code = 1;

while (read_index < size)
{
if (buffer[read_index] == 0)
{
encodedBuffer[code_index] = code;
code = 1;
code_index = write_index++;
read_index++;
}
else
{
encodedBuffer[write_index++] = buffer[read_index++];
code++;

if (code == 0xFF)
{
encodedBuffer[code_index] = code;
code = 1;
code_index = write_index++;
}
}
class COBS {
public:
/// \brief Encode a byte buffer with the COBS encoder.
/// \param buffer A pointer to the unencoded buffer to encode.
/// \param size The number of bytes in the \p buffer.
/// \param encodedBuffer The buffer for the encoded bytes.
/// \returns The number of bytes written to the \p encodedBuffer.
/// \warning The encodedBuffer must have at least getEncodedBufferSize()
/// allocated.
static size_t encode(const uint8_t* buffer, size_t size, uint8_t* encodedBuffer) {
size_t read_index = 0;
size_t write_index = 1;
size_t code_index = 0;
uint8_t code = 1;

while (read_index < size) {
if (buffer[read_index] == 0) {
encodedBuffer[code_index] = code;
code = 1;
code_index = write_index++;
read_index++;
} else {
encodedBuffer[write_index++] = buffer[read_index++];
code++;

if (code == 0xFF) {
encodedBuffer[code_index] = code;
code = 1;
code_index = write_index++;
}
}
}

encodedBuffer[code_index] = code;
encodedBuffer[code_index] = code;

return write_index;
}
return write_index;
}

/// \brief Decode a COBS-encoded buffer.
/// \param encodedBuffer A pointer to the \p encodedBuffer to decode.
/// \param size The number of bytes in the \p encodedBuffer.
/// \param decodedBuffer The target buffer for the decoded bytes.
/// \returns The number of bytes written to the \p decodedBuffer.
/// \warning decodedBuffer must have a minimum capacity of size.
static size_t decode(const uint8_t* encodedBuffer, size_t size, uint8_t* decodedBuffer) {
if (size == 0) return 0;

/// \brief Decode a COBS-encoded buffer.
/// \param encodedBuffer A pointer to the \p encodedBuffer to decode.
/// \param size The number of bytes in the \p encodedBuffer.
/// \param decodedBuffer The target buffer for the decoded bytes.
/// \returns The number of bytes written to the \p decodedBuffer.
/// \warning decodedBuffer must have a minimum capacity of size.
static size_t decode(const uint8_t* encodedBuffer,
size_t size,
uint8_t* decodedBuffer)
{
if (size == 0)
return 0;

size_t read_index = 0;
size_t write_index = 0;
uint8_t code = 0;
uint8_t i = 0;

while (read_index < size)
{
code = encodedBuffer[read_index];

if (read_index + code > size && code != 1)
{
return 0;
}

read_index++;

for (i = 1; i < code; i++)
{
decodedBuffer[write_index++] = encodedBuffer[read_index++];
}

if (code != 0xFF && read_index != size)
{
decodedBuffer[write_index++] = '\0';
}
}
size_t read_index = 0;
size_t write_index = 0;
uint8_t code = 0;
uint8_t i = 0;

return write_index;
}
while (read_index < size) {
code = encodedBuffer[read_index];

if (read_index + code > size && code != 1) {
return 0;
}

read_index++;

/// \brief Get the maximum encoded buffer size for an unencoded buffer size.
/// \param unencodedBufferSize The size of the buffer to be encoded.
/// \returns the maximum size of the required encoded buffer.
static size_t getEncodedBufferSize(size_t unencodedBufferSize)
{
return unencodedBufferSize + unencodedBufferSize / 254 + 1;
for (i = 1; i < code; i++) {
decodedBuffer[write_index++] = encodedBuffer[read_index++];
}

if (code != 0xFF && read_index != size) {
decodedBuffer[write_index++] = '\0';
}
}

};
return write_index;
}

/// \brief Get the maximum encoded buffer size for an unencoded buffer size.
/// \param unencodedBufferSize The size of the buffer to be encoded.
/// \returns the maximum size of the required encoded buffer.
static size_t getEncodedBufferSize(size_t unencodedBufferSize) {
return unencodedBufferSize + unencodedBufferSize / 254 + 1;
}
};

#endif
#endif
Loading

0 comments on commit 4214f7c

Please sign in to comment.