SoundMetrics / aris-integration-sdk

SDK for building custom controllers for the ARIS sonar.
MIT License
5 stars 2 forks source link

Cannot build C sample program connect-command on a NVIDIA Jetson TX2 #145

Open kwahtong opened 4 years ago

kwahtong commented 4 years ago

Summary

I am unable to build connect-command sample program on a NVIDIA Jetson TX2. I can verify that the protobuf-c headers and c source codes were generated. GCC complained missing members so I am not sure if issue lies on sample code or protobuf generation steps. Appreciate if can help. Many Thanks.

Steps to Reproduce (for bugs)

  1. Build protobuf-c as per protobuf-C README ./configure output protobuf-c 1.3.3 CC: gcc CFLAGS: -g -O2 CXX: g++ -std=c++11 CXXFLAGS: -g -O2 LDFLAGS:
    LIBS:
    prefix: /usr/local sysconfdir: ${prefix}/etc libdir: ${exec_prefix}/lib includedir: ${prefix}/include pkgconfigdir: ${libdir}/pkgconfig bigendian: no protobuf version: libprotoc 3.0.0
  2. Run make to generate protobuf-c header files and build c program $ ../aris-integration-sdk/sample-code/connect-command/linux$ make all
  3. Snippets of compiler errors cp ../../../common/protobuf/.proto . protoc-c --c_out=../. .proto gcc -std=c99 ../connect.c ../availability.pb-c.c ../commands.pb-c.c ../frame_stream.pb-c.c -I ../../../common/protobuf -I ../../../../protobuf-c -L/usr/lib -lprotobuf-c -o connect ../connect.c: In function ‘find_sonar’: ../connect.c:214:21: error: ‘Aris__Availability {aka struct _Aris__Availability}’ has no member named ‘has_serialnumber’; did you mean ‘serialnumber’? if (beacon->has_serialnumber && beacon->serialnumber == serial) { ^~~~ serialnumber

Your Environment

curtnichols commented 4 years ago

Thanks, I'll take a look at this. For what it's worth, this sample was written about 3 years ago, and this sample may not have moved forward with common/protobuf/commands.proto changes, which moved to protobuf syntax v3 two years ago.

You can probably make changes locally and finish with approximately what I will have when I move this code to protobuf v3--more or less, remove the has_xxx() function, and understand that if no value was given the value you see will be zero, zeroes, or empty.

For example, this

https://github.com/SoundMetrics/aris-integration-sdk/blob/6e2b3def7e00495a54eaf96c84c60c4861bc2d7b/sample-code/connect-command/connect.c#L214

will likely become

    if (beacon->serialnumber == serial) {

There is no ARIS serial number 0, so if the serial number were somehow missing from the beacon, serialnumber would appear to be 0, and the condition would still fail appropriately. Previously, we had to check has_serialnumber().

curtnichols commented 4 years ago

Unfortunately, with the protobuf v3 syntax, values for systemtype and other fields may legitimately be zero, so we have to assume those are correctly initialized.

curtnichols commented 4 years ago

@kwahtong Also, is this academic or commercial work? If academic, is there a project page we can follow? :)

kwahtong commented 4 years ago

Hi Curt,

Thanks for the reply. I don't have a project for you to follow. But noted on the old code has not moved on much and probably not worth to work on it.

In that case, I would focus more on vc-using-framestream sample C++ project which I just managed to build successfully on VS2019. I will look into porting to the Jetson environment once the sample code can communicate with the ARIS. Appreciate advise if any.

Regards, Sean

curtnichols commented 4 years ago

Sounds good. I think we wrote connect-command mostly to ensure the headers, etc. were building okay. Irony. It's not currently in our CI pipeline as our internal pipeline doesn't have a Linux branch yet.

-Curt

kwahtong commented 4 years ago

Hi Curt,

Would aris3000 support 2 clients , one as controller to connect and receive frame data, the other client just purely receive frame data? I suppose the frame is sent via udp broadcast ?

The clients will run on different machine.

I was thinking of modifying the vc-using-framestream to strip the tcp connection portion for thr 2nd client.

Pls advise. Thanks. Regards Sean


From: Curt Nichols notifications@github.com Sent: Tuesday, 17 March 2020 00:49 To: SoundMetrics/aris-integration-sdk aris-integration-sdk@noreply.github.com CC: Kwong Wah Tong Sean kwahtong@dso.org.sg,Mention mention@noreply.github.com Subject: Re: [SoundMetrics/aris-integration-sdk] Cannot build C sample program connect-command on a NVIDIA Jetson TX2 (#145)

Sounds good. I think we wrote connect-command mostly to ensure the headers, etc. were building okay. Irony. It's not currently in our CI pipeline as our internal pipeline doesn't have a Linux branch yet.

-Curt

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/SoundMetrics/aris-integration-sdk/issues/145#issuecomment-599642223, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQHYDWQXZPZP6WPFWJLX3DRHZJ7LANCNFSM4LGDET2A.

curtnichols commented 4 years ago

Sean, the onboard software supports UDP point-to-point and, since 2.6.8634, multicast. You can use a multicast address from your controller program and have a second program join the multicast group and listen.

This is discussed in section Multicasting ARIS Frames of the documentation. Hope this helps.

Broadcast is not supported as it causes dire behavior in the onboard software's network stack.

slyrasa commented 4 years ago

Hi Curt, I have meeted the same bug,but i don't know how to solve.Do you mean the file connect.c cannot be compiled.If I want to connect aris 3000 by TX2 and receive the data frame,what should i do ? I need your help,because my work is urgent. Thanks, sincerely Xiaolei

slyrasa commented 4 years ago

Hi Curt, I have meeted the same bug,but i don't know how to solve.Do you mean the file connect.c cannot be compiled.If I want to connect aris 3000 by TX2 and receive the data frame,what should i do ? I need your help,because my work is urgent. Thanks, sincerely Xiaolei

kwahtong commented 4 years ago

Hi Xiaolei,

Use the vc-using-framestream sample C++ project instead which supports data frame receiving. Once you get in working in windows, port over to the TX2 environment, I can't recall exactly but you need to make some minor code changes due to Windows dependencies.

Cheers,

Sean


From: slyrasa notifications@github.com Sent: Saturday, August 1, 2020 8:13:07 PM To: SoundMetrics/aris-integration-sdk Cc: Kwong Wah Tong Sean; Mention Subject: Re: [SoundMetrics/aris-integration-sdk] Cannot build C sample program connect-command on a NVIDIA Jetson TX2 (#145)

Hi Curt, I have meeted the same bug,but i don't know how to solve.Do you mean the file connect.c cannot be compiled.If I want to connect aris 3000 by TX2 and receive the data frame,what should i do ? I need your help,because my work is urgent. Thanks, sincerely Xiaolei

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/SoundMetrics/aris-integration-sdk/issues/145#issuecomment-667522226, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQHYDSQBIAEB6LVOTCY4QTR6QBFHANCNFSM4LGDET2A.

curtnichols commented 4 years ago

@slyrasa can you confirm what your gcc build flags are? Are you building in C or C++, and what version?

@kwahtong your original post appears to be building in C99, is that still the case?

gcc -std=c99 ../connect.c ../availability.pb-c.c ../commands.pb-c.c ../frame_stream.pb-c.c -I ../../../common/protobuf -I ../../../../protobuf-c -L/usr/lib -lprotobuf-c -o connect

Also--are you using any pre-made, readily available images for your build tools, such as virtual machines or docker images?

kwahtong commented 4 years ago

@slyrasa can you confirm what your gcc build flags are? Are you building in C or C++, and what version? It is C++ and was an attempt to build the connect-command project. Since it did not have frame receive support, I dropped the approach.

@kwahtong your original post appears to be building in C99, is that still the case? The vc-using-framestream. sample project requires C++ 17 or even later. I did not use pre-made vm/docker images in TX2.

slyrasa commented 4 years ago

 hi,Curt,        My protobuf--version is 3.12.3,my ubuntu version is 16.04.I have run successfully the file connect-command by deleting the redundant member(has__××),I guess the reason why the program cannot be run is the protobuf version is not suit.About the version of c or c++,I don’t think the impact is big.       Recently i want to get the aris data frame in ros,but i hava many trouble. If you make some progress,please give me some advises. Thanks!

------------------ 原始邮件 ------------------ 发件人: "Curt Nichols"<notifications@github.com>; 发送时间: 2020年8月4日(星期二) 晚上10:49 收件人: "SoundMetrics/aris-integration-sdk"<aris-integration-sdk@noreply.github.com>; 抄送: "直立行走的鱼"<694515905@qq.com>; "Mention"<mention@noreply.github.com>; 主题: Re: [SoundMetrics/aris-integration-sdk] Cannot build C sample program connect-command on a NVIDIA Jetson TX2 (#145)

@slyrasa can you confirm what your gcc build flags are? Are you building in C or C++, and what version?

@kwahtong your original post appears to be building in C99, is that still the case?

gcc -std=c99 ../connect.c ../availability.pb-c.c ../commands.pb-c.c ../frame_stream.pb-c.c -I ../../../common/protobuf -I ../../../../protobuf-c -L/usr/lib -lprotobuf-c -o connect

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

slyrasa commented 4 years ago

HI,kwahtong I have successfully run vc-using-framestream,now i want to port over to the TX2 environment.But firstly i prefer to run it on my computer for convenience,then turn to TX2. I write a makefile document and i put it in the end. the error about #include show it don't exist,then i replace it with #include<boost/optional.cpp>,it will show new error,like this ‘optional’ in namespace ‘std’ does not name a template type std::optional useMulticast; i don't know how to solve ,can you help me.which file should i change? The error "somewas not declared " " has no member" "expected primary-expression before"appears many times,i guess i couldn't solve the problem by myself. thanks!!