GithubHelp home page GithubHelp logo

rigbetel_labs_micro_ros's Introduction

Create a data type that looks like the following and name my_custom_message

│   my_custom_message
│       ├── bool bool_value
│       ├── int8 integer_value
│       │── float float_value
│       ├── String string_value

Adding a custom message as a new package to the build system

First, we are going to create a new package, I assume that you have a ROS 2 Humble installation in your computer (let me know if not):

# Go to this library folder installation
cd ~/Arduino/libraries/micro_ros_arduino-0.0.1

# Go to the extra_packages folder and create there you new msg package:
pushd extras/library_generation/extra_packages

# Here follow the instructions of this tutorial: https://micro-ros.github.io/docs/tutorials/core/create_new_type/
ros2 pkg create --build-type ament_cmake my_custom_message
[...]

At the end of this procedure you should have custom message inside the folder:

extras/library_generation/
├── ...
├── extra_packages
│   ├── extra_packages.repos
│   └── my_custom_message
│       ├── CMakeLists.txt
│       ├── include
│       │   └── my_custom_message
│       ├── msg
│       │   └── MyCustomMessage.msg
│       ├── package.xml
│       └── src
└── ...

Regarding this new extra_packages folder we have two possibilities:

  • Adding directly folders that contain ROS 2 packages
  • Adding an entry to this file, you can see a sample of this kind of files here. This option allows you to automatically download a Git repo every time the library is built.

If the packages that you are going to add are standard enough, maybe we can add them to this repo extra_packages.repos.

Rebuilding your own version of the micro-ROS library for Arduino

Now we are going to use docker to build our custom version of the library. In this case, this custom version of the library will have the extra msg that you just have included, but for example, is also possible to modify the configuration of the micro-ROS layers by customizing some of the .meta files.

# Go to this library folder installation
cd ~/Arduino/libraries/micro_ros_arduino-0.0.1

# Use the docker to build all the necessary stuff:
docker pull microros/micro_ros_static_library_builder:humble
docker run -it -v $(pwd):/arduino_project --net=host microros/micro_ros_static_library_builder:humble

If you want to build just for your platform, use:

docker run -it --rm -v $(pwd):/arduino_project microros/micro_ros_static_library_builder:humble

Then upload the 'Arduino code'

Start the Micro ROS agent

ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0

Then echo the topic "/micro_ros_arduino_node_publisher" to see whether the topic is being published or not.

ros2 topic echo /micro_ros_arduino_node_publisher 

image

rigbetel_labs_micro_ros's People

Contributors

krishna4104 avatar

Watchers

 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.