olmerg / vilma_ma

ROS node to connect to Dspace Microautobox using UDP port based in boost and the example of the Microautobox
7 stars 2 forks source link

Procedure to run the project #2

Open shantanu543 opened 7 years ago

shantanu543 commented 7 years ago

Step by Step procedure to run the project.

olmerg commented 7 years ago

I made this code during my ph.D project, the last version is in gitlab, I can give you access without a problem. Which I do to connect ROS to Microautobox was to use the UDP library of the MA. I adapted the example that they give with this library to send/receive some variables between a program in c++ node ROS, which using boost create the socket UDP.

I suggest you to read the page 188, section B.6 Função da comunicação UDP ( I am sorry is in Portuguese) of my thesis, if the library can work for your project, I can give you access to all the code and give you some initial support to install in your environment.

Best Regards,

Olmer

RGring commented 7 years ago

I would be interested in the last version in gitlab, too. I have a mobile robot with a MicroAutoBox Platform and would like to integrate it in ROS. Any further information would help me a lot! Thanks already :)

Alby407 commented 6 years ago

Is it possible for you to update this Repository with your last version on your Gitlab? :)

olmerg commented 6 years ago

Hi everyone, really nice to listen that anyone is interested in this work, the gitlab is open https://gitlab.com/vilma_unicamp , feel free to ask anything, which I can help you.

I have some tutorials how I work with Microautobox but are in Portuguese, it can help anyone I can send you. If you use some part will be nice to cite VILMA

Hellesbier commented 5 years ago

Hi, my name is Chung.

it is nice to see your Project! Now i am searching the technical process beteween ROS and Microautobox with UDP. How it works and what kind of structure for data should be and so on. Thats why, I am looking for your suggestion "page 188, section B.6 Função da comunicação UDP of my thesis". I can't find it though.

Can you send me it? or can you recommend me some books? I can't find anywhere in ROS Wiki... My email addres is dusdlswh@gmail.com Thanks in advance

olmerg commented 5 years ago

Hi Chung, the link in the unicamp is updated Análise de risco para a cooperação entre o condutor e sistema de controle de veículos autônomos

The code I never made the process to connect with ros wiki, please review my https://gitlab.com/vilma_unicamp , the code of the conection with microautbox is in https://gitlab.com/vilma_unicamp/vilma_ma_ros package

vilma_ma_ros_node -> this node connect over UDP to the embedded systems of the microautobox computer of the vehicle. This node publish three type of Float64Array topics with the information that come from the MA, called vilma_ma_ros/sensors_ma, vilma_ma_ros/state_ma and vilma_ma_ros/sensors_brake. It subscribe to the Float64Array topics to sent to the MA, called vilma_ma_ros/sensors_pc , vilma_ma_ros/joystick_ma and vilma_ma_ros/planned_path. Each message received is save in independet queue and sent to the microautobox with the same order of priority that are listed here. This program has two thread one to communicate with the embedded system, and another to subscribe to the ros topics, so to create priority scheduling it is necessary that the excutable could be executed like root, so from the catkin directory do the next...

Feel free to review the information and ask me anything.

Hellesbier commented 5 years ago

Hi Olmerg,

thanks for fast reply and it was very helpful for understanding of Datatransport.

After searching more about ROS software and Microautobox hardware and Matlab-simulink, i found something interesting thing, taht ROS SUPPORT NOT REAL-TIME. Is it true? or there is a trick? How can I make a real-time configuration between ROS and Microautobox? According to Dspace, they have a real-time interface(RTI) with UDP/IP Ethernet. it make non-sense, that the microautobox works in realtime, nevertheless the ROS support not real-time.

Actually I'd like to know requirements for interface between ROS and Microautobox. (the control algorithm is already finish on Matlab-símulink). Becaus of ROS, i am now very confused, how can the motion controller work in hard real-time.

Can you give me some advice? I am sorry for bad English.

Thanks in advance. Yours sincerely Chunghyun Lyu

2019년 2월 11일 (월) 오전 1:15, olmerg notifications@github.com님이 작성:

Hi Chung, the link in the unicamp is updated Análise de risco para a cooperação entre o condutor e sistema de controle de veículos autônomos http://repositorio.unicamp.br/jspui/handle/REPOSIP/305474

The code I never made the process to connect with ros wiki, please review my https://gitlab.com/vilma_unicamp , the code of the conection with microautbox is in https://gitlab.com/vilma_unicamp/vilma_ma_ros package

vilma_ma_ros_node -> this node connect over UDP to the embedded systems of the microautobox computer of the vehicle. This node publish three type of Float64Array topics with the information that come from the MA, called vilma_ma_ros/sensors_ma, vilma_ma_ros/state_ma and vilma_ma_ros/sensors_brake. It subscribe to the Float64Array topics to sent to the MA, called vilma_ma_ros/sensors_pc , vilma_ma_ros/joystick_ma and vilma_ma_ros/planned_path. Each message received is save in independet queue and sent to the microautobox with the same order of priority that are listed here. This program has two thread one to communicate with the embedded system, and another to subscribe to the ros topics, so to create priority scheduling it is necessary that the excutable could be executed like root, so from the catkin directory do the next...

Feel free to review the information and ask me anything.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olmerg/vilma_ma/issues/2#issuecomment-462195179, or mute the thread https://github.com/notifications/unsubscribe-auth/AtTQ8_GopxOD3TjrGiSnfAi9Ou_TCvZ0ks5vMLYQgaJpZM4NjnFf .

olmerg commented 5 years ago

Hi Hellesbier, that is true, ROS is not prepared for hard real-time, but this is not a problem of ROS is a problem of the operating system. Linux or Windows should not be used for realtime tasks. If you really require real time in linux you can recompile the kernel of linux, and maybe trying OROCOS like framework to program.

But which I have learned is that the real-time task should be made in realtime computers, like microautobox or maybe an Arduino depending on the required level of reliability, and design the next layer of software to communicate over asynchronous communication with real-time software.

So, why is an important ROS? because there exists a lot of software implemented that you can use for non-real time job. Example: computer vision, path planning, interfaces,....Cycle rates in ROS could be work with a low jitter (may be the principal problem for real-time) around 200hz in a headless PC, which is more than required in this type of tasks.

My library do not communicate directly with real-time interface(RTI) of Microautbox because this a proprietary protocol and I could not find support to connect to Linux computers. I just create a way to communicate some vector of variables from Simulink program to ROS in double way. Like UDP does not guarantee the confiability of the communication, I design a protocol to get confiability because I can not compile standard protocol over simulink c compiler (which I have learnt that is a better approach).

How it worked?, I make the protocol in c library, which compiles in Simulink and in Linux, and use the udp protocol example of microautbox library and boost library in Linux to communicate.

So the idea of the design was that command from linux to microautobox has a rate of around 100hz, and the microautobox can send data to ROS with rates of 500hz.

My English is not so good too, but we can try.

Best regards,

Olmer

Hellesbier commented 5 years ago

Hi Olmer,

thank you so much for helpful reply!

As I sum up words of you, "I can connect the ROS and Microautobox without RTI_Ethernet_I/O of Dspace and the Microautobox communicate with a node in ROS, while i use UDP Ethernet. Microautobox should subscribe a node in ROS, to communicate a data with Topic."Do I right understand?

I have written a email to Dspace about Inferface between ROS and Microautobox. They answerd me below.

================================================================================ The UDP / IP blockset is available with the package: RTI_Ethernet_I / O for 450 € net. Here you have to build the communication but independently.

With RTMAPS_INTERFACE_SW_USB for 770 € net, communication with a tool (RTMaps) has already been realized. Here would offer either in RTMaps (2000 € net) to integrate a ROS node (so it is made to my knowledge in the FS team dart racing), or convert the blockset for the connection to ROS.

Now I am a little bit confusing about its interface or connection. I would like to know what is difference between your method and DSpace method. Dspace recommend that we use a RTI Interface with Matlab_simulink.

If I use your method, is it also possible to use real-time connection and communication?

I am sorry to have taken your time.

Thanks in advance. Yours sincerely Chunghyun Lyu

2019년 2월 13일 (수) 오후 3:07, olmerg notifications@github.com님이 작성:

Hi Hellesbier, that is true, ROS is not prepared for hard real-time, but this is not a problem of ROS is a problem of the operating system. Linux or Windows should not be used for realtime tasks. If you really require real time in linux you can recompile the kernel of linux, and maybe trying OROCOS like framework to program.

But which I have learned is that the real-time task should be made in realtime computers, like microautobox or maybe an Arduino depending on the required level of reliability, and design the next layer of software to communicate over asynchronous communication with real-time software.

So, why is an important ROS? because there exists a lot of software implemented that you can use for non-real time job. Example: computer vision, path planning, interfaces,....Cycle rates in ROS could be work with a low jitter https://es.wikipedia.org/wiki/Jitter (may be the principal problem for real-time) around 200hz in a headless PC, which is more than required in this type of tasks.

My library do not communicate directly with real-time interface(RTI) of Microautbox because this a proprietary protocol and I could not find support to connect to Linux computers. I just create a way to communicate some vector of variables from Simulink program to ROS in double way. Like UDP does not guarantee the confiability of the communication, I design a protocol to get confiability because I can not compile standard protocol over simulink c compiler (which I have learnt that is a better approach).

How it worked?, I make the protocol in c library, which compiles in Simulink and in Linux, and use the udp protocol example of microautbox library and boost library in Linux to communicate.

So the idea of the design was that command from linux to microautobox has a rate of around 100hz, and the microautobox can send data to ROS with rates of 500hz.

My English is not so good too, but we can try.

Best regards,

Olmer

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olmerg/vilma_ma/issues/2#issuecomment-463211381, or mute the thread https://github.com/notifications/unsubscribe-auth/AtTQ82lSDfRtwCeZ8_7YtIcipjOVdqRBks5vNBwHgaJpZM4NjnFf .

olmerg commented 5 years ago

Hi Hellesbier,

You are right, the lab buy the license of UDP/IP blockset Dspace, and through it, I create the library with my own protocol to communicate to a node in ROS which publishes topics of data generated in the MA and subscribe to topics which are sent to Dspace MA. The other tools that they offer sound great but I have never used, it will make that I try to do, but though many standard protocols. About RTI , which I understand is that it is a proprietary protocol designed to "test automation tools", so I think that the advantage is that you access to all the data of the Dspace MA transparently, the only problem that I view, it is that you have to make the middleware to ROS with Simulink or through ControlDesk.

Which is the better solution?, I do not know. I decide to implement my code because I believe that a windows computer(like I had available) in the middle of the process increases the risk of problems to make tests on the car.

I really like to know your final reflexion about this problem.

Best regards,

Olmer

Hellesbier commented 5 years ago

Hello Olmer,

first of all, thank you so much that you've given me lots of tipps. I have read your Thesis"Análise de risco para a cooperação entre o condutor e sistema de controle de veículos autônomos".

To be easy to understand, I send you three pictures. First Picture is a network of our project. Second is architecture from ROS to CAN, what i made. Third is a Package of Microautobox from Internet.

On the second picture, I made this architecture with your Tip. You have used a Node in ROS for Interface to Microautobox, right?

On the third picture, I can see yellow cable (one side is for Ethernet another side is for Microautobox). Is it possible to connect UDP/IP Ethernet using this cable? Of course, I would make a custom protocol for communication between ROS and Microautobox.

I found that you have used Microautobox II Embedded PC. Why do you used it, instead of normal Microautobox II. What is Difference between Embedded and without Embedded? Is it Possible to communicate between ROS and Microautobox, without Microautobox Embedded PC?

Can I direct carry out the controll regulation of Matlab/Simulink on the Microautobox? Ive already made Regulation of Lateral and Liner in Matlab/Simulink.

I am very pleasure that you give me lots oftips. Thanks very much in Advance!

Best Regards, Chunghyun Lyu

2019년 2월 14일 (목) 오후 2:58, olmerg notifications@github.com님이 작성:

Hi Hellesbier,

You are right, the lab buy the license of UDP/IP blockset Dspace, and through it, I create the library with my own protocol to communicate to a node in ROS which publishes topics of data generated in the MA and subscribe to topics which are sent to Dspace MA. The other tools that they offer sound great but I have never used, it will make that I try to do, but though many standard protocols. About RTI , which I understand is that it is a proprietary protocol designed to "test automation tools", so I think that the advantage is that you access to all the data of the Dspace MA transparently, the only problem that I view, it is that you have to make the middleware to ROS with Simulink or through ControlDesk.

Which is the better solution?, I do not know. I decide to implement my code because I believe that a windows computer(like I had available) in the middle of the process increases the risk of problems to make tests on the car.

I really like to know your final reflexion about this problem.

Best regards,

Olmer

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olmerg/vilma_ma/issues/2#issuecomment-463636478, or mute the thread https://github.com/notifications/unsubscribe-auth/AtTQ87uzPNh5av1RhT8SFBiwHenpYUn3ks5vNWuPgaJpZM4NjnFf .

Hellesbier commented 5 years ago

Hi Olmer,

please ignore the previous email. I have mistaken the network and architecture.

now i want to explain our system architecture.

  1. Control algorithms (longitudinal and lateral dynamics control) are displayed on a host PC(Laptop with windows and no ROS) in Matlab / Simulink.
  2. This model is then compiled and flashed on the microautobox (we already have Microautobox ll 1401/1511) through the Simulink-Coder and RTI interface of DSpace.
  3. The Microautobox will be connected by a second cable (UDP / IP Ethernet) to the main PC, which will be installed in the vehicle.
  4. The Microautobox is then communicated to a node of the ROS of Main-PC, during exchanging interactively the setpoint values of ROS and actual values of Microautobox.

I have the following questions now.

  1. In the third step, how can the connection (protocol) between ROS (Main-PC) and Microautobox (already flattened control algorithms) be established by UDP / IP Ethernet? Do you think, does work your code from Github in our case?
  2. If the first question is answered, how can you program the protocol in real time?
  3. At the fourth step, what content and which language of the data packet of ROS nodes should have for the protocol? Based on the second step, the control algorithms determined by Simulink coders are overwritten with C on the Microautobox. But ROS is written with C ++. Here I am very confused how the data packets are compiled by ROS.

I am sorry to you if I have asked stupid questions. I am a newbee on ROS and Microautobox.

Thanks in Advance. Best Regards, Chunghyun Lyu

2019년 2월 18일 (월) 오전 11:59, Lyu Chunghyun dusdlswh@gmail.com님이 작성:

Hello Olmer,

first of all, thank you so much that you've given me lots of tipps. I have read your Thesis"Análise de risco para a cooperação entre o condutor e sistema de controle de veículos autônomos".

To be easy to understand, I send you three pictures. First Picture is a network of our project. Second is architecture from ROS to CAN, what i made. Third is a Package of Microautobox from Internet.

On the second picture, I made this architecture with your Tip. You have used a Node in ROS for Interface to Microautobox, right?

On the third picture, I can see yellow cable (one side is for Ethernet another side is for Microautobox). Is it possible to connect UDP/IP Ethernet using this cable? Of course, I would make a custom protocol for communication between ROS and Microautobox.

I found that you have used Microautobox II Embedded PC. Why do you used it, instead of normal Microautobox II. What is Difference between Embedded and without Embedded? Is it Possible to communicate between ROS and Microautobox, without Microautobox Embedded PC?

Can I direct carry out the controll regulation of Matlab/Simulink on the Microautobox? Ive already made Regulation of Lateral and Liner in Matlab/Simulink.

I am very pleasure that you give me lots oftips. Thanks very much in Advance!

Best Regards, Chunghyun Lyu

2019년 2월 14일 (목) 오후 2:58, olmerg notifications@github.com님이 작성:

Hi Hellesbier,

You are right, the lab buy the license of UDP/IP blockset Dspace, and through it, I create the library with my own protocol to communicate to a node in ROS which publishes topics of data generated in the MA and subscribe to topics which are sent to Dspace MA. The other tools that they offer sound great but I have never used, it will make that I try to do, but though many standard protocols. About RTI , which I understand is that it is a proprietary protocol designed to "test automation tools", so I think that the advantage is that you access to all the data of the Dspace MA transparently, the only problem that I view, it is that you have to make the middleware to ROS with Simulink or through ControlDesk.

Which is the better solution?, I do not know. I decide to implement my code because I believe that a windows computer(like I had available) in the middle of the process increases the risk of problems to make tests on the car.

I really like to know your final reflexion about this problem.

Best regards,

Olmer

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olmerg/vilma_ma/issues/2#issuecomment-463636478, or mute the thread https://github.com/notifications/unsubscribe-auth/AtTQ87uzPNh5av1RhT8SFBiwHenpYUn3ks5vNWuPgaJpZM4NjnFf .

olmerg commented 5 years ago

Hi Hellespbier,

I am having some busy weeks, but I will try to answer.

  1. The code would work if you have the udp/IP blockset license. How it will work? I modify the example that come with this license creating my own protocol with a c-function (https://gitlab.com/vilma_unicamp/vilma_ma_ros/blob/master/include/protocoloc.h). Which made this library? encode and decode to binary different type of variables that you have to join together in an array (MUX in Matlab) like is show in the figure. image

  2. The protocol in matlab just encode and decode the data, to verify is the data is true, it confirm the data, an in case of error, it just take the last data like is shown in the figure

image

I probe which package of 15 double variables sending and 10 variables receiving (like 250bytes) with an error of less than 0.001% (I forget some package and receive the last one) , if I increase the size of the package I feel problems in the real-time processing. For my example I work with a sample time of 1ms in the MA, so the delay to receive the data was 2ms( if I want to receive confirmation).

  1. If you review the protocolc.h it is declared like extern C to be compiled inside the c++ program, only the encoding and decoding function are made inside this file, the udp protocol part through boost library is implemented in c++ (https://gitlab.com/vilma_unicamp/vilma_ma_ros/blob/master/include/maudp.h) and finally the "front-end" in ros is implemented in (vilma_ma_ros_node)[https://gitlab.com/vilma_unicamp/vilma_ma_ros/blob/master/src/vilma_ma_ros_node.cpp) where the asynchronous reception of data is made in a thread different of the thread of ROS spin to try guarantee real-time.

Note that basically the protocols is defined by the numbers of inputs, the numbers of outputs and number of retry to received a message.

about real time, we can discuss more about synchronous and asynchronous communication, but try to read my thesis in the pages of the images attached here.

Best regards,

Olmer

olmerg commented 5 years ago

Dear Chunghyun,

I really appreciate your conclusion of which solution you will use.

Hellesbier commented 5 years ago

Dear Olmer,

nowadays i have lots of things to do, that's why i couldn't find any solution. However, I will tell you if i find a solution and conclusion.

Thank you so much for your interest!