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

Refactoring #226

Merged
merged 15 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from 8 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: ros-tooling/setup-ros@v0.2
with:
use-ros2-testing: true
required-ros-distributions: galactic
required-ros-distributions: humble
- name: Install Custom Dependencies
run: |
# Webots (temporary disabled)
Expand All @@ -34,4 +34,4 @@ jobs:
- name: Build packages and run and tests
uses: ros-tooling/action-ros-ci@v0.2
with:
target-ros2-distro: galactic
target-ros2-distro: humble
4 changes: 2 additions & 2 deletions .github/workflows/linter_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
linters: [cpplint, xmllint, lint_cmake]
packages: [mep3_driver, mep3_behavior_tree, mep3_navigation]
packages: [mep3_driver, mep3_behavior, mep3_navigation]
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -22,6 +22,6 @@ jobs:
- name: Run linter ${{ matrix.linters }} for package ${{ matrix.packages }}
uses: ros-tooling/action-ros-lint@v0.1
with:
distribution: galactic
distribution: humble
linter: ${{ matrix.linters }}
package-name: ${{ matrix.packages }}
2 changes: 1 addition & 1 deletion .github/workflows/linter_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
- name: Run linter ${{ matrix.linters }} for package ${{ matrix.packages }}
uses: ros-tooling/action-ros-lint@v0.1
with:
distribution: galactic
distribution: humble
linter: ${{ matrix.linters }}
package-name: ${{ matrix.packages }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.vscode/
.vscode/settings.json
.idea/
build/
install/
Expand Down
28 changes: 28 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations": [
{
"name": "ROS2 Humble",
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"${env:HOME}/webots/include/controller/cpp",
"/usr/include/python3.10",
"/usr/include",
"/opt/ros/humble/include",
"/opt/ros/humble/include/rclcpp",
"${workspaceFolder}/mep3_behavior/include",
"${workspaceFolder}/../../install/mep3_msgs/include/mep3_msgs",
"${workspaceFolder}/mep3_driver/include",
"${workspaceFolder}/mep3_navigation/include",
"${workspaceFolder}/mep3_simulation/include"
],
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/g++",
"cStandard": "c99",
"cppStandard": "c++17"
}
],
"version": 4
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Memristor Eurobot Platform based on ROS 2
## Getting started

```sh
# Make sure you have ROS 2 Galactic installed.
# https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html
# Make sure you have ROS 2 Humble installed.
# https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html

# Source ROS 2
source /opt/ros/galactic/local_setup.bash
source /opt/ros/humble/local_setup.bash

# Create a workspace
mkdir -p ~/galactic_ws/src
cd ~/galactic_ws
mkdir -p ~/humble_ws/src
cd ~/humble_ws
git clone git@github.com:memristor/mep3.git src/mep3
# On embedded device: touch src/mep3/mep3_simulation/COLCON_IGNORE

Expand Down Expand Up @@ -80,7 +80,7 @@ ros2 launch mep3_bringup simulation_launch.py bt:=false
```
- Control the robot from another terminal window
```sh
source /opt/ros/galactic/local_setup.bash
source /opt/ros/humble/local_setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r cmd_vel:=big/cmd_vel
```
- Run the simulation with the behavior tree:
Expand All @@ -105,17 +105,17 @@ ros2 launch mep3_bringup rviz_launch.py
- Change working directory to `~/ros2_ws`
- Run the following command:
```sh
source /opt/ros/galactic/local_setup.bash
source /opt/ros/humble/local_setup.bash
colcon test --event-handlers console_cohesion+ --return-code-on-test-failure
```

### BehaviorTree strategies

Robot strategies are located inside [mep3_behavior_tree/assets](./mep3_behavior_tree/assets)
Robot strategies are located inside [mep3_behavior/assets](./mep3_behavior/assets)
directory with the following hierarchy:

```ini
mep3_behavior_tree/assets
mep3_behavior/assets
- skills/
- big_retract_hands.xml # skill for Big robot
- small_replace_statuette.xml # skill for Small robot
Expand Down
7 changes: 7 additions & 0 deletions docker/config/Cyberobotics/Webots-R2022b.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ startupMode=Real-time
telemetry=false
theme=webots_night.qss

[OpenGL]
GTAO=0
disableAntiAliasing=true
disableShadows=true
textureFiltering=1
textureQuality=0

[Internal]
firstLaunch=false
20 changes: 0 additions & 20 deletions docker/config/shortcuts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ shortcut_scratchpad_print() {
$1 == "navigate_to_pose" {
printf "<Action ID=\"NavigateToAction\" goal=\"%s;%s;%.5f\" />\n", $2, $3, $4;
}
$1 == "precise_navigate_to_pose" {
printf "<Action ID=\"PreciseNavigateToAction\" goal=\"%s;%s;%.5f\" />\n", $2, $3, $4;
}
$1 == "dynamixel" {
printf "<Action ID=\"DynamixelCommandAction\" server_name=\"dynamixel_command/%s\" position=\"%s\" velocity=\"%s\" tolerance=\"%s\" timeout=\"%s\" result=\"0\" />\n", $2, $3, $4, $5, $6;
}
Expand Down Expand Up @@ -387,20 +384,3 @@ shortcut_scoreboard_task() {
eval "ros2 topic pub --once /scoreboard mep3_msgs/msg/Scoreboard '${message}'"
}
alias sc="shortcut_scoreboard_task"

## Launch ResistanceMeterAction action
# Arguments:
# - namespace [optional]
# - side [right/left] [optional]
shortcut_resistance_meter() {
if echo "$2" | grep -qv '^[0-9\.-]*$'; then
namespace="${1:-big}"
shift
else
namespace='big'
fi
side="${1:-right}"
last_action="resistance_meter ${task} ${points}"
eval "ros2 action send_goal /${namespace}/resistance_meter/${side} mep3_msgs/action/ResistanceMeter {}"
}
alias re="shortcut_resistance_meter"
61 changes: 0 additions & 61 deletions install.bash

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
cmake_minimum_required(VERSION 3.5)
project(mep3_behavior_tree)
project(mep3_behavior)

# Default to C17
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 99)
endif()

# Default to C++20
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<!-- ////////// -->
<BehaviorTree ID="BehaviorTree">
<SequenceStar>
<WaitMatchStart state="1" />

<AddObstacle label="initial" polygon="0.0;0.0|0.2;0.0|0.0;0.2" />
<AddObstacle label="initial" polygon="0.0;0.0|-0.2;0.0|0.0;-0.2" />
<Navigate goal="-0.8;0.0;0" />
<RemoveObstacle label="initial" />
<!-- <Navigate goal="0.3;0.3;0" /> -->
<!-- <RemoveObstacle label="initial" /> -->

<Wait duration="100000.0" name="Wait one big purple main strategy" />
</SequenceStar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <iostream>
#include <string>

#include "mep3_behavior_tree/pose_2d.hpp"
#include "mep3_behavior/pose_2d.hpp"
#include "mep3_msgs/msg/temporal_obstacle.hpp"

#include "behaviortree_cpp_v3/behavior_tree.h"
Expand All @@ -27,7 +27,7 @@
#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/point.hpp"

namespace mep3_behavior_tree
namespace mep3_behavior
{
class AddObstacleAction : public BT::AsyncActionNode
{
Expand Down Expand Up @@ -73,6 +73,6 @@ namespace mep3_behavior_tree
return BT::NodeStatus::SUCCESS;
}

} // namespace mep3_behavior_tree
} // namespace mep3_behavior

#endif // MEP3_BEHAVIOR_TREE__ADD_OBSTACLE_ACTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "behaviortree_cpp_v3/control_node.h"
#include "rclcpp/rclcpp.hpp"

namespace mep3_behavior_tree
namespace mep3_behavior
{

class CompareBlackboardControl : public BT::ControlNode
Expand Down Expand Up @@ -368,6 +368,6 @@ class PassAction : public BT::SyncActionNode
}
};

} // namespace mep3_behavior_tree
} // namespace mep3_behavior

#endif // MEP3_BEHAVIOR_TREE__BLACKBOARD_CONTROL_FLOW_HPP_
Loading