端端舝
Submit Search
鬼棗喧梭勳紳匹賊倏釦用奈玉毛抎中化心凶
?
3 likes
?
2,568 views
Naoki Iwata
Follow
2015/10/04 ROS辭頗
Read less
Read more
1 of 39
Download now
More Related Content
鬼棗喧梭勳紳匹賊倏釦用奈玉毛抎中化心凶
1.
Kotlin匹ROS用奈玉毛 齯中々艉 2015/10/04 ROS辭頗 @iwata_n
2.
@iwata_n 中歹凶氏 rossㄡ仳堎仁日中 - ROS掛毛掂氏分什日中 伕奈玉田奶弁午示伙母伉件弘
3.
Message 仇及用奈玉毛Kotlin匹釬勻凶ㄐ
4.
踏誘角縣卅 ROS用奈玉毛Kotlin匹齯窈蔆
5.
What s Kotlin? Why
Kotlin?
6.
鬼棗喧梭勳紳毛眭勻化月芄
7.
引丑公丹卅曰引允方友
8.
What's Kotlin? Java午肮元A諝犍極鯠洃茪砟惜氶 Java方曰假 Java方曰 Java午肮脹卞厒中 日仄中 丐午Android及失皿伉手齯惜諵擗楔
9.
Kotlin晟惤反﹜斥尼永玄皮伊奶件朮扦及旃噶垀及夫午勾﹜伕扑失窣堊 伊瓦件弘仿奈玉笣飲及扔件弁玄矢氾伙皮伙弁匹汜引木凶﹝ 斥尼永玄皮伊奶件朮扦反 Java﹜Ruby﹜Python 卅升及皿伕弘仿立件 弘晟惤卞方月嶱逃虐噫卅升毛嶱逃仄化茪楔々迨縑Θotlin晟惤反肮 扦互磊歠毛魂井仄化Java晟惤毛手勻午﹜假咫豸吨諵銴忖佶鐘慾 凶宴I瞳蚚砃仃驞識婭Z午仄化﹜2011爛7堎20掑阭k桶今木凶﹝ 左矢奈伊奈氾奴件弘?扑旦氾丞卞方日內JavaA諝犍極鯠洃茪砥 Java晟惤互齯咫鴗縞蚰磳陞擖鄐肮元幻升厒仁戊件由奶伙今木肮元幻 升厒仁衿髐馱諵仄化中月﹝ Java晟惤卞咡引木化中月C夔匹丐勻化手誑Q俶毛悵勾凶戶卞g政匹五 化中卅中C夔支﹜蔚懂及Java晟惤及帊匹g政互軑隅今木化中月C夔 井日﹜衄蚚午佷丹C夔毛鵛瓣楔縑ㄓ牏縑℃avaA諝犍極韝茪秘膉 侔化中月旦弁伉皿玄晟惤
Groovy 支憝杅倰皿伕弘仿立件弘晟惤伎及 中 Scala 井日﹜C夔支眢楊ㄗ昒畟恅ㄘ毛鵛瓣楔縑 2012爛2堎14捸℉otlin 反Apache仿奶本件旦 田奈斥亦件2.0卞價勿 仄仁反Web匹ㄐ
10.
Kotlin互Java午肮元A諝犍極鯠洃茪 ∣ 公木卅日RosJava匹茪砟韝舅膉礿 ∣ 元扎丑復井戶方丹 Why Kotlin?
11.
撮扲腔卅趕
12.
忒 1. RosJava毛諵鴗 2. RosJava及皿伕斥尼弁玄毛釬月 3.
build.gradle卞kotlin憝S及戊奈玉毛袚允月 4. kotlin匹戊奈玉毛齯 5. 申伙玉
13.
RosJava及奶件旦玄奈伙 http://qiita.com/iwata-n@github/items/ 989bed3acc21?b28521
14.
$ mkdir -p
/ros/myjava/src $ cd /ros/myjava/src $ source /opt/ros/indigo/setup.bash $ catkin_init_workspace $ cd .. $ catkin_make catkin及伐奈弁旦矢奈旦釬傖 ROS掛及P42‵及釬I囀搕肮元匹允
15.
由永弗奈斥及釬傖 $ cd /ros/myjava/src $
catkin_create_rosjava_pkg <Package> ROS掛及P44‵及釬I卞眈絞仄引允﹝ 凶分﹜rosjava匹由永弗奈斥毛釬傖允月及匹﹜ 戊穴件玉互綃中引允﹝ <Package>反云疑五卅靡ヶ匹﹝
16.
由永弗奈斥及釬傖 Created repo ?le:
/home/ros/ros/myjava/src/kotlin/settings.gradle Created repo ?le: /home/ros/ros/myjava/src/kotlin/build.gradle Created repo ?le: /home/ros/ros/myjava/src/kotlin/CMakeLists.txt Created repo ?le: /home/ros/ros/myjava/src/kotlin/package.xml Creating gradle wrapper: /opt/ros/indigo/lib/python2.7/dist-packages/ rosjava_build_tools/gradle/gradlew -p /home/ros/ros/myjava/src/kotlin wrapper :wrapper BUILD SUCCESSFUL Total time: 7.033 secs catkin_create_rosjava_pkg毛g俴磐彆
17.
皿伕斥尼弁玄毛釬傖 $ cd /ros/myjava/src/kotlin/ $
catkin_create_rosjava_project sample Creating rosjava project Name : sample File : build.gradle File : settings.gradle File : Talker.java File : Listener.java File : CMakeLists.txt (gradle task update) gradle支java白央奶伙脹及斛猁卅白央奶伙毛汜傖仄化仁木月
18.
package com.github.rosjava.kotlin.sample; /* 謹
*/ public class Listener extends AbstractNodeMain { @Override public GraphName getDefaultNodeName() { return GraphName.of("rosjava/listener"); } @Override public void onStart(ConnectedNode connectedNode) { ?nal Log log = connectedNode.getLog(); Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE); subscriber.addMessageListener(new MessageListener<std_msgs.String>() { @Override public void onNewMessage(std_msgs.String message) { log.info("I heard: "" + message.getData() + """); } }); } }
19.
申伙玉 $ cd /ros/myjava $
catkin_make Base path: /home/ros/ros/myjava # ... 吽謹 #### Running command: "make -j8 -l8" in "/home/ros/ros/myjava/build" #### Scanning dependencies of target gradle-iwatan [100%] Gradling tasks for kotlin Uploading: com/github/rosjava/kotlin/sample/0.1.0/sample-0.1.0.jar to repository remote at ?le:/home/ros/ros/myjava/devel/share/maven Transferring 4K from remote Uploaded 4K [100%] Built target gradle-kotlin catkin匹申伙玉互堤懂月互﹜gradle匹眻諉申伙玉仄凶源互厒中
20.
g俴 $ cd src/<Package>/sample/build/install/sample/bin $
./sample com.github.rosjava.kotlin.sample.Listener
21.
rosjava反 仇仇引匹匹忒匹OK
22.
鬼棗喧梭勳紳趙
23.
build.gradle毛摩 apply plugin: 'application' mainClassName
= 'org.ros.RosRun' dependencies { compile 'org.ros.rosjava_core:rosjava:[0.2,0.3)' } roskotlin/src/<Package>/sample/build.gradle gradle午反介勻仁曰晟丹午Make?le心凶中卅手及 (坻卞手伎〝C夔反丐曰引允互)
24.
袚樓公及ㄠ apply plugin: kotlin" buildscript
{ repositories { mavenCentral() maven { url 'http://oss.sonatype.org/content/repositories/snapshots' } } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT' } }
25.
袚樓公及ㄡ sourceSets { deploy } repositories { mavenCentral() maven
{ url 'http://oss.sonatype.org/content/repositories/snapshots' } } dependencies { compile 'com.google.guava:guava:12.0' compile 'org.jetbrains.kotlin:kotlin-stdlib:0.1-SNAPSHOT' deployCompile 'com.google.guava:guava:12.0' testCompile 'org.testng:testng:6.8' } test.testClassesDir = project.tasks.compileTestKotlin.destinationDir
26.
仇及ㄡ勾毛袚允木壬 Kotlin匹齯惜
27.
kotlin匹戊奈玉毛齯 ? IntelliJ IDEA毛妏丹午皿仿弘奶件匹Java↙Kotlin互 g卞堤懂月 ?
IntelliJ反Python匹手晞瞳卅IDE卅及匹左旦旦丟 ? Java及白央奶伙毛嶱中化赻Q允月分仃 ? http://kotlinlang.org/docs/tutorials/kotlin-android.html
28.
package com.github.rosjava.kotlin.sample; /* 謹
*/ public class Listener extends AbstractNodeMain { @Override public GraphName getDefaultNodeName() { return GraphName.of("rosjava/listener"); } @Override public void onStart(ConnectedNode connectedNode) { ?nal Log log = connectedNode.getLog(); Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE); subscriber.addMessageListener(new MessageListener<std_msgs.String>() { @Override public void onNewMessage(std_msgs.String message) { log.info("I heard: "" + message.getData() + """); } }); Java
29.
package com.github.rosjava.kotlin.sample /* 謹
*/ public class Listener() : AbstractNodeMain() { override public fun getDefaultNodeName(): GraphName = GraphName.of("rosjava/listener") override public fun onStart(connectedNode: ConnectedNode) { val log = connectedNode.getLog() val subscriber = connectedNode.newSubscriber<std_msgs.String>("chatter", std_msgs.String._TYPE) subscriber.addMessageListener { message -> log.info("Kotlin heard: "" + message.getData() + """) } } } Kotlin
30.
申伙玉 $ cd /ros/myjava $
catkin_make Base path: /home/ros/ros/myjava # ... 吽謹 #### Running command: "make -j8 -l8" in "/home/ros/ros/myjava/build" #### Scanning dependencies of target gradle-kotlin [100%] Gradling tasks for kotlin Uploading: com/github/rosjava/kotlin/sample/0.1.0/sample-0.1.0.jar to repository remote at ?le:/home/ros/ros/myjava/devel/share/maven Transferring 4K from remote Uploaded 4K [100%] Built target gradle-kotlin RosJava午咫翅洶腹
31.
g俴 仇木引凶RosJava午咫翅洶腹 $ cd src/<Package>/sample/build/install/sample/bin $
./sample com.github.rosjava.kotlin.sample.Listener
32.
忒云今日中 1. RosJava毛諵鴗 2. 皿伕斥尼弁玄毛釬月 3.
build.gradle卞kotlin憝S及戊奈玉毛袚允月 4. kotlin匹戊奈玉毛齯 5. 申伙玉 RosJava午珨髯 RosJava午珨髯
33.
鬼棗喧梭勳紳趙 ? 戊奈玉反屾仄卞卅勻凶 ? Null假咫g俴笢卞厄月弔匹芼銖壑o中 ?
用奈玉及芼銖擊堭隉ぱ籵及Exception匹反侚厄 ? IntelliJ IDEA午ROS及眈俶互中中岈卞搕洶臚
34.
詁喝喧#
35.
詁喝喧# ? Python午掀屯月午g俴引匹卞r嶲互井井月 ? 扔件皿伙及申伙玉卞11鏃幻升 ?
甩永市末件卅升奀潔互拸中奀卞反旦玄伊旦卞
36.
引午戶
37.
引午戶 ?Kotlin匹及用奈玉g蚾及源楊毛畿賡 ?RosJava匹手ROS掛及眭舑互汜五月 ?傻ぶ及嶱逃匹噙腔倰晟惤反湮 ?倰民尼永弁午Null本奈白反假陑
38.
云仄引中
39.
伉件弁 ? 迡淩匼第天仁凶公 ? https://www.pakutaso.com ?
RosJava毛諵鴗諧嶕 ? http://qiita.com/iwata-n@github/items/989bed3acc21?b28521 ? Kotlin匹ROS及用奈玉毛齯 ? http://qiita.com/iwata-n@github/items/30eefa47326fb5b0ef77 ? 踏掑峊釧`玉ㄚ汐及Github ? https://github.com/iwata-n/roskotlin ? Kotlin及Github ? https://github.com/JetBrains/kotlin-examples/blob/master/ gradle/hello-world/build.gradle
Download