PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.44k stars 13.48k forks source link

Creating a Fast DDS Listener application error #20121

Open mengchaoheng opened 2 years ago

mengchaoheng commented 2 years ago

Describe the bug

In Creating a Fast DDS Listener application, when I run

make -f makefile_x64Linux2.6gcc

the output of console is error.

parallels@ubuntu-linux-20-04-desktop:/media/psf/Home/Proj/PX4-Autopilot/build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_listener$ make -f makefile_x64Linux2.6gcc
Checking directory output
Checking directory output/x64Linux2.6gcc
Checking directory lib
Checking directory lib/x64Linux2.6gcc
Checking directory bin
Checking directory bin/x64Linux2.6gcc
g++ -m64 -shared -o lib/x64Linux2.6gcc/libsensor_combined.so output/x64Linux2.6gcc/sensor_combined.o  -lfastcdr -lfastrtps -lssl -lcrypto -ldl -lnsl -lm -lpthread -lrt -Llib/x64Linux2.6gcc 
g++: error: unrecognized command line option ‘-m64’
make: *** [makefile_x64Linux2.6gcc:39: lib/x64Linux2.6gcc/libsensor_combined.so] Error 1
parallels@ubuntu-linux-20-04-desktop:/media/psf/Home/Proj/PX4-Autopilot/build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_listener$ make -f makefile_x64Linux2.6gcc
Checking directory output
Checking directory output/x64Linux2.6gcc
Checking directory lib
Checking directory lib/x64Linux2.6gcc
Checking directory bin
Checking directory bin/x64Linux2.6gcc
g++  -shared -o lib/x64Linux2.6gcc/libsensor_combined.so output/x64Linux2.6gcc/sensor_combined.o  -lfastcdr -lfastrtps -lssl -lcrypto -ldl -lnsl -lm -lpthread -lrt -Llib/x64Linux2.6gcc 
ar -cru lib/x64Linux2.6gcc/libsensor_combined.a output/x64Linux2.6gcc/sensor_combined.o 
ar: `u' modifier ignored since `D' is the default (see `U')
g++ -c -Wall -fpic  -O2 -std=c++0x -I.   -c sensor_combinedPubSubTypes.cxx -o output/x64Linux2.6gcc/sensor_combinedPubSubTypes.o
g++ -c -Wall -fpic  -O2 -std=c++0x -I.   -c sensor_combinedPublisher.cxx -o output/x64Linux2.6gcc/sensor_combinedPublisher.o
g++ -c -Wall -fpic  -O2 -std=c++0x -I.   -c sensor_combinedSubscriber.cxx -o output/x64Linux2.6gcc/sensor_combinedSubscriber.o
sensor_combinedSubscriber.cxx: In member function ‘virtual void sensor_combinedSubscriber::SubListener::onNewDataMessage(eprosima::fastrtps::Subscriber*)’:
sensor_combinedSubscriber.cxx:101:65: error: ‘class sensor_combined’ has no member named ‘gyro_integral_dt’; did you mean ‘gyro_integral_dt_’?
  101 |                         std::cout << "gyro_integral_dt: " << st.gyro_integral_dt() << std::endl;
      |                                                                 ^~~~~~~~~~~~~~~~
      |                                                                 gyro_integral_dt_
sensor_combinedSubscriber.cxx:102:81: error: ‘class sensor_combined’ has no member named ‘accelerometer_timestamp_relative’; did you mean ‘accelerometer_timestamp_relative_’?
  102 |                         std::cout << "accelerometer_timestamp_relative: " << st.accelerometer_timestamp_relative() << std::endl;
      |                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                 accelerometer_timestamp_relative_
sensor_combinedSubscriber.cxx:106:74: error: ‘class sensor_combined’ has no member named ‘accelerometer_integral_dt’; did you mean ‘accelerometer_integral_dt_’?
  106 |                         std::cout << "accelerometer_integral_dt: " << st.accelerometer_integral_dt() << std::endl;
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                          accelerometer_integral_dt_
sensor_combinedSubscriber.cxx:107:80: error: ‘class sensor_combined’ has no member named ‘magnetometer_timestamp_relative’; did you mean ‘accelerometer_timestamp_relative_’?
  107 |                         std::cout << "magnetometer_timestamp_relative: " << st.magnetometer_timestamp_relative() << std::endl;
      |                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                accelerometer_timestamp_relative_
sensor_combinedSubscriber.cxx:108:64: error: ‘class sensor_combined’ has no member named ‘magnetometer_ga’
  108 |                         std::cout << "magnetometer_ga: " << st.magnetometer_ga().at(0);
      |                                                                ^~~~~~~~~~~~~~~
sensor_combinedSubscriber.cxx:109:49: error: ‘class sensor_combined’ has no member named ‘magnetometer_ga’
  109 |                         std::cout << ", " << st.magnetometer_ga().at(1);
      |                                                 ^~~~~~~~~~~~~~~
sensor_combinedSubscriber.cxx:110:49: error: ‘class sensor_combined’ has no member named ‘magnetometer_ga’
  110 |                         std::cout << ", " << st.magnetometer_ga().at(2) << std::endl;
      |                                                 ^~~~~~~~~~~~~~~
sensor_combinedSubscriber.cxx:111:72: error: ‘class sensor_combined’ has no member named ‘baro_timestamp_relative’
  111 |                         std::cout << "baro_timestamp_relative: " << st.baro_timestamp_relative() << std::endl;
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~
sensor_combinedSubscriber.cxx:112:63: error: ‘class sensor_combined’ has no member named ‘baro_alt_meter’
  112 |                         std::cout << "baro_alt_meter: " << st.baro_alt_meter() << std::endl;
      |                                                               ^~~~~~~~~~~~~~
sensor_combinedSubscriber.cxx:113:66: error: ‘class sensor_combined’ has no member named ‘baro_temp_celcius’
  113 |                         std::cout << "baro_temp_celcius: " << st.baro_temp_celcius() << std::endl;
      |                                                                  ^~~~~~~~~~~~~~~~~
make: *** [makefile_x64Linux2.6gcc:51: output/x64Linux2.6gcc/sensor_combinedSubscriber.o] Error 1

My system is arm-based linux on m1 mac.

I have to delete some line of the sensor_combined_Subscriber.cxx and makefile_x64Linux2.6gcc.

To Reproduce

Steps to reproduce the behavior: describe in Creating a Fast DDS Listener application

Expected behavior

after delete some line,output is:

parallels@ubuntu-linux-20-04-desktop:/media/psf/Home/Proj/PX4-Autopilot/build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_listener$ make -f makefile_x64Linux2.6gcc
Checking directory output
Checking directory output/x64Linux2.6gcc
Checking directory lib
Checking directory lib/x64Linux2.6gcc
Checking directory bin
Checking directory bin/x64Linux2.6gcc
g++ -c -Wall -fpic  -O2 -std=c++0x -I.   -c sensor_combinedSubscriber.cxx -o output/x64Linux2.6gcc/sensor_combinedSubscriber.o
g++ -c -Wall -fpic  -O2 -std=c++0x -I.   -c sensor_combinedPubSubMain.cxx -o output/x64Linux2.6gcc/sensor_combinedPubSubMain.o
g++  -o bin/x64Linux2.6gcc/sensor_combinedPublisherSubscriber output/x64Linux2.6gcc/sensor_combined.o  output/x64Linux2.6gcc/sensor_combinedPubSubTypes.o output/x64Linux2.6gcc/sensor_combinedPublisher.o output/x64Linux2.6gcc/sensor_combinedSubscriber.o output/x64Linux2.6gcc/sensor_combinedPubSubMain.o -Wl,-Bstatic -Llib/x64Linux2.6gcc -lsensor_combined  -Wl,-Bdynamic -lfastcdr -lfastrtps -lssl -lcrypto -ldl -lnsl -lm -lpthread -lrt
parallels@ubuntu-linux-20-04-desktop:/media/psf/Home/Proj/PX4-Autopilot/build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_listener$ 
mengchaoheng commented 2 years ago

after run

tps/src/modules/micrortps_bridge/micrortps_listener$ make -f makefile_x64Linux2.6gcc
Checking directory output
Checking directory output/x64Linux2.6gcc
Checking directory lib
Checking directory lib/x64Linux2.6gcc
Checking directory bin
Checking directory bin/x64Linux2.6gcc
g++ -c -Wall -fpic  -O2 -std=c++0x -I.   -c sensor_combinedSubscriber.cxx -o output/x64Linux2.6gcc/sensor_combinedSubscriber.o
g++  -o bin/x64Linux2.6gcc/sensor_combinedPublisherSubscriber output/x64Linux2.6gcc/sensor_combined.o  output/x64Linux2.6gcc/sensor_combinedPubSubTypes.o output/x64Linux2.6gcc/sensor_combinedPublisher.o output/x64Linux2.6gcc/sensor_combinedSubscriber.o output/x64Linux2.6gcc/sensor_combinedPubSubMain.o -Wl,-Bstatic -Llib/x64Linux2.6gcc -lsensor_combined  -Wl,-Bdynamic -lfastcdr -lfastrtps -lssl -lcrypto -ldl -lnsl -lm -lpthread -lrt
parallels@ubuntu-linux-20-04-desktop:/media/psf/Home/Proj/PX4-Autopilot/build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_listener$ bin/x64Linux2.6gcc/sensor_combinedPublisherSubscriber subscriber
Starting 
Waiting for Data, press Enter to stop the Subscriber. 
mengchaoheng commented 2 years ago

It should be printed out sensor information.

mengchaoheng commented 2 years ago

The essential cause of the problem is RTPS/DDS Interface: PX4-Fast RTPS(DDS) Bridge does not have a clear organizational structure, causing confusion in reading, and it is not clearly pointed out that Creating a Fast DDS Listener application requires the previous operation.

mengchaoheng commented 2 years ago

https://github.com/PX4/px4_ros_com/issues/154

@dagar