GithubHelp home page GithubHelp logo

sichitong / mep3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from memristor/mep3

0.0 0.0 0.0 14.57 MB

Memristor Eurobot Platform based on ROS 2

Home Page: https://memristorrobotics.com

License: Apache License 2.0

Shell 2.73% C++ 36.53% Python 14.33% C 43.80% Makefile 0.93% CMake 1.68%

mep3's Introduction

mep3

Memristor Eurobot Platform based on ROS 2 image

Table of contents

Getting started

# 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/humble/local_setup.bash

# Create a workspace
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
git clone [email protected]:memristor/mep3.git src/mep3
# On embedded device: touch src/mep3/mep3_simulation/COLCON_IGNORE

# Install dependencies
sudo apt install python3-vcstool
vcs import src < src/mep3/mep3.repos
rosdep update
rosdep install --from-paths src --ignore-src -r

# Create udev rules so rplidar and dynamixel usb ports static names
sudo cp src/mep3/tools/rplidar.rules /etc/udev/rules.d/
sudo cp src/mep3/tools/dynamixel.rules /etc/udev/rules.d/

# Build the packages
colcon build

# Source this workspace
source install/local_setup.bash

Please check alternative installation methods here.

Webots world simulation

webots ~/ros2_ws/src/mep3/mep3_simulation/webots_data/worlds/eurobot_2022.wbt
  • Stop simulation and set time to 00:00:00
  • Save changes
  • Commit all changes except for Viewpoint

ROS 2 platform

Compilaton

  • Change working directory to ~/ros2_ws
  • Install dependencies if there are changes in package.xml files
rosdep install --from-paths src --ignore-src -r
  • Build files (and rebuild on every modification):
colcon build
source ./install/local_setup.bash

Running the simulation

  • Run the simulation without the behavior tree:
ros2 launch mep3_bringup simulation_launch.py bt:=false
  • Control the robot from another terminal window
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:
ros2 launch mep3_bringup simulation_launch.py

Navigation 2 stack

To launch simulation with nav2 run:

ros2 launch mep3_bringup simulation_launch.py

Open RViz afterwards using:

ros2 launch mep3_bringup rviz_launch.py

Testing

  • Change working directory to ~/ros2_ws
  • Run the following command:
    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/assets directory with the following hierarchy:

mep3_behavior/assets
  - skills/
    - big_retract_hands.xml         # skill for Big robot
    - small_replace_statuette.xml   # skill for Small robot
    - common_retract_hands.xml      # skill for both robots
  - tasks/
    - small_collect_dispenser.xml   # task for Small robot
    - big_fill_work_shed.xml        # task for Big robot
  - strategies/
    - big/
      - purple_strategy.xml         # default strategy for Big robot
      - test_strategy_2.xml         # example test strategy
    - small/
      - purple_strategy.xml         # default strategy for Small robot

Example skill:

<root main_tree_to_execute="skill_retract_hands">
    <BehaviorTree ID="skill_retract_hands">
        <Parallel failure_threshold="1" success_threshold="6">
            <Dynamixel label="arm_right_motor_base" position="0" />
            <Dynamixel label="arm_left_motor_base" position="0" />
        </Parallel>
    </BehaviorTree>
</root>

Example task:

<root main_tree_to_execute="WorkingShed">
    <include path="../../skills/common_scoreboard.xml" />
    <BehaviorTree ID="WorkingShed">
        <SequenceStar>
            <Navigate goal="1;1;180" />
            <SubTree ID="ScoreboardWorkShed" __shared_blackboard="true" />
        </SequenceStar>
    </BehaviorTree>
</root>

Example strategy:

<root main_tree_to_execute="BehaviorTree">
    <include path="../tasks/small_working_shed.xml" />
    <BehaviorTree ID="BehaviorTree">
        <SequenceStar>
            <Wait duration="5.0" name="Wait a bit" />
            <Navigate goal="1;1;180" />
            <SubTree ID="WorkingShed" __shared_blackboard="true" />
        </SequenceStar>
    </BehaviorTree>
</root>

Strategy file should include tasks, which in turn include skills. Skill subtrees can also be called from strategies directly.

Table-specific action values

When table:=example parameter is passed, actions defined in BehaviorTree XML files will attempt to use port named port_example instead of port if it exists.

Currently supported table-specific action port offsets are:

  • Dynamixel: position
  • Motion: value
  • Navigate, PreciseNavigate, NavigateThrough: goal
  • ResistanceMeter: resistance

Example Navigate action with values for tables foo and bar:

<Navigate goal="0.1;0.2;30" goal_foo="-0.003;+0.009;+00.3" goal_bar="-.007;-0.01;+0.1" />

Terminal shortcuts

We use custom terminal shortcuts to provide better development environment ergonomics.

# Enable terminal shortcuts temporarily
source ~/ros2_ws/src/mep3/docker/config/shortcuts.sh

# Enable terminal shortcuts permanently
echo "source ~/ros2_ws/src/mep3/docker/config/shortcuts.sh" >> ~/.bashrc
source ~/.bashrc

After enabling shortcuts, run command h in the terminal to get familiarized with them.

mep3's People

Contributors

angstrem98 avatar darda5 avatar filiparag avatar hepek93 avatar lukicdarkoo avatar marijagolubovic avatar miloshunter avatar vladimirvincan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.