Monday, April 17, 2017

Robo4J and the Java Flight Recorder (Laser Scanner Calibration)

The Java Flight Recorder (JFR) is a powerful feature in the Oracle JDK. It allows you to record information about the Java runtime, and the application running in the Java runtime. When designing robots, it can be an invaluable tool. Robo4J has some integration with the Java Flight Recorder out of the box.

In this blog, I will use the JFR integration to simplify the calibration necessary to make use of the LaserScanner class.

Calibrating Servos

Step one is to calibrate whatever servos are involved in doing a scan. I have a pan servo and a tilt servo. Only the pan servo is actually involved in the LaserScanner class - it provides 2D scans. That said, I need for the tilt servo to be calibrated properly too, if nothing else to ensure that I get level scans. To calibrate the servos, see my Servo Calibration blog.

First Configuration

The second step is to configure reasonable defaults for the configuration file for the LaserScannerExample ($ROBO4J_HOME/robo4j-units-rpi/src/examples/resources/lidarexample.xml). The most important part is to copy the values from your calibrated pan servo in the first step to the laserscanner.servo entry. Also, ensure that you set the minimum acquisition time depending on the version of the Lidar Lite you have. The v1 requires at least 20 ms. The v2 and later should be okay with 2ms. For the rest of the settings, leave the defaults for now.

Doing Flight Recordings

The next step is to run the a few scans using the LaserScannerExample and look at the results.
First source the envionment variables:
source scripts/rpi/environment.sh
Next run the LaserScannerExample with the flight recorder enabled. We will connect over JMX, so you need to open the appropriate ports, for example:
sudo java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.rmi.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=coffewlan -cp $ROBO4J_PATH com.robo4j.units.rpi.lidarlite.LaserScannerExample
Next, get the robo4j-tools repo for Robo4J, and follow the instructions to start Java Mission Control (JMC) with the Robo4J plug-in.

Create a connection to your RaspberryPi running the example. You can connect with the JMX console to see that the connection works.


Next create a recording from Java Mission Control by right clicking on your connection and select “Start Flight Recording". You can use any recording template, just make sure to enable the Robo4J specific events in the last page of the wizard.




Click finish to start the recording. Once done, it will be downloaded to JMC automatically. Now, since you are using the Robo4J plug-in, the scans will be visualized for you. Open the Robo4J tab group, and select a scan to take a look at it.

If you suspect your servo is travelling too fast or slow (multiple sample points in the end with the same reading(s), weird artifacts in the end of a scan), adjust the angularSpeed. If you feel the laser do not get enough time to acquire, increase the minAcquisition time. Also, since we move the servo whilst acquiring, you may need to compensate the angular speed. Since I was lazy and didn’t have time to spend looking for a perfect physical model, there is a trim parameter to compensate (to make the left-to-right, and right-to-left scans align).

Below is a picture of a couple of individual scans on my robot without trim (simply shift- or control-click a few scans to render them simultaneously):

And the picture below is with trim set to 5.5:

Simply keep doing recordings and bisect your way to a proper trim value for your particular setup.

Summary

This blog showed that Robo4J has built in support for the Java Flight Recorder, and that the built in support is quite useful to calibrate the laser range finder (the LaserScanner class). It is also quite useful for trying out different algorithms for feature extraction and mapping using pre-existing data, but that is for another night and another blog.

46 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Calibration is an vital step of 3-d established light laser scanners which will achieve an correct measuring end result. all through the calibration a relation between the pixels in 3-D laser scanner digital camera photograph and the actual international devices is made. Laser line detection technique as a part of the calibration procedure performs an vital function in this calibration system, but this element has not been investigated before. in this paper the calibration and dimension end result dependency from the laser line detection with pixel or sub-pixel decision inside the calibration manner has been investigated. The calibration manner of the developed three-D laser scanner has been defined. The effects display dependency among the laser line detection approach within the calibration manner and the final dimension consequences. heatsign

    ReplyDelete
  5. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
    digital training in chennai

    ReplyDelete
  6. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.
    data-science-training-in-bangalore

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.
    hadoop training in bangalore

    ReplyDelete
  9. Thanks for sharing the nice information on robotics and Java
    IoT Online Training | IoT Training

    ReplyDelete
  10. The information you shared is very effective for learners.

    Visit for a real time training for Java Training in Chennai | Best Java Training Institute in Chennai | Java Master Program Training in Chennai

    ReplyDelete
  11. Casino is not just a game but a lifestyle, come in, play and be stylish. roulette online The best casino is only on BGAOC and nowhere else.

    ReplyDelete
  12. Разные виды товаров есть у нас, но лучшее это светодиодная лента купить Украина можно это сделать у компании Экодио

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Great Article, to see about IOT on Today's net

    Data Science Course

    ReplyDelete
  15. You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!
    https://www.excelr.com/digital-marketing-training-in-pune - digital marketing courses in pune

    ReplyDelete
  16. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful.data science course in dubai

    ReplyDelete
  17. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.data science course in dubai

    ReplyDelete
  18. I was just browsing through the internet looking for some information about Java Flight Recorder and came across your blog. I am impressed by the information that you have on this blog. Thank you

    Data Science

    ReplyDelete
  19. Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates.




    DATA SCIENCE COURSE

    ReplyDelete
  20. A great website with interesting and unique material what else would you need.

    ReplyDelete
  21. A great website with interesting and unique material what else would you need.
    Data Science Course in Pune

    ReplyDelete
  22. It should be noted that whilst ordering papers for sale at paper writing service, you can get unkind attitude. In case you feel that the bureau is trying to cheat you, don't buy term paper from it.
    what are solar panel and how to select best one
    learn about iphone X
    top 7 best washing machine
    iphone XR vs XS max




    ReplyDelete
  23. The blog and data is excellent and informative as well
    Data Science Course in Pune

    ReplyDelete
  24. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
    www.technewworld.in
    How to Start A blog 2019
    Eid AL ADHA

    ReplyDelete
  25. Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good.
    data analytics course malaysia

    ReplyDelete
  26. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    Data Science Courses

    ReplyDelete
  27. Find a local DJ, DJ wanted London
    Dj Required has been setup by a mixed group of London’s finest Dj’s, a top photographer and cameraman. Together we take on Dj’s, Photographers and Cameramen with skills and the ability required to entertain and provide the best quality service and end product. We supply Bars, Clubs and Pubs with Dj’s, Photographers, and Cameramen. We also supply for private hire and other Occasions. Our Dj’s, Photographers and Cameramen of your choice, we have handpicked the people we work with

    ReplyDelete
  28. You will get an introduction to the Python programming language and understand the importance of it. How to download and work with Python along with all the basics of Anaconda will be taught. You will also get a clear idea of downloading the various Python libraries and how to use them.
    Topics
    About Excelr Solutions and Innodatatics
    Introduction to Python
    Installation of Anaconda Python
    Difference between Python2 and Python3
    Python Environment
    Operators
    Identifiers
    Exception Handling (Error Handling)

    [url=https://www.excelr.com/data-science-certification-course-training-in-singapore]Excelr Solutions[/url]

    ReplyDelete

  29. This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this,
    Love it, technewworld.in.

    ReplyDelete
  30. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up.
    How to write best comment that approve fast

    ReplyDelete
  31. PhenQ_Reviews 2019 – WHAT IS PhenQ ?


    How_to_use_PhenQ ?This is a powerful slimming formula made by combining the multiple weight loss
    benefits of variousPhenQ_ingredients. All these are conveniently contained in
    one pill. It helps you get the kind of body that you need. The ingredients of
    the pill are from natural sources so you don’t have to worry much about the side
    effects that come with other types of dieting pills.Is_PhenQ_safe ? yes this is completly safe.
    Where_to_buy_PhenQ ? you can order online.PhenQ Scam ? this medicine is not scam at all.


    Watch this PhenQ_Reviews to know more.
    Know about PhenQ Scam from here.
    know Is_PhenQ_safe for health.
    you don`t know How_to_use_PhenQ check this site

    wanna buy phenq check this site and know Where_to_buy_PhenQ and how to use.

    check the PhenQ_ingredients to know more.

    what is PhenQ check this site.

    ReplyDelete