Code Monkey home page Code Monkey logo

Comments (7)

pablogs9 avatar pablogs9 commented on June 19, 2024

I'm going to reproduce this.

from micro_ros_espidf_component.

pablogs9 avatar pablogs9 commented on June 19, 2024

I have this working properly:

int main(int argc, const char * const * argv)
{
  	rcl_allocator_t allocator = rcl_get_default_allocator();
	rclc_support_t support;

	// Create init_options
	RCCHECK(rclc_support_init(&support, argc, argv, &allocator));

	// Create node
	rcl_node_t node;
	RCCHECK(rclc_node_init_default(&node, "node", "", &support));

	// Create publishers

	rcl_publisher_t publisher;
	RCCHECK(rclc_publisher_init_default(
		&publisher,
		&node,
    	ROSIDL_GET_MSG_TYPE_SUPPORT(sensor_msgs, msg, CompressedImage),
		"topic"));


	static micro_ros_utilities_memory_conf_t conf = {};

	conf.max_string_capacity = 50;
	conf.max_ros2_type_sequence_capacity = 5;
	conf.max_basic_type_sequence_capacity = 5;

	micro_ros_utilities_memory_rule_t rules[] = {
		{"header.frame_id", 30},
		{"format",4},
		{"data", 3000}
	};
	conf.rules = rules;
	conf.n_rules = sizeof(rules) / sizeof(rules[0]);

	sensor_msgs__msg__CompressedImage msg_static;

	micro_ros_utilities_create_message_memory(
		ROSIDL_GET_MSG_TYPE_SUPPORT(sensor_msgs, msg, CompressedImage),
		&msg_static,
		conf
	);

	uint8_t pic[2617];
	memset(pic, 0xAB, sizeof(pic));

	msg_static.data.size = sizeof(pic);

	msg_static.header.frame_id = micro_ros_string_utilities_set(msg_static.header.frame_id, "myframe");
	msg_static.format = micro_ros_string_utilities_set(msg_static.format, "JPEG");
	memcpy(msg_static.data.data,pic,sizeof(pic));

	RCSOFTCHECK(rcl_publish(&publisher, &msg_static, NULL));
}

Can you verify this code in your platform?
Could you try to set .format size to 5, as you need the \0 to finalize the string? I'm not sure if this is taken into account in the library.

Some questions:

  1. Why are you using %zu to print pic->len if len is type size_t and width and height are also size_t and you are using %d?
  2. Is correct that a 320x240 image fits in 2617 bytes?

Edit:
I have been checking the utility library, please set .format size to something that can fit your string and the null character JPGE\0.

from micro_ros_espidf_component.

MS71 avatar MS71 commented on June 19, 2024

Hi
i will try your code.

Maybe, timer_callback is called by a different task with limited stack.
I will check that.

Is correct that a 320x240 image fits in 2617 bytes?
Yes, it a JPEG image.

Yesterday, i checked with smaller payload.
Up to ~800byte, rcl_publish is working.

from micro_ros_espidf_component.

pablogs9 avatar pablogs9 commented on June 19, 2024

Maybe you can try to increase the XRCE history to 8 in the colcon.meta: this param

from micro_ros_espidf_component.

MS71 avatar MS71 commented on June 19, 2024

Ok,
can i have my own colcon.meta, located with the application code? Outsite micro_ros_espidf_component.

from micro_ros_espidf_component.

MS71 avatar MS71 commented on June 19, 2024

Now, it is working.

    "rmw_embeddedrtps": {
        "cmake-args": [
            "-DRMW_ERTPS_MAX_OUTPUT_BUFFER_SIZE=20100"
        ]
    },

Question: How can i use my own/custom colcon.meta outside micro_ros_espidf_component?

from micro_ros_espidf_component.

pablogs9 avatar pablogs9 commented on June 19, 2024

You can use app-colcon.meta in the project folder:

set(APP_COLCON_META "${PROJECT_DIR}/app-colcon.meta")

Take into account that RMW_embeddedrtps is experimental.

from micro_ros_espidf_component.

Related Issues (20)

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.