Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Go言語によるROSプログラミング
Search
akio
September 14, 2018
Technology
530
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go言語によるROSプログラミング
Slides used in my talk about ROS client library implementation for ROS.
akio
September 14, 2018
More Decks by akio
See All by akio
2016-06-26 第8回ROS勉強会LT資料 catkin-tools
akio
0
420
2016-06-26 第8回ROS勉強会資料 ROSCRAFT
akio
0
520
第1回ROS勉強会発表資料 ROS+Gazeboではじめるロボットシミュレーション
akio
0
750
Other Decks in Technology
See All in Technology
WasmをRustにする
sansantech
PRO
0
250
Rustuna: Rustによる高速なOptuna実装
pfn
PRO
0
190
Rust で関数型ドメインモデリング
takonda
0
140
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
170
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
920
パッチ更新でterraform initが落ちた日
grimoh
1
140
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
190
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.7k
AI コーディングと人間の認知スループット / CTO Night & Day 2026 Morning Session / AI Coding and Human Cognitive Throughput
prog893
4
1k
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
160
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
Building the Perfect Custom Keyboard
takai
2
910
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
GitHub's CSS Performance
jonrohan
1033
470k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
330
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
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