Hi I'm programming the ros2
ros1 (ubuntu) -> ros2(window)
It was so rough time.
#I'm Korean. so.. english is not well
I already posted some informs, but today I know you guys that how to connect and send msg, srv with another package on ros2
difference with ros2, ros1 can connect with other packages msgs, srvs which customiazed.
But ! ros2 is not possible with same way with ros1.
ex) each ros1 packages have own msgs, srv. in this situation. once they can connect and work callback function, if you just match 'topic'.. but! in ros2 they can't with only same 'topic'..
So... how to connect with other packages in ros2 ?
that is fuckking simple.
just make new one package for only msgs, srvs. ex) my_interface
and build that with all setting. and you need to plus "find_package(this msg, srv package REQURED)" at your cmake every package which need this msg, srv.
and change code all about msg, srv locs code to that build locs.
like before . mypack/msg/ddd.msg -> my_interface/mgs/ddd.msg like this. change all package same.
So the all packages share the same msg and srv structor, right?
after this. you can finally connect with other packages publish, subcriptions.
good luck. I had didn't know this for 1week. ;_ ;
ros1 우분투를 ros2 윈도우로 바꾸는 과정에서 많은 우여곡절이 있었습니다.
제 이전글들을 보시면 알겠지만, 여러 시행착오가 많았어요.
지금은 이제 막바지에 와서 ros1과 ros2의 퍼블리쉬 구독 차이점을 알려드릴게요.
예전 ros1은 다른 패키지간에 각각 msg와 srv가 있고 그 구조만 같으면 다른폴더에 있더라도,
토픽을 맞추면 통신이 됏었습니다. 구독 콜백이 잘 됐죠.
하지만 ros2는 다릅니다. 토픽도 맞아야 하며, 커스터마이징한 msg와 srv경로 또한 모두 동일해야 해요.
그럼 의아하겠죠? 다른 패키지 인디 경로를 어떻게 같게하냐~?
방법은 간단했습니다. 그냥
커스터 마이징된 msg와 srv만 있는 패키지를 새로 만들고 그것만 build하고 그것을
모든 통신이 필요한 패키지에 find_package해서 추가해주면 됩니다.
물론 그 세부적은 수정들 다 해주시구요. package.xml이나 이런 나머지 것들요.
어쨋든 ros2는 커스터마이징 msg통신을 하기 위해서는 모든 msg, srv가 모든 패키지에서 동일한 경로에 있어야합니다.
그 경로가 다르면 다른 것으로 간주합니다.
그래서 따로 커스터마이징용 패키지를 만들고 그 패키지를 추가하세요.
그럼 당연 모든 패키지에서 그 커스터마이징한 msg를 참조할때 다 같은경로로 참조가 되겠죠?
그럼 해결이 됩니다.
초보자라 1주일동안 찾아해매다 겨우 해결했습니다. 방법은 참 쉬운데 알고 모르고 차이가 극심하죠~ 이래서 개발자 개발자 하는가봐요.