Code Monkey home page Code Monkey logo

micro_ros_msgs's Introduction

micro_ros_msgs

Summary

Collection of ROS 2 message definitions used throughout the implementation of micro-ROS, both in the server (micro-ROS Agent) and client (micro-ROS RMW) endpoints.

Purpose of the Project

This software is not ready for production use. It has neither been developed nor tested for a specific use case. However, the license conditions of the applicable Open Source licenses allow you to adapt the software to your needs. Before using it in a safety relevant setting, make sure that the software fulfills your requirements and adjust it according to any applicable safety standards, e.g., ISO 26262.

License

This repository is open-sourced under the Apache-2.0 license. See the LICENSE file for details.

Known Issues/Limitations

There are no known limitations.

micro_ros_msgs's People

Contributors

pablogs9 avatar jamoralp avatar acuadros95 avatar mergify[bot] avatar

Stargazers

 avatar Gonzalo G. Fernández avatar Zhengyang Wu avatar Haowei Wen avatar Abdelhak Bougouffa avatar

Watchers

James Cloos avatar Mateusz Maciaś avatar Ralph Lange avatar  avatar

micro_ros_msgs's Issues

Industrial CI CMake tests error

Attaching the repository to workspace https://github.com/husarion/rosbot_ros/tree/ros2-combined-microros with industrial CI doesn't pass tests:

$ ( source /opt/ros/humble/setup.bash && cd /root/target_ws && colcon test-result --verbose; )
build/micro_ros_msgs/Testing/20231205-1159/Test.xml: 3 tests, 0 errors, 1 failure, 0 skipped
- copyright
  <<< failure message
    -- run_test.py: invoking following command in '/root/target_ws/src/rosbot_ros/src/micro_ros_msgs':
     - /opt/ros/humble/bin/ament_copyright --xunit-file /root/target_ws/build/micro_ros_msgs/test_results/micro_ros_msgs/copyright.xunit.xml
    CONTRIBUTING.md: file not found
    1 errors, checked 2 files
    -- run_test.py: return code 1
    -- run_test.py: verify result file '/root/target_ws/build/micro_ros_msgs/test_results/micro_ros_msgs/copyright.xunit.xml'
  >>>
build/micro_ros_msgs/test_results/micro_ros_msgs/copyright.xunit.xml: 2 tests, 0 errors, 1 failure, 0 skipped
- micro_ros_msgs.copyright CONTRIBUTING.md
  <<< failure message
    file not found
  >>>

Trying to subscribe to a FloatArray

Ubuntu 22.02
ROS2 humble
micro-ros humble
Teensy 4.1

#include <micro_ros_arduino.h>

#include <stdio.h>
#include <rcl/rcl.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

#include <std_msgs/msg/float32_multi_array.h>

rcl_subscription_t subscriber;
std_msgs__msg__Float32MultiArray msg//[]={0.0,1.1,2.2};
rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;
rcl_timer_t timer;

#define LED_PIN 13

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

void error_loop(){
  while(1){
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(100);
  }
}

void subscription_callback(const void * msgin)
{  
  const std_msgs__msg__Float32MultiArray * msg = (const std_msgs__msg__Float32MultiArray *)msgin;
    
}

void setup() {
  //Serial.begin(9600);
  set_microros_transports();
  
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);  
  
  delay(2000);

  allocator = rcl_get_default_allocator();

  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "micro_ros_arduino_node", "", &support));

  // create subscriber
  RCCHECK(rclc_subscription_init_default(
    &subscriber,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Float32MultiArray),
    "micro_ros_arduino_subscriber"));
  //Serial.write("msg");
  //Serial.println(msg.data);
  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_subscription(&executor, &subscriber, &msg, &subscription_callback, ON_NEW_DATA));
  
}

void loop() {
  delay(100);
  RCCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
  if (msg.data=={5.0, 6.0, 4.0})
  {
    digitalWrite(LED_PIN, HIGH);  
  }


  if (msg.data[1]==2.0)
  {
    digitalWrite(LED_PIN, LOW);  
  }
  
}

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.