-
Notifications
You must be signed in to change notification settings - Fork 119
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
opencr tf publisher - no messages received on topic #1678
Comments
Which is the output of the micro-ROS Agent using the flag |
here is example with -v6
|
Does it works if you publish fake numbers instead of reading from the IMU? |
I tried putting fake values but no observable difference – set them quaternion to 0,0,0,1
Could try doing the same but comment out all the imu code
From: Pablo Garrido ***@***.***>
Date: Thursday, 15 February 2024 at 14:41
To: micro-ROS/micro_ros_arduino ***@***.***>
Cc: Nick Weldin ***@***.***>, Author ***@***.***>
Subject: Re: [micro-ROS/micro_ros_arduino] opencr tf publisher - no messages received on topic (Issue #1678)
Does it works if you publish fake numbers instead of reading from the IMU?
—
Reply to this email directly, view it on GitHub<#1678 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAUVCSZR52YGDPVKAQ6HIADYTYNCHAVCNFSM6AAAAABDKEE4KWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWGIZTGOBQGQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Yes please, let's discard the IMU problems by commenting the code out |
no_imu.txt Here ia the Arduino code with imu commented out (changed the extension to .txt to enable upload |
could you determine where is the board freezing? |
so it executes line // create executor but does not return form the function call in the if statement after that if(!micro_ros_utilities_create_message_memory( it doesn't get to the error_loop call, or the line after the if statement |
So what if you try to remove the call to |
I think I understand what that is doing - but don't see what a like for like replacement would be - I will look at the examples in the micro-ros examples types handing example alongside that description page and see if I can work it out |
The page you linked to seems to make sense, but I don't understand how this relates to what has been done in the example code - why is there are is a sequence of transforms - a tf message only contains 1 transform, and only the 1st element in the micro-ros code is assigned numerical values anyway, the other one seems to be just being used to provide the second frame, but from the ros tf transform stamped message definition I would expect to have a header, a string for child frame and a transform, but the code is referring to a message that has two transforms, which each have a header inside, which then appears to have some of the structure like the ros message. I looked in the library to see if there were files that defined things like a .msg definition in ros, but couldn't find anything that simple to refer to, so a bit stuck now as to how this works in practice |
Look for the .h file that defines the type you are using. And recursively checking each member you will find which ones you need to initialize, as explained in the tutorial I attached. Tomorrow I will check this in more detail. |
Thanks for your help. That's what I was looking at - I hadn't looked closely enough at the definition in the tf_message file - I see where the transforms element comes from now. My confusion now is why the tf_message is being used rather than just transform_stamped - is it a micro-ros specific reason ? Creating a message with two transform_stamped objects seems it would increase the memory footprint, and not sure why its needed. All the tf2 tutorial examples for publishing a transform just use transform stamped. |
So I'm seeing if a simple TransformStamped version will work - the board now returns successfully from the line if (!micro_ros_utilities_create_message_memory( but doesn't get past the next line - tried each of these separately and they both failed transform_stamped->header.frame_id = transform_stamped->child_frame_id = so will look today at replacing those with manual assignment from the example you linked to |
using strcpy(transform_stamped->header.frame_id.data, "/inertial_unit"); compiles, but board does not get past it |
have you assigned memory to transform_stamped->header.frame_id.data with a malloc? |
no - I thought the micro_ros_utilities_create_message_memory that was now succeeding was doing that will try it now |
added malloc and child_frame_id - the micro_ros_string_utilities_set function then runs on board as well as manually setting data and size. code now seems to be running to the end of loop, topic is showing up as geometry_msgs/msg/TransformStamped, but still no messages arriving in ros2 topic echo attached current code on board and terminal -v6 - the terminal has stopped printing out data at the bottom of the document, it is not continuously printing recv_message |
Your micro-ROS client is still not sending data to the Agent |
not sure what to do now I moving away from the example as written - but it did not work for me - is this something that needs fixing, or have others got it to work as it is. is using the more complex message with two transform objects necessary or does add additional complexity for an example when trying to get things working and understanding what is going on in the code |
so I found some example code here https://answers.ros.org/question/416189/cannot-send-transform-stamped-sequence-using-micro-ros-arduino-library-on-esp32/ that works on the board once its adjusted to not use wifi - I will work over the weekend to get it working with with the imu, time and publishing a TransformStamped in a way that is closer to the way the current example is structured. Would you be interested in that as a fix or alternative example ? |
Please create a PR with a fix and we will evaluate if it worth to split it in different example in a further step |
so went down a bit of a rabbit hole - seems the troubleshooting that I had done at the start was misleading, and so went down the wrong path, none of the changes to allocation of memory produced messages, so on a whim tried switching the message so it wasn't a pointer, replaced -> with . in assignments and passed it to the publisher with & - it worked. I thought I had tried that right at the beginning but can't have done it right. Will sort out a pr for just that change, one for then refactoring the message type to just a transform_stamped with all the frames set, and add the code for syncing time so that the tf displays more reliably in rviz |
Ok, so can we close? |
closing pr to follow |
Issue template
Steps to reproduce the issue
upload example code micro-res_tf_publisher.ino to opencr board, connect it to ubuntu virtual machine with micro-res-agent running
Expected behavior
micro-ros-agent recognise board, sets up publisher and tf messages are published on it
Actual behavior
micro-ros-agent recognise board, sets up publisher, but no message are published. The error light on the board is not flashing.
Additional information
publisher, subscriber and service examples work as expected. Have tried the imu demo code from the opencr hardware examples (that just prints ascii to the serial port) and data is printed out, so the imu is working. It is the original board with the MPU9250 imu on it if that makes any difference
The text was updated successfully, but these errors were encountered: