Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go言語によるROSプログラミング
Search
akio
September 14, 2018
Technology
0
470
Go言語によるROSプログラミング
Slides used in my talk about ROS client library implementation for ROS.
akio
September 14, 2018
Tweet
Share
More Decks by akio
See All by akio
2016-06-26 第8回ROS勉強会LT資料 catkin-tools
akio
0
370
2016-06-26 第8回ROS勉強会資料 ROSCRAFT
akio
0
430
第1回ROS勉強会発表資料 ROS+Gazeboではじめるロボットシミュレーション
akio
0
680
Other Decks in Technology
See All in Technology
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
490
FlutterアプリにおけるSLI/SLOを用いたユーザー体験の可視化と計測基盤構築
ostk0069
0
180
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
130
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
230
A Tour of Anti-patterns for Functional Programming
guvalif
0
380
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
670
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
120
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
570
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
OOM発生時のトラブルシューティング Profilerを活用できるか調査してみた
atsushii
0
110
OCI Vault 概要
oracle4engineer
PRO
0
9.8k
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
140
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
A Tale of Four Properties
chriscoyier
156
23k
What's new in Ruby 2.0
geeforr
343
31k
Agile that works and the tools we love
rasmusluckow
327
21k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Rails Girls Zürich Keynote
gr2m
94
13k
Transcript
GoݴޠʹΑΔROSϓϩάϥϛϯά https://github.com/akio/rosgo.git
ࣗݾհ
ࣗݾհ • Akiyoshi(Akio) Ochiai • Sr Engineer @ Toyota Research
Institute • ϞόΠϧϚχϐϡϨʔγϣϯϩϘοτͷݚڀ։ൃʹैࣄ • GitHub: http://github.com/akio • ࠓݸਓతͳOSS׆ಈͷΛ͠·͢
ROSؔͰ࡞ͬͨͷ • rosrb • ROSͷRubyΫϥΠΞϯτϥΠϒϥϦ • ࣌ಉ͡ձࣾʹ͍ͨ@OTLࢯͱ͔Ϳ্ͬͨʹग़ΕͯϘπ • vim-ctrlp-ros •
Vim Ctrl-P ROS ϓϥάΠϯ • msg/srv/actionͳͲΛVim͔ΒΠϯΫϦϝϯλϧαʔν • RosCraft • MinecraftΛROS͔Β੍ޚͰ͖Δͧ • Կ͕͔ͨͬͨ͠ͷ͔Α͘Θ͔Βͳ͍ • fluent_logger_ros • ROSͷϩάΛfluentdʹྲྀ͠ࠐΉখ • mask_rcnn_ros • Advent CalendarͷωλͷͨΊʹ։ൃ • menoh_ros • ONNXΛROSͷը૾ॲཧύΠϓϥΠϯʹυϩοϓΠϯ • rosgo • ࠓճൃද͢Δ༰ • ͦͷଞ׆ಈ • MoveIt! ͷPRɺϝϯςφʔձٞࢀՃͳͲ • ROSίΞύοέʔδͷPRͳͲ
ެ։ROS͓ࣄ • ։ൃνʔϜͷڠྗͷͱɺτϤλHSRͷϩϘοτϞσϧϑΝΠϧΛΦʔϓϯιʔεԽ͠·ͨ͠ • hsr_description • https://github.com/ToyotaResearchInstitute/hsr_description • hsr_meshes •
https://github.com/ToyotaResearchInstitute/hsr_meshes https://github.com/OTL/gear ROSҎ֎Ͱͷ׆༻ྫ
Why Go?
ಈػ • 2013࣌ɺROS։ൃਓࡐͷҭʹΜͰ͍ͨ • C++ • ෳࡶͳݴޠ༷ • Python/MatlabͳͲ͔Βདྷͨਓͷϋʔυϧ͕ߴ͍ •
Cݴޠܦݧऀ͕৽֓೦ΛֶͿͷ͍͠ʢOOPɺδΣωϦοΫϓϩάϥϛϯάʣ • Python • ֶशίετ͍ • ੑೳ͕ඞཁʹͳΔͱ݁ہC/C++/CythonͳͲΛॻ͔͟Δ͑ͳ͘ͳͬͨΓ͢Δ
͍֮͑͢ ͍ͦͦ͜͜ ͋ΔఔϦΞϧλΠϜੑͷ͋Δ ϓϩάϥϛϯάݴޠͳ͍͔ʁ
̎̌̍̏࣌ͷީิൺֱ • Java • rosjava͕͢Ͱʹଘࡏ • ωΠςΟϒίϯύΠϧͰ͖ͳ͍ • ύοέʔδ͕ͭΒ͍ •
Go • Better C తͳจ๏ • ػೳ͕ߜΒΕ֮͑Δ͜ͱ͕গͳ͍ • ωΠςΟϒίϯύΠϧͰ݁ߏ͍ • GC͕ϝϞϦͷੈΛͯ͘͠ΕΔ • Rust • ͍ɺ҆શɺؾ͍͍࣋ͪ • ͕ࣗٻΊ͍ͯͨͷ͕େମ͋Δ • ͋Γ͗ͯͬ͢ͺΓֶशίετ͕ߴ ͍ͷͰ‥.ʁ • Julia • ॻ͖ͯͯ͘͘͢࠷ڧʹݟ͑Δ • Ͱ࣌Ͱ͖͔ͨΓͰ৭ʑػೳ͕ Γͳ͔ͬͨ • ฒྻॲཧ͕ͭΒͦ͏
ͦͷଞͷڧΈ • ڧྗͳ։ൃମ੍ʢby Google) • ϨΠςϯγͳΨϕʔδίϨΫγϣϯʢޙड़) • ๛ͳ։ൃ࣮(DockerͳͲ) • σϑΥϧτͰ੩తϦϯΫ͞ΕͨγϯάϧόΠφϦΛੜ
• πʔϧ։ൃͳͲʹ͘ • σϓϩΠ͕؆୯
αϒϛϦඵGC ग़యɿhttps://twitter.com/brianhatfield/status/804355831080751104
ऑΈ • ϝϞϦΛେྔʹ֬อɾղ์͢ΔΑ͏ͳ͍ํΛ͢Δͱεϧʔϓοτ͕ѱԽ • Պֶٕज़ܭࢉ༻ͷϥΠϒϥϦ͕গͳ͍ʢগͣͭ͠૿͖͑ͯͨɺޙͰհʣ • ԋࢉࢠΦʔόʔϩʔυ͕ͳ͍ʢˢʹͪΐͬͱӨڹʣ • όΠφϦαΠζ͕େ͖͘ͳΓ͕ͪ
GoͰROSϓϩάϥϛϯάͰ͖ΔΑ͏ʹ͠Α͏
rosgo ॳظ։ൃ൛(2013) • ͕ΜΓϙΠϯτ • XMLRPCϥΠϒϥϦ͕ͳ͔ͬͨͷͰࣗͰ࣮ͨ͠ • CatkinπʔϧνΣʔϯʹ౷߹
࠷ۙͷΞοϓσʔτ(2018) • RemappingΛ࣮ • ΫϥΠΞϯτϥΠϒϥϦͷػೳ͕Ұ௨ΓͦΖͬͨ • v1.0.0ͷ४උ͕ͬͨʁ • ಠཱͨ͠msg/srvίʔυδΣωϨʔλΛ࣮ •
Good bye, Catkin and CMake! • GoͷίʔυδΣωϨʔλΛ࣮ͯ͠ Pure Go ύοέʔδԽ • Go generateͱvendoringΛར༻ʢޙड़ʣ
ϝοηʔδੜ • Goͷػೳ go generate (v1.4+)ɹͱ vendorng (v1.5+)Λ׆༻ • ιʔείʔυதʹҎԼͷΑ͏ʹॻ͍͓ͯ͘
• //go:generate gengo msg your_pkg/MsgType • $ go generate <GO_PKG_NAME> Λ࣮ߦ • ͢Δͱɺ$GOPATH/your_pkg/vendorҎԼʹGoίʔυ͕ੜ
rosgo ίʔυྫ
Πϯετʔϧ 1. GoͷΠϯετʔϧ 2. $ go get -u github.com/akio/rosgo/ros 3.
$ go install github.com/akio/rosgo/gengo 4. import “github.com/akio/rosgo/ros"
Publisher package main //go:generate gengo msg std_msgs/String import ( "fmt"
"github.com/akio/rosgo/ros" "os" "std_msgs" "time" ) func main() { node, _ := ros.NewNode("/talker", os.Args) defer node.Shutdown() pub, _ := node.NewPublisher("/chatter", std_msgs.MsgString) for node.OK() { node.SpinOnce() var msg std_msgs.String msg.Data = fmt.Sprintf("hello %s", time.Now().String()) pub.Publish(&msg) time.Sleep(time.Second) } }
Subscriber package main //go:generate gengo msg std_msgs/String import ( "fmt"
"github.com/akio/rosgo/ros" "os" "std_msgs" ) func callback(msg *std_msgs.String) { fmt.Printf("Received: %s\n", msg.Data) } func main() { node, _ := ros.NewNode("/listener", os.Args) defer node.Shutdown() node.NewSubscriber("/chatter", std_msgs.MsgString, callback) node.Spin() }
Example: Service Server package main //go:generate gengo srv rospy_tutorials/AddTwoInts import
( "fmt" "github.com/akio/rosgo/ros" "os" "rospy_tutorials" ) func callback(srv *rospy_tutorials.AddTwoInts) error { srv.Response.Sum = srv.Request.A + srv.Request.B fmt.Printf("%d + %d = %d\n", srv.Request.A, srv.Request.B, srv.Response.Sum) return nil } func main() { node, _ := ros.NewNode("server", os.Args) defer node.Shutdown() server, _ := node.NewServiceServer("/add_two_ints", rospy_tutorials.SrvAddTwoInts, callback) defer server.Shutdown() node.Spin() }
Service Client package main //go:generate gengo srv rospy_tutorials/AddTwoInts import (
"fmt" "github.com/akio/rosgo/ros" "os" "rospy_tutorials" ) func main() { node, _ := ros.NewNode("client", os.Args) defer node.Shutdown() cli, _ := node.NewServiceClient("/add_two_ints", rospy_tutorials.SrvAddTwoInts) defer cli.Shutdown() var srv rospy_tutorials.AddTwoInts srv.Request.A = 1 srv.Request.B = 2 _ = cli.Call(&srv) fmt.Printf("%d + %d = %d\n", srv.Request.A, srv.Request.B, srv.Response.Sum) }
Parameters package main import ( "fmt" "github.com/akio/rosgo/ros" "log" "os" )
func main() { node, _ := ros.NewNode("/test_param", os.Args) defer node.Shutdown() hasParam, _ := node.HasParam("/rosdistro") param, _ := node.GetParam("/rosdistro") err := node.SetParam("/test_param", 42) param, _ := node.GetParam("/test_param") err := node.DeleteParam("/test_param") foundKey, _ := node.SearchParam(“/rosdistro") }
͜Ε͔Β
ػೳՃ • Action Client/Server • TF • ଞʁ
ϩϘοτ։ൃʹ͑ΔGoϥΠϒϥϦͷհ • GoCV • OpenCVͷGoόΠϯσΟϯά • Tensorflow • ެࣜͷGoόΠϯσΟϯά͕ ͋Δ
• GoNum • NumpyతͳܭࢉϥΠϒϥ Ϧ • gobot • ओʹIoTͳ֎෦σόΠεͱͷI/Oॲཧϥ ΠϒϥϦ • g3n • ήʔϜΤϯδϯɺՄࢹԽͳͲʹ͑Δ • GoRO • ৭ʑΓͳ͍ͷͰࣗͰ࡞Γ࢝Ίͨ • https://github.com/akio/goro • ·ͩURDF parser ͘Β͍͔͠ͳ͍
Go 2 • GoݴޠͷΧϯϑΝϨϯε GopherCon2018ʹͯɺGo 2ͷυϥϑτ͕ൃද • Τϥʔॲཧจ๏ͷվྑ • δΣωϦΫεͷՃ
ROS2 • DDSΛ࣮͢Δͷେมͦ͏ • rclΛcgoͰϥοϓ͢Δʁ
·ͱΊ • GoݴޠͰ͑ΔROSΫϥΠΞϯτϥΠϒϥϦΛ։ൃͨ͠ • ฏ͕ऴΘΔલʹൃදͰ͖ͯྑ͔ͬͨ
Thank you! https://github.com/akio/rosgo.git