วันพฤหัสบดีที่ 29 มีนาคม พ.ศ. 2561

[Experimental] UDP Broadcast transport layer

referece: https://discourse.ros.org/t/experimental-udp-broadcast-transport-layer/2226 :


other link http://wiki.ros.org/ethzasl_message_transport#UDP_Multicasting

Hi all,
I made a proof of concept, meaning still experimental, of the UDP Broadcast transport layer and how it could work.
The final aim is to make a multimaster implementation with UDP Broadcast to avoid WiFi struggle.
I would like some advice of what is wrong and how to improve.
Architecture:
  1. Topic negotiation - Both the Subscriber/Publisher uses a TCP service to get the publishing port from the organizer.py
  2. Publisher serialize the packets into a Msg message then broadcast the packets to the port given by the organizer.
  3. The subscriber binds to the port, deserialize packets and either send it to the callback or publish it on the local master
Known limitations:
  • Not secure (publisher ip not checked, not crypted)
  • 64k maximum packet size (from IP protocol), tested only for non fragmented packets of less than 1k
  • ROS Indigo
  • Python 2.7
Usage:
roscore &
rosrun multimaster_udp organizer.py

# in another terminal
rosrun multimaster_udp smallest_subscriber_udp.py
# in another terminal
rosrun multimaster_udp smallest_publisher_udp.py
UDP Subscriber:
#!/usr/bin/env python
import rospy

from multimaster_udp.transport import UDPSubscriber
from std_msgs.msg import String

def callback(data, topic):
    global counter
    counter += 1
    print data, "\n received",counter, "UDP messages from \n", topic

def main():
    global counter
    counter = 0
    rospy.init_node("smallest_subscriber_udp")
    # if the callback is not defined (None), it will publish locally 
    # to the equivalent topic.
    sub = UDPSubscriber("hello", String, callback=None)
    rospy.spin()

if __name__ == '__main__':
    main()
UDP Broadcast Publisher
#!/usr/bin/env python
import rospy

from multimaster_udp.transport import UDPPublisher
from std_msgs.msg import String

def main():
    rospy.init_node("smallest_broadcast_publisher_udp")

    msg = String("World")
    pub = UDPPublisher("hello", String)

    rate = rospy.Rate(100)
    while not rospy.is_shutdown():
        pub.publish(msg)
        rate.sleep()

if __name__ == '__main__':
    main()
  • created

    Jul '17
  • last reply

    Jul '17
  • 6

    replies

  • 410

    views

  • 5

    users

  • 3

    likes

  • 3

    links

  • 3
This is pretty cool stuff, and I like your goal of moving towards multi-master. How does it relate to UDPROS6?
It does not relate to UDPROS at all… :confused:
This is mainly a proof of concept to broadcast messages on IP layer instead of the Application layer. This avoid to struggle network on massive multi-robot environnement.
Then in what ways would you say they currently differ? Does UDPROS not yet support UDP broadcasting? For example, does the xmlrpc negotiation of transport layer for UDPROS not currently enable UDP broadcasting when more than one subscribers connect to the same port for the same topic for the same publisher?
9 DAYS LATER
Badly, UDPROS is unicast only. While it reduces the overhead over TCP, due to the unreliable connection, it can be improved to forward general information to a lot of robots. For 50 robots over the WiFi, while UDPROS will send 50 packets, it is possible to send only one broadcasted packet.
Again, this is only a proof of concept, to have a basic communication running. On this base, we can think about the problems encountered and how to tackle them and finally implement it inside ros_comm, for C++ and Python.

วันพฤหัสบดีที่ 1 มีนาคม พ.ศ. 2561

Just share tool for using python around matlab

reference : http://www.aichengxu.com/python/1074817.htm

up
vote22down
voteaccepted
There are several alternative tools for converting Matlab code to Python code (not tested yet):
Small Matlab to Python compiler: convert Matlab code to
Python code, also developed here:SMOP@chiselapp
LiberMate: translate from Matlab to Python and
SciPy
OMPC: Matlab to Python (a bit outdated)
Matlab to Python conversion: No download
files available
Also, for those interested in an interface between the two languages and not conversion:
pymatlab
:
communicate from Python by sending data to the MATLAB workspace, operating on them with scripts and pulling back the resulting data
Python-Matlab wormholes: both directions
of interaction supported
Python-Matlab bridge: use Matlab from within
Python, offers matlab_magic for iPython, to execute normal matlab code from within ipython
PyMat: Control Matlab session from Python
pymat2
:
continuation of the appearingly abandoned PyMat.
mlabwrap
mlabwrap-purepy:
make Matlab look like Python library (based on PyMat)
oct2py
:
run GNU Octave commands from within Python
pymex
:
Embeds the Python Interpreter in Matlab, also on File
Exchange
matpy
:
Access MATLAB in various ways: create variables, access .mat files, direct interface to MATLAB engine (requires MATLAB be installed).
MatPy: Python package for numerical linear algebra
and plotting with a MatLab-like interface
Btw might be helpful to look here for other migration tips:
http://bci2000.org/downloads/BCPy2000/Migration.html
On a different note, though I'm not a
fortran
fan
at all, for people who might find it useful there is:
matlab2fortran

share|edit|flagedited Mar
20 at 8:26


Marco
104112
answered Jul 8 '13 at 20:45


johntex
602512
add
comment

วันจันทร์ที่ 15 เมษายน พ.ศ. 2556

install opencv with visual studio 2012 credit by Hongbo Miao


Using OpenCV 2.45 in Vsiual Studio 2012


First

Open Windows Explorer. Click on Computer and then System properties.
image description
Choose Advanced system settings.
image description
Click Environment Variables...
image description
Add only this to Environment Variables -> System variables -> Path
C:\OpenCV\build\x64\vc11\bin
image description
image description

Second

After creating your own project in Visual Studio 2012...
Build menu -> Configuration Manager
Change the Active solution platform. Click on Win32, Select New.... Use the settings below and click OK.
image description

Third

For Release:

View -> Property Manager
Double click Release | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  • Linker -> Input -> Additional Dependencies
opencv_calib3d245.lib
opencv_contrib245.lib
opencv_core245.lib
opencv_features2d245.lib
opencv_flann245.lib
opencv_gpu245.lib
opencv_haartraining_engine.lib
opencv_highgui245.lib
opencv_imgproc245.lib
opencv_legacy245.lib
opencv_ml245.lib
opencv_nonfree245.lib
opencv_objdetect245.lib
opencv_photo245.lib
opencv_stitching245.lib
opencv_ts245.lib
opencv_video245.lib
opencv_videostab245.lib

For Debug:

View -> Property Manager
Double click Debug | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  1. Linker -> Input -> Additional Dependencies
opencv_calib3d245d.lib
opencv_contrib245d.lib
opencv_core245d.lib
opencv_features2d245d.lib
opencv_flann245d.lib
opencv_gpu245d.lib
opencv_haartraining_engined.lib
opencv_highgui245d.lib
opencv_imgproc245d.lib
opencv_legacy245d.lib
opencv_ml2445.lib
opencv_nonfree245d.lib
opencv_objdetect245d.lib
opencv_photo245d.lib
opencv_stitching245d.lib
opencv_ts245d.lib
opencv_video245d.lib
opencv_videostab245d.lib
Note the file names has extra "d" which means debug


Using OpenCV 2.43 in Vsiual Studio 2012


First

Download CMake. Open CMake and use settings below. Then click Configure.
image description
Choose Visual Studio 11 Win64. Click Finish.
image description
After a while, click Configure again. Wait a moment and then click Generate.
Close CMake and go to C:\MyOpenCV, open OpenCV.sln.
Choose Debug.
image description
Right click INSTALL. And choose Build.
image description
After a long period of time, go back and choose Release. Similarly, right click INSTALL. And chooseBuild.

Note: If you have a problem during install build you have to make clean and build it again. 
Close Visual Studio 2012.
Copy C:\MyOpenCV\install folder to C:\OpenCV.
So now you have a C:\OpenCV\install folder. You can delete C:\MyOpenCV whole folder if you want.

Second

Open Windows Explorer. Click on Computer and then System properties.
image description
Choose Advanced system settings.
image description
Click Environment Variables...
image description
Add only this to Environment Variables -> System variables -> Path
C:\OpenCV\install\bin
image description
image description

Third

After creating your own project in Visual Studio 2012...
Build menu -> Configuration Manager
Change the Active solution platform. Click on Win32, Select New.... Use the settings below and click OK.
image description

Fourth

For Release:

View -> Property Manager
Double click Release | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  1. Linker -> Input -> Additional Dependencies
opencv_calib3d245.lib
opencv_contrib245.lib
opencv_core245.lib
opencv_features2d245.lib
opencv_flann245.lib
opencv_gpu245.lib
opencv_haartraining_engine.lib
opencv_highgui245.lib
opencv_imgproc245.lib
opencv_legacy245.lib
opencv_ml245.lib
opencv_nonfree245.lib
opencv_objdetect245.lib
opencv_photo245.lib
opencv_stitching245.lib
opencv_ts245.lib
opencv_video245.lib
opencv_videostab245.lib

For Debug:

View -> Property Manager
Double click Debug | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  1. Linker -> Input -> Additional Dependencies
opencv_calib3d245d.lib
opencv_contrib245d.lib
opencv_core245d.lib
opencv_features2d245d.lib
opencv_flann245d.lib
opencv_gpu245d.lib
opencv_haartraining_engined.lib
opencv_highgui245d.lib
opencv_imgproc245d.lib
opencv_legacy245d.lib
opencv_ml245d.lib
opencv_nonfree245d.lib
opencv_objdetect245d.lib
opencv_photo245d.lib
opencv_stitching245d.lib
opencv_ts245d.lib
opencv_video245d.lib
opencv_videostab245d.lib
Note the file names has extra "d" which means debug



http://answers.opencv.org/question/6495/visual-studio-2012-and-rtlfreeheap-error/#6603 << Thank you so much