Skip to content

Latest commit

 

History

History
116 lines (88 loc) · 11.4 KB

README.md

File metadata and controls

116 lines (88 loc) · 11.4 KB

Advanced Programming for Robots

Google C++ Style Guideline: https://google.github.io/styleguide/cppguide.html

How to compile provided c-scripts

cd sockets
./compileme.sh

How to commit to the current branch -> use conventional commit-messages https://www.conventionalcommits.org/en/v1.0.0/

git add .

git commit -m "feat: TITLE" \
-m "DESCRIPTION" \
-m "Co-authored-by: nils93 <n.fandrey@gmail.com>" \
-m "Co-authored-by: Arthur PELLEGRINI <arthur.pellegrini@outlook.fr>" \
-m "Co-authored-by:  cfriedl1 <ch.friedl1010@gmail.com>" \  
-m "Co-authored-by:  Felix130899 <felixhaier1308@gmail.com>"
#only 1 author + 1 co-author 

git push

Setting up ros on ubuntu jammy (20.04)

http://wiki.ros.org/noetic/Installation/Ubuntu

Install required Json package

sudo apt-get install libjsoncpp-dev

Makefile

This Makefile automates the compilation process for two programs: tcp_server and tcp_client. It defines the rules for compiling source files (.cpp and .c) into object files (.o) and linking them into executable programs. The Makefile also includes a clean rule to remove generated files for a fresh build. It simplifies the workflow for managing multiple targets and dependencies in a structured project.

TCP-Server and TCP-Client

To run the tcp-server, just type in:

./tcp_server 10000
Server is listening on port 10000

To run the tcp_client, just type in:

./tcp_client 127.0.0.1 hello! 10000
Received: hello!

Generated Executables

  • ChattyTCPServer A TCP Server, that sends simulated Data on Ports 9997 [LaserScanData: angle:distance] and 9998 [OdometryData: x:y:theta]. On Port 9999 it receives data which will be displayed in the terminal.

  • tcp_crawler The TCP_crawlers connects to two Ports 9997 (LaserScan) and 9998 (Odometry) and receives data. The received data will be written in two csv-files.

  • ListenOnTCPPort A TCPSocket that connects to a tcp-ip port. Received data will be displayed in the terminal.

  • TalkOnTCPPort A TCPSocket that connects to a tcp-ip port. Data can be send via user input via this port.

  • RosLaserListener Connects to localhost:PORT and listens. First received Byte == 1 -> laserdata, 2 -> handlePointCloud2Data

  • RosTCPLaserScanListener Connects to and listens. First received Byte == 1 -> laserdata, 2 -> handlePointCloud2Data

  • RosTCPOdometryListener Connects to and listens.

Setting up the connection with the robot

Turtlebot 2: Michelangelo IP: 192.168.100.52 Password: on the back side of the rooter

Put the Battery and do not forgot to switch the button to turn on the robot.

Try the connection between the robot and your laptop:

ping 192.168.100.52

Data Exchanged

Lecturer said us that usually, we should have 50% of packet loss

  • Port 9997 /scan ---START---{"header": {"seq": 11645, "stamp": {"secs": 1705692573, "nsecs": 494085414}, "frame_id": "base_scan"}, "angle_min": 0.0, "angle_max": 6.2657318115234375, "angle_increment": 0.01745329238474369, "time_increment": 0.0005592841189354658, "scan_time": 0.20134228467941284, "range_min": 0.11999999731779099, "range_max": 3.5, "ranges": [1.8619999885559082, 1.9190000295639038, 0.0, 2.125999927520752, 2.177000045776367, 3.114000082015991, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.15500020980835, 0.0, 0.0, 0.0, 3.4179999828338623, 3.3420000076293945, 3.197000026702881, 3.046999931335449, 2.9579999446868896, 2.8510000705718994, 2.7899999618530273, 2.6700000762939453, 2.5959999561309814, 2.438999891281128, 2.384999990463257, 2.318000078201294, 2.2339999675750732, 2.2009999752044678, 2.1530001163482666, 2.0739998817443848, 2.0179998874664307, 1.9759999513626099, 1.9500000476837158, 1.906000018119812, 1.847000002861023, 1.7979999780654907, 1.7690000534057617, 1.7079999446868896, 1.715999960899353, 1.6920000314712524, 1.6 260000467300415, 1.5980000495910645, 1.5640000104904175, 1.5460000038146973, 1.5299999713897705, 1.5149999856948853, 1.4880000352859497, 1.4830000400543213, 1.4709999561309814, 1.3600000143051147, 1.2549999952316284, 1.2610000371932983, 1.2359999418258667, 1.2029999494552612, 1.2050000429153442, 1.1979999542236328, 1.190999984741211, 1.1929999589920044, 1.1610000133514404, 1.149999976158142, 1.1710000038146973, 1.125, 1.1 480000019073486, 1.1390000581741333, 1.1180000305175781, 1.121000051498413, 1.1139999628067017, 1.1130000352859497, 1.0770000219345093, 1.1050000190734863, 1.0759999752044678, 1.1979999542236328, 1.215999960899353, 1.2109999656677246, 1.1990000009536743, 1.190000057220459, 1.1829999685287476, 1.190000057220459, 1.190000057220459, 1.180999994277954, 1.184000015258789, 1.1660000085830688, 1.1720000505447388, 1.1660000085830688, 1.1950000524520874, 1.1779999732971191, 1.1820000410079956, 1.180999994277954, 1.1360000371932983, 1.184000015258789, 1.187000036239624, 1.187000036239624, 1.184000015258789, 1.1920000314712524, 1.2130000591278076, 1.1979999542236328, 1.1929999589920044, 1.2100000381469727, 1.2120000123977661, 1.2139999866485596, 1.2209999561309814, 1.2289999723434448, 1.25, 1.2339999675750732, 1.2640000581741333, 1.2719999551773071, 1.2680000066757202, 1.281999945640564, 1.2890000343322754, 1.2960000038146973, 1.3079999685287476, 1.3170000314712524, 1.340999960899353, 1.3339999914169312, 1.355000019073 4863, 1.3700000047683716, 1.3899999856948853, 1.4119999408721924, 1.4459999799728394, 1.4390000104904175, 1.4479999542236328, 1.4789999723434448, 1.5019999742507935, 1.5160000324249268, 1.531000018119812, 1.5529999732971191, 1.5679999589920044, 1.5770000219345093, 1.5470000505447388, 1.5049999952316284, 1.5390000343322754, 1.531000018119812, 1.5260000228881836, 1.6859999895095825, 1.8179999589920044, 1.9049999713897705, 1.940000057220459, 1.7480000257492065, 1.784000039100647, 1.9019999504089355, 1.680999994277954, 1.7309999465942383, 1.9329999685287476, 2.0490000247955322, 1.8550000190734863, 1.8849999904632568, 2.015000104904175, 2.2279999256134033, 2.2190001010894775, 2.2960000038146973, 2.2769999504089355, 2.2780001163482666, 2.2899999618530273, 0.0, 0.0, 0.0, 0.0, 0.0, 3.5940001010894775, 3.615000009536743, 3.674999952316284, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.51200008392334, 3.5369999408721924, 2.9820001125335693, 2.0789999961853027, 1.8509999513626099, 1. 8899999856948853, 1.8600000143051147, 1.8179999589920044, 1.753999948501587, 1.7680000066757202, 1.7799999713897705, 1.8220000267028809, 1.9589999914169312, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7839999794960022, 0.7839999794960022, 0.7649999856948853, 0.7559999823570251, 0.7609999775886536, 0.7730000019073486, 0.7599999904632568, 0.7599999904632568, 0.7540000081062317, 0.7519999742507935, 0.7490000128746033, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4620000123977661, 0.4620000123977661, 0.44699999690055847, 0.44200000166893005, 0.4339999854564667, 0.4320000112056732, 0.42800000309944153, 0.42800000309944153, 0.4259999990463257, 0.42399999499320984, 0.42399999499320984, 0.4230000078678131, 0.42399999499320984, 0.42399999499320984, 0.42399999499320984, 0.4259999990463257, 0.42899999022483826, 0.4309999942779541, 0.4309999942779541, 0.430999994 2779541, 0.4320000112056732, 0.4320000112056732, 0.4339999854564667, 0.4339999854564667, 0.4350000023841858, 0.4359999895095825, 0.43799999356269836, 0.44200000166893005, 0.44600000977516174, 0.46299999952316284, 0.4740000069141388, 0.0, 0.4779999852180481, 0.0, 1.2960000038146973, 1.2000000476837158, 1.2139999866485596, 1.1959999799728394, 1.1449999809265137, 1.2029999494552612, 1.1890000104904175, 1.2269999980926514, 1.2510000467300415, 1.253000020980835, 1.3009999990463257, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.609999895095825, 0.0, 1.6019999980926514, 0.0, 1.9259999990463257], "intensities": [362.0, 377.0, 169.0, 402.0, 342.0, 169.0, 294.0, 296.0, 303.0, 291.0, 301.0, 89.0, 127.0, 83.0, 101.0, 119.0, 107.0, 122.0, 132.0, 145.0, 155.0, 164.0, 179.0, 187.0, 193.0, 298.0, 323.0, 351.0, 328.0, 390.0, 411.0, 445.0, 474.0, 512.0, 532.0, 549.0, 572.0, 734.0, 785.0, 828.0, 872.0, 943.0, 932.0, 977.0, 1063.0, 1120.0, 1202.0, 1271.0, 1298.0, 1279.0, 1723.0, 1690.0, 2102.0, 2179.0, 2275.0, 2163.0, 2004.0, 2524.0, 2533.0, 2212.0, 2425.0, 2773.0, 2598.0, 2128.0, 2267.0, 2323.0, 2954.0, 2131.0, 2558.0, 1938.0, 2231.0, 2605.0, 1082.0, 1651.0, 2810.0, 2612.0, 2495.0, 2091.0, 1630.0, 2892.0, 2279.0, 2393.0, 2500.0, 2349.0, 2737.0, 2079.0, 2571.0, 2408.0, 2139.0, 2203.0, 2617.0, 2253.0, 3165.0, 2264.0, 2150.0, 2074.0, 2102.0, 2462.0, 2233.0, 2419.0, 2487.0, 2224.0, 2670.0, 2560.0, 2705.0, 2278.0, 2589.0, 2319.0, 2393.0, 2487.0, 2150.0, 2288.0, 2351.0, 2277.0, 2149.0, 2079.0, 2022.0, 1946.0, 1897.0, 1718.0, 1744.0, 1651.0, 1560.0, 1481.0, 1453.0, 1374.0, 1307.0, 1212.0, 1153.0, 1051.0, 1180.0, 410.0, 1143.0, 1058.0, 1103.0, 629.0, 547.0, 612.0, 552.0, 322.0, 255.0, 481.0, 378.0, 302.0, 331.0, 339.0, 132.0, 103.0, 295.0, 273.0, 240.0, 420.0, 433.0, 419.0, 417.0, 182.0, 58.0, 82 .0, 62.0, 0.0, 169.0, 138.0, 168.0, 35.0, 0.0, 0.0, 0.0, 75.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 39.0, 65.0, 169.0, 216.0, 162.0, 266.0, 124.0, 409.0, 577.0, 662.0, 712.0, 630.0, 581.0, 417.0, 389.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 694.0, 3003.0, 2314.0, 3906.0, 2691.0, 2688.0, 3260.0, 2957.0, 3124.0, 3025.0, 3311.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 38.0, 37.0, 43.0, 39.0, 0.0, 81.0, 52.0, 75.0, 80.0, 118.0, 232.0, 283.0, 589.0, 637.0, 1095.0, 1447.0, 2008.0, 2870.0, 3016.0, 4096.0, 4173.0, 4503.0, 4213.0, 4375.0, 4822.0, 4457.0, 4674.0, 4620.0, 4130.0, 3808.0, 3297.0, 2266.0, 1663.0, 1302.0, 972.0, 593.0, 462.0, 279.0, 132.0, 112.0, 100.0, 101.0, 0.0, 479.0, 2130.0, 1972.0, 2172.0, 2168.0, 2106.0, 2095.0, 1998.0, 1808.0, 1513.0, 1212.0, 105.0, 0.0, 0.0, 0.0, 0.0, 44.0, 34.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 105.0, 237.0, 243.0, 42.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 58.0, 70.0, 0.0, 0.0, 0.0, 290.0, 106.0, 109.0, 119.0, 301.0, 0.0, 346.0]}END

  • Port 9998 /odom ---START---{"header": {"seq": 41985, "stamp": {"secs": 1705692586, "nsecs": 217836936}, "frame_id": "odom"}, "child_frame_id": "base_footprint", "pose": {"pose": {"position": {"x": -0.6309093236923218, "y": -0.54593425989151, "z": 0.0}, "orientation": {"x": 0.0, "y": 0.0, "z": -0.9411287307739258, "w": 0.33804845809936523}}, "covariance": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "twist": {"twist": {"linear": {"x": 0.0, "y": 0.0, "z": 0.0}, "angular": {"x": 0.0, "y": 0.0, "z": 0.006458975840359926}}, "covariance": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}}END

  • Port 9999 /cmd_vel We have to use this command format:

    ---START---{"linear": 0.1, "angular": 0.5}___END___

Doxygen

sudo apt install doxygen