Closed SiddharthZokarkar closed 1 year ago
Hi @SiddharthZo,
The issue you mention (#383) should give enough info about how to use the client. You can also check this example and this documentation. Please check them out and try to replicate the given example for the client side.
For the Agent, i would avise to start with the Micro-XRCE-DDS-Agent from sources with the examples activated. This way you can add your code to the custom_agent
example and then launch the example as a standalone to test your transport.
In general, custom transports are not included on the default Agent. So you would need to create your own executable and avoid the ros2 run
approach.
Please give it a try and feel free to ask for more support.
Hello @Acuadros95 ,
Thank you so much for the information. I git clone this "Micro-XRCE-DDS-Agent-master" repository and now able to run the custom_agent.cpp example.
Whereas, for the client ~/microros_ws/firmware/freertos_apps/microros_esp32_extensions/main/ , I went to this location and modified the main.c , microros_transports.c and microros_transports.h files in such a way that when i run the command:
ros2 run micro_ros_setup configure_firmware.sh int32_publisher --transport serial
instead of configuring serial transport it configures CAN transport (modified transport) as I am interested in CAN communication instead of serial. Is that the correct way of modifying the client transport? or else where should i put my client transport code?
Moreover, in this location: ~/microros_ws/firmware/mcu_ws/eProsima/Micro-XRCE-DDS-Client/examples/CustomTransports
, If i edit the main.c , my_custom_transport.c and my_custom_transport.h files how can I put those files into ESP32?
or do I need to run those files separately as a proxy client just like custom agent (means custom client running separately on Linux just like custom agent ) and just need to send the pure CAN data from ESP32 (without any microros programming) to that proxy client? Kindly Clarify.
Thank you so much !!
Ideally, you should use the micro-ROS component for ESP-IDF with a custom transport configuration on the client side.
On how to configure the transport on that environment, there is a tutorial avaiable: link.
or do I need to run those files separately as a proxy client just like custom agent (means custom client running separately on Linux just like custom agent ) and just need to send the pure CAN data from ESP32 (without any microros programming) to that proxy client?
No, the client shall use the transport methods to send the data directly from the Agent.
Also, you should take care of the small payload size of the CAN transport, which is limited to 8 bytes and is to small to hold a complete micro-ROS frame. You should probably configure it as a Stream-oriented transport.
Hello @Acuadros95 ,
Thank you so much for the guidance. I run the code for the agent and the client using both Stream-oriented transport and Packet-oriented transport and got the following results.
For Stream-oriented transport and Packet-oriented transport , It is showing that the agent is receiving 16 Bytes of data whereas client is sending 24 bytes of data.
Stream-oriented transport:
In Stream-oriented transport , agent is receiving 16 bytes of data (as shown in the picture) but it is not even showing the received data and not doing further process after receiving 16 bytes of data.
Packet-oriented transport:
In Packet-oriented transport , the agent is not doing further process after receiving 16 bytes of data.
Please guide me regarding that.
Thank you so much
Did you check that your transport methods send/receive the expected amount of data within the desired timeout? You should test them without any micro-ROS communication.
Also, CAN transport can be problematic with micro-ROS. As its payload is only of 8 bytes, which could interfere with the framing and general data packaging of the underlying middle ware.
Sadly we don't have the resources to go deeper into this issue, but we will try to give insight as you debug into this problem.
Hello @Acuadros95 ,
Thanks for your suggestions. I will look into the timeout for this approach.
Actually I used another approach and here is the Github link of the issue .
https://github.com/micro-ROS/micro_ros_setup/issues/608
In my new approach I used CAN-ISOTP protocol which is the extension of normal CAN and used to send 64 Bytes of data in one go. It actually divides the complete data into pieces of 8 Bytes and then send one by one. It is similar to normal CAN only. This can be also use to send normal CAN data.
This approach has given some good results as it has "created client" , "establish session" and "create participant". But it is not doing further process like "creating topics" etc. and I have used existing UDP agent. I am not able to understand the reason why the existing UDP agent is not creating the topics and doing further process.
Kindly have a look and please give your valuable suggestions for the new issue.
Thank you very much!!
Can you try building your client with an increased value on RMW_UXRCE_STREAM_HISTORY
configuration?
This parameter controls the maximum size of the output messages, and its value needs to be a power-of-two .
Also, you will need to configure the UCLIENT_CUSTOM_TRANSPORT_MTU
value to 64, if that is your actual payload size.
Hello @Acuadros95 ,
In issue https://github.com/micro-ROS/micro_ros_setup/issues/608 and the current issue
I have just removed the inbuilt serial transport code at location
/microros_ws/firmware/freertos_apps/microros_esp32_extensions/main/microros_transports.c
and pasted my custom transport client code in microros_transports.c . So whenever , i run this command
"ros2 run micro_ros_setup configure_firmware.sh int32_publisher --transport serial"
instead of serial transport my custom transport code executes. Now how should I change RMW_UXRCE_STREAM_HISTORY and UCLIENT_CUSTOM_TRANSPORT_MTU ?
Moreover, I figured out one thing in the below picture , these two marked datas should be the same to proceed further. As when I connect ESP32 over WIFI with the Agent , these two marked datas appears to be the same . Is it true? and what these marked data means?
Thank you so much!!
Hello @Acuadros95 ,
In issue https://github.com/micro-ROS/micro_ros_setup/issues/608
In the below picture , are these two marked datas should be same to proceed further ? As when I connect ESP32 over WIFI with the same inbuit UDP Agent , these two marked datas appears to be the same .
It seems if these two marked data would be same then agent will proceed further and receive the topic data from the client. What is the significance of the marked data send by the agent? What is its meaning ?
Hello ,
Hardware description: ESP32 RTOS: FreeRTOS Installation type: micro_ros_setup Version or commit hash: ROS2 foxy
I am trying to make a custom transport for normal Can-bus protocol (Not Canfd) in microros. The code for custom client and custom agent(.cpp) is ready.
But i am facing some problems.
In which specific folder do i need to place the agent and the client code so that they start working? Whats the location of the folder?
I went to this location /microros_ws/build/micro_ros_agent/agent/src/xrceagent/examples/custom_agent and found an example. How can i run this example of custom agent?
(OR) the custom agent present at this location /microros_ws/build/micro_ros_agent/agent/src/xrceagent/src/cpp/transport/custom /CustomAgent.cpp
What are the steps and the command to run a custom agent?
For ex : ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0 instead of "serial" i want to use custom name like "custom_can")? what are the steps?
I went through the github issue #383 but didnt understood properly .
Thanks for the help!!