ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
ROS SERIAL and OpenCR
- OpenCR? ROS ??? ????
* ? ??? ??? ?? ????? ? ??? ??? ?? ??? ????? ??? ??????. / CC BY 4.0
?5? ?? ???? ???
? ? ?
Robot
Operating
System
Best tool for your robot!
https://youtu.be/Z70_3wMFO24
What is the Best
Computing Resource
for Your Robot?
intel.com / st.com
I¡¯m
Robot!
ROS SERIAL and OpenCR
Intel NUC
for Sensor and Communication
Intel NUC
for Sensor and Communication
ARM Cortex-M
for Motor control and Analog Sensors
Small embedded systems
are everywhere in ROBOT!
Scope of computing resources : computation vs control
Morgan Quigley (OSRF) "ROS 2 on ¡°small¡± embedded systems", ROSCon2015
Communication between the computer and the microcontroller
????? ???? ROS ? 8051, AVR, ARM Cortex-M ?? MCU(Micro Controller
Unit)?? ??? ??? ?? rosserial ??? ROS? ???? ???? ??.
ROS ???? ????? ????? ?????? ???? ??? ??? ????
???? ????? ???? ???? ??? ?????. ?, ??? ?? ???
????? ??????? ????? ???? ??? ??? ???? ?????
????? ???. ???? ??? ??? ????? ??? ??? MCU ??
???? ??? ??? ?? ????? rosserial? ????.
? ?????? ??? ????? ?? ??? ????&ROS ?? ????? ??,
pubsub ??? ???? OpenCR ?? ????, ???????? rosserial?
???? ???? ?????? ????? ??? ??? ????? ??.
Communication between the computer and the microcontroller
rosserial for embedded system to control the hardware parts of ROBOT!
rosserial ? ??? ??? ?? ?? ???? ??? ?? ????
?????????? ??? ??? ?? ???? ROS? ?????. ? ? ??
(????????????)? ??? ?? ?? ?????? ?????????
?? ??? UART? ?? ??? ???? ???? ??? ?? ROS ?? ????
ROSTCP ?? ?? ??? ??? ??.
? ??? ??? rosserial? rosserial-server? ??????? ???(???
???? Xbee, ???? ??? ????? ??)? ??? ? ????? ???
??? ????.
rosserial for embedded system to control the hardware parts of ROBOT!
????, ????????? ??? ???? ADC? ????? ?? ? ????
???? ??, ???? rosserial-server ??? ??? ?? ??? ROS??
???? ??(Topic)?? ???? ???? ??.
???, ROS ? ?? ???? ?? ?? ???? ???? ???? rosserial-server
??? ?? ???? ?????????? ???? ??? ??? ?? ????
?? ???.
SBC? ??? ?? ???? ??, ??? ??? ???? ?? ???? ??? ??
???? ???? ????????? ???? ?? ???? ????? ??? ?
??? ?? ???? ??.
OpenCR + ROSSERIAL
?? ????? ???? Ubuntu 16.04 LTS OS? ROS Kinetic
??? ???? ??? ?? ?? OpenCR + rosserial ? ????
?? ????. F/W? Arduino IDE 1.6.12 ?? ????.
http://cafe.naver.com/openrt/15345
rosserial install
?? ???? rosserial? ???? ?? ?? ???? ????? ??.
? ???? ros-kinetic-rosserial-windows ros-kinetic-rosserial-xbee,
ros-kinetic-rosserial-embeddedlinux ?? ??? ?? ??? ???? ?????
??.
$ sudo apt-get install ros-kinetic-rosserial
ros-kinetic-rosserial-server ros-kinetic-rosserial-arduino
Build the ros libs for rosserial
???? ???? IDE ?? ????? ?????? ????? ??.
??? ?? ???? IDE? ????? ????? ??? ??? ? ?? ros_lib ?
?? ????(???? ros_lib? ??? ??? ????? ? ?? ???
????? ??).
? ?, rosserial_arduino ???? make_libraries.py ??? ???? ros_lib?
????.
$ cd ~/Arduino/libraries/
$ rm -rf ros_lib
$ rosrun rosserial_arduino make_libraries.py .
Build the ros libs for rosserial
make_libraries.py ???? ?? Arduino IDE ?? ROS ?????? ?????
ros.h? ?? ?? ?????? ??? ROS ??? ? catkin_ws ? ???
??? ??? ????? ??? ???? ???? ?? ????.
?? ??? ???? IDE?? ???? ??? ? ??.
??? ?? ~/Arduino/libraries/ros_lib ??? ??? ???? ?????? ??.
OpenCR? ??? ??? ?? ???? ??? ?? ??? ??? ?? ??? ??? ??.
~/Arduino/libraries/ros_lib/ArduinoHardware.h ? 59?? ??? ?? ??? ????.
(???) #define SERIAL_CLASS HardwareSerial
(???) #define SERIAL_CLASS USBSerial
Communicating ROS messages between the computer and the OpenCR board
????? ???? OpenCR ???? ROS ??? ??? ???? ???.
OpenCR ??? ???? USB??? ???? ??? ?? ???? IDE? ????.
? ?? ???? [File] > [Sketchbook] > [libraries] > [ros_lib] > [pubsub] ? ????
??? ??? ???? OpenCR ??? ???? ??? ??. ?? 0.5? ???
"hello world!"?? string ??? ???? ????(publish)?? toggle_led ?? ??
??? LED ?? ??? ???????(subscribe)?? ??????.
??? ?? ? ?? ??? ???? ?? ??? ?? ?? ??? ??? ???
?? ??? ??? ???.
$ arduino
Example of rosserial: pubsub
Example of rosserial: pubsub
?? ??? ?? roscore? ?? ?,
??? ?? ?????? rosserial_python???? serial_node.py? ????.
$ roscore
$ rosrun rosserial_python serial_node.py
_port:=/dev/ttyACM0
Example of rosserial: pubsub
??? OpenCR ???? ?????? ?? ???? ?????.
??? ?? rostopic echo ???? "chatter" ?? ??? ???? ?????.
0.5? ??? ???? ?? ??? ??? ? ??.
$ rostopic echo /chatter
data: hello world!
---
data: hello world!
---
data: hello world!
Example of rosserial: pubsub
??? ????? std_msgs/Empty ??? "toggle_led"?? ???? OpenCR
???? led ?? ??? ?????? OpenCR ????? ?? ?????????
led ? on/off ??? ??? ??. ??? ???? ??? ?? OpenCR ??? led?
???? ?? ? ? ??. ?? ???? ??? led ? ???? ?? ?? ????
??? ???. ? ??? ??(toggle) ??? ?? ??.
$ rostopic pub -1 /toggle_led std_msgs/Empty "{}"
publishing and latching message for 3.0 seconds
$ rostopic pub -1 /toggle_led std_msgs/Empty "{}"
publishing and latching message for 3.0 seconds
Example of rosserial: pubsub
? ????? ??????? ??? ??? rqt_graph? ???? ??? ??.
$ rqt_graph
Example of rosserial: pubsub
??? ????? ??????? ?? ????? ???? ROS ?????? ??
???? ????. ?? ?? ?? ? ??? OpenCR ?? ????????
???? ? ???. ??, ??? ??? ?? ????(pubsub)? ????.
#include <ros.h>
#include <std_msgs/String.h>
#include <std_msgs/Empty.h>
ros::NodeHandle nh;
void messageCb( const std_msgs::Empty& toggle_msg) {
digitalWrite(13, HIGH-digitalRead(13)); // blink the led
}
ros::Subscriber<std_msgs::Empty> sub("toggle_led", messageCb );
std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);
char hello[13] = "hello world!";
void setup() {
pinMode(13, OUTPUT);
nh.initNode();
nh.advertise(chatter);
nh.subscribe(sub);
}
void loop() {
str_msg.data = hello;
chatter.publish( &str_msg );
nh.spinOnce();
delay(500);
}
ros_libs
?? ????(pubsub)????
ADC, Blink, BlinkM, button_example,
Clapper, HelloWorld, IrRanger, Logging,
Odom, pubsub, ServiceClient, ServiceServer,
ServoControl, Temperature, TimeTF,
Ultrasound, tests
?? ?? ?? ??.
Practical examples: IMU on RViz
https://youtu.be/wXN_7oRHst0
Practical examples: TurtleBot3 with OpenCR + rosserial
??? ??? ??? ?? ??
Practical examples: TurtleBot3 with OpenCR + rosserial
https://youtu.be/lkW4-dG2BCY
Let's get to know more
about ROSSERIAL!
- Protocol
- Limitations
- Future
Protocol of rosserial (http://wiki.ros.org/rosserial/Overview/Protocol)
Sync Flag
Sync Flag
/ Protocol
version
Message
Length
(N)
Message
Length
(N)
Checksum
over
message
length
Topic ID Topic ID
Serialized
Message
Data
Checksum
over Topic
ID and
Message
Data
1st Byte 2nd Byte 3rd Byte 4th Byte 5th Byte 6th Byte 7th Byte N Bytes Byte N+8
(Value: 0xFF) (Value: 0xFE) (Low Byte) (High Byte) (Low Byte) (High Byte)
Sync Flag oxFF
Sync Flag / Protocol version 0xFF on ROS Groovy, 0xFE on ROS Hydro, Indigo, Jade and Kinetic
Message Length (N) Message Length, 2 Byte = Low Byte + High Byte
Checksum over message length Checksum = 255 - ( (Message Length Low Byte + Message Length High Byte) %256)
Topic ID
2 Byte = Low Byte + High Byte
ID_PUBLISHER=0, ID_SUBSCRIBER=1, ID_SERVICE_SERVER=2, ID_SERVICE_CLIENT=4, ID_PARAMETER_REQUEST=6,
ID_LOG=7, ID_TIME=10, ID_TX_STOP=11
Serialized Message Data Message Data like IMU, TF, GPIO
Checksum over Topic ID and
Message Data
Checksum = 255 - ( (Topic ID Low Byte + Topic ID High Byte + data byte values) % 256)
Limitations of rosserial (http://wiki.ros.org/rosserial/Overview/Limitations)
1. Maximum Size of a Message, Maximum Number of Publishers/Subscribers
ros::NodeHandle_<HardwareType, MAX_PUBLISHERS=25, MAX_SUBSCRIBERS=25,
IN_BUFFER_SIZE=512, OUT_BUFFER_SIZE=512> nh;
: ?? ????? ???? ????? ??, ???????? ??, ????, ??
??? ???? ??? ?? ???? MCU? ???? ??.
2. Float64
: ????? ??? 64-bit float? 32-bit ?????? ????.
http://wiki.ros.org/rosserial/Overview/Limitations
Limitations of rosserial (http://wiki.ros.org/rosserial/Overview/Limitations)
3. Strings
: ??? ?? ??? String ??? "char *"? ????.
4. Arrays
: ??? ?? ??? ??? ???? ????.
5. Speed and bandwidth
: serial? ?????? ??? ??? ?? ??? ???? ??? ????.
http://wiki.ros.org/rosserial/Overview/Limitations
OpenCR's Challenge
- rosserial ??? ?? =8Bit ??? MCU / Serial (UART)
- OpenCR? 32Bit ??? MCU??? ?? ????? ???? ??? ? ???,
serial? ?? USB Stack ? Ethernet Stack ? ???? ??? ???? ?? ??
??? ??? ? ?? ??? ????.
- ? ??? ???? ?? OpenCR? ¡°Open-source Control module for ROS¡±??
??? ? ?? ???? ????.
OpenCR with OROCA
2016? ??? ????
OpenCR ???
@iMachine?, @BlueSky7?, @Baram?, @????
???????.
2017? ??? ????
OpenCR ?? ?????.
Open-source
Control module
for ROS

More Related Content

ROS SERIAL and OpenCR

  • 1. ROS SERIAL and OpenCR - OpenCR? ROS ??? ???? * ? ??? ??? ?? ????? ? ??? ??? ?? ??? ????? ??? ??????. / CC BY 4.0 ?5? ?? ???? ??? ? ? ?
  • 4. What is the Best Computing Resource for Your Robot? intel.com / st.com I¡¯m Robot!
  • 6. Intel NUC for Sensor and Communication
  • 7. Intel NUC for Sensor and Communication ARM Cortex-M for Motor control and Analog Sensors Small embedded systems are everywhere in ROBOT!
  • 8. Scope of computing resources : computation vs control Morgan Quigley (OSRF) "ROS 2 on ¡°small¡± embedded systems", ROSCon2015
  • 9. Communication between the computer and the microcontroller ????? ???? ROS ? 8051, AVR, ARM Cortex-M ?? MCU(Micro Controller Unit)?? ??? ??? ?? rosserial ??? ROS? ???? ???? ??. ROS ???? ????? ????? ?????? ???? ??? ??? ???? ???? ????? ???? ???? ??? ?????. ?, ??? ?? ??? ????? ??????? ????? ???? ??? ??? ???? ????? ????? ???. ???? ??? ??? ????? ??? ??? MCU ?? ???? ??? ??? ?? ????? rosserial? ????. ? ?????? ??? ????? ?? ??? ????&ROS ?? ????? ??, pubsub ??? ???? OpenCR ?? ????, ???????? rosserial? ???? ???? ?????? ????? ??? ??? ????? ??.
  • 10. Communication between the computer and the microcontroller
  • 11. rosserial for embedded system to control the hardware parts of ROBOT! rosserial ? ??? ??? ?? ?? ???? ??? ?? ???? ?????????? ??? ??? ?? ???? ROS? ?????. ? ? ?? (????????????)? ??? ?? ?? ?????? ????????? ?? ??? UART? ?? ??? ???? ???? ??? ?? ROS ?? ???? ROSTCP ?? ?? ??? ??? ??. ? ??? ??? rosserial? rosserial-server? ??????? ???(??? ???? Xbee, ???? ??? ????? ??)? ??? ? ????? ??? ??? ????.
  • 12. rosserial for embedded system to control the hardware parts of ROBOT! ????, ????????? ??? ???? ADC? ????? ?? ? ???? ???? ??, ???? rosserial-server ??? ??? ?? ??? ROS?? ???? ??(Topic)?? ???? ???? ??. ???, ROS ? ?? ???? ?? ?? ???? ???? ???? rosserial-server ??? ?? ???? ?????????? ???? ??? ??? ?? ???? ?? ???. SBC? ??? ?? ???? ??, ??? ??? ???? ?? ???? ??? ?? ???? ???? ????????? ???? ?? ???? ????? ??? ? ??? ?? ???? ??.
  • 13. OpenCR + ROSSERIAL ?? ????? ???? Ubuntu 16.04 LTS OS? ROS Kinetic ??? ???? ??? ?? ?? OpenCR + rosserial ? ???? ?? ????. F/W? Arduino IDE 1.6.12 ?? ????. http://cafe.naver.com/openrt/15345
  • 14. rosserial install ?? ???? rosserial? ???? ?? ?? ???? ????? ??. ? ???? ros-kinetic-rosserial-windows ros-kinetic-rosserial-xbee, ros-kinetic-rosserial-embeddedlinux ?? ??? ?? ??? ???? ????? ??. $ sudo apt-get install ros-kinetic-rosserial ros-kinetic-rosserial-server ros-kinetic-rosserial-arduino
  • 15. Build the ros libs for rosserial ???? ???? IDE ?? ????? ?????? ????? ??. ??? ?? ???? IDE? ????? ????? ??? ??? ? ?? ros_lib ? ?? ????(???? ros_lib? ??? ??? ????? ? ?? ??? ????? ??). ? ?, rosserial_arduino ???? make_libraries.py ??? ???? ros_lib? ????. $ cd ~/Arduino/libraries/ $ rm -rf ros_lib $ rosrun rosserial_arduino make_libraries.py .
  • 16. Build the ros libs for rosserial make_libraries.py ???? ?? Arduino IDE ?? ROS ?????? ????? ros.h? ?? ?? ?????? ??? ROS ??? ? catkin_ws ? ??? ??? ??? ????? ??? ???? ???? ?? ????. ?? ??? ???? IDE?? ???? ??? ? ??. ??? ?? ~/Arduino/libraries/ros_lib ??? ??? ???? ?????? ??. OpenCR? ??? ??? ?? ???? ??? ?? ??? ??? ?? ??? ??? ??. ~/Arduino/libraries/ros_lib/ArduinoHardware.h ? 59?? ??? ?? ??? ????. (???) #define SERIAL_CLASS HardwareSerial (???) #define SERIAL_CLASS USBSerial
  • 17. Communicating ROS messages between the computer and the OpenCR board ????? ???? OpenCR ???? ROS ??? ??? ???? ???. OpenCR ??? ???? USB??? ???? ??? ?? ???? IDE? ????. ? ?? ???? [File] > [Sketchbook] > [libraries] > [ros_lib] > [pubsub] ? ???? ??? ??? ???? OpenCR ??? ???? ??? ??. ?? 0.5? ??? "hello world!"?? string ??? ???? ????(publish)?? toggle_led ?? ?? ??? LED ?? ??? ???????(subscribe)?? ??????. ??? ?? ? ?? ??? ???? ?? ??? ?? ?? ??? ??? ??? ?? ??? ??? ???. $ arduino
  • 19. Example of rosserial: pubsub ?? ??? ?? roscore? ?? ?, ??? ?? ?????? rosserial_python???? serial_node.py? ????. $ roscore $ rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0
  • 20. Example of rosserial: pubsub ??? OpenCR ???? ?????? ?? ???? ?????. ??? ?? rostopic echo ???? "chatter" ?? ??? ???? ?????. 0.5? ??? ???? ?? ??? ??? ? ??. $ rostopic echo /chatter data: hello world! --- data: hello world! --- data: hello world!
  • 21. Example of rosserial: pubsub ??? ????? std_msgs/Empty ??? "toggle_led"?? ???? OpenCR ???? led ?? ??? ?????? OpenCR ????? ?? ????????? led ? on/off ??? ??? ??. ??? ???? ??? ?? OpenCR ??? led? ???? ?? ? ? ??. ?? ???? ??? led ? ???? ?? ?? ???? ??? ???. ? ??? ??(toggle) ??? ?? ??. $ rostopic pub -1 /toggle_led std_msgs/Empty "{}" publishing and latching message for 3.0 seconds $ rostopic pub -1 /toggle_led std_msgs/Empty "{}" publishing and latching message for 3.0 seconds
  • 22. Example of rosserial: pubsub ? ????? ??????? ??? ??? rqt_graph? ???? ??? ??. $ rqt_graph
  • 23. Example of rosserial: pubsub ??? ????? ??????? ?? ????? ???? ROS ?????? ?? ???? ????. ?? ?? ?? ? ??? OpenCR ?? ???????? ???? ? ???. ??, ??? ??? ?? ????(pubsub)? ????. #include <ros.h> #include <std_msgs/String.h> #include <std_msgs/Empty.h> ros::NodeHandle nh; void messageCb( const std_msgs::Empty& toggle_msg) { digitalWrite(13, HIGH-digitalRead(13)); // blink the led } ros::Subscriber<std_msgs::Empty> sub("toggle_led", messageCb ); std_msgs::String str_msg; ros::Publisher chatter("chatter", &str_msg); char hello[13] = "hello world!"; void setup() { pinMode(13, OUTPUT); nh.initNode(); nh.advertise(chatter); nh.subscribe(sub); } void loop() { str_msg.data = hello; chatter.publish( &str_msg ); nh.spinOnce(); delay(500); }
  • 24. ros_libs ?? ????(pubsub)???? ADC, Blink, BlinkM, button_example, Clapper, HelloWorld, IrRanger, Logging, Odom, pubsub, ServiceClient, ServiceServer, ServoControl, Temperature, TimeTF, Ultrasound, tests ?? ?? ?? ??.
  • 25. Practical examples: IMU on RViz https://youtu.be/wXN_7oRHst0
  • 26. Practical examples: TurtleBot3 with OpenCR + rosserial ??? ??? ??? ?? ??
  • 27. Practical examples: TurtleBot3 with OpenCR + rosserial https://youtu.be/lkW4-dG2BCY
  • 28. Let's get to know more about ROSSERIAL! - Protocol - Limitations - Future
  • 29. Protocol of rosserial (http://wiki.ros.org/rosserial/Overview/Protocol) Sync Flag Sync Flag / Protocol version Message Length (N) Message Length (N) Checksum over message length Topic ID Topic ID Serialized Message Data Checksum over Topic ID and Message Data 1st Byte 2nd Byte 3rd Byte 4th Byte 5th Byte 6th Byte 7th Byte N Bytes Byte N+8 (Value: 0xFF) (Value: 0xFE) (Low Byte) (High Byte) (Low Byte) (High Byte) Sync Flag oxFF Sync Flag / Protocol version 0xFF on ROS Groovy, 0xFE on ROS Hydro, Indigo, Jade and Kinetic Message Length (N) Message Length, 2 Byte = Low Byte + High Byte Checksum over message length Checksum = 255 - ( (Message Length Low Byte + Message Length High Byte) %256) Topic ID 2 Byte = Low Byte + High Byte ID_PUBLISHER=0, ID_SUBSCRIBER=1, ID_SERVICE_SERVER=2, ID_SERVICE_CLIENT=4, ID_PARAMETER_REQUEST=6, ID_LOG=7, ID_TIME=10, ID_TX_STOP=11 Serialized Message Data Message Data like IMU, TF, GPIO Checksum over Topic ID and Message Data Checksum = 255 - ( (Topic ID Low Byte + Topic ID High Byte + data byte values) % 256)
  • 30. Limitations of rosserial (http://wiki.ros.org/rosserial/Overview/Limitations) 1. Maximum Size of a Message, Maximum Number of Publishers/Subscribers ros::NodeHandle_<HardwareType, MAX_PUBLISHERS=25, MAX_SUBSCRIBERS=25, IN_BUFFER_SIZE=512, OUT_BUFFER_SIZE=512> nh; : ?? ????? ???? ????? ??, ???????? ??, ????, ?? ??? ???? ??? ?? ???? MCU? ???? ??. 2. Float64 : ????? ??? 64-bit float? 32-bit ?????? ????. http://wiki.ros.org/rosserial/Overview/Limitations
  • 31. Limitations of rosserial (http://wiki.ros.org/rosserial/Overview/Limitations) 3. Strings : ??? ?? ??? String ??? "char *"? ????. 4. Arrays : ??? ?? ??? ??? ???? ????. 5. Speed and bandwidth : serial? ?????? ??? ??? ?? ??? ???? ??? ????. http://wiki.ros.org/rosserial/Overview/Limitations
  • 32. OpenCR's Challenge - rosserial ??? ?? =8Bit ??? MCU / Serial (UART) - OpenCR? 32Bit ??? MCU??? ?? ????? ???? ??? ? ???, serial? ?? USB Stack ? Ethernet Stack ? ???? ??? ???? ?? ?? ??? ??? ? ?? ??? ????. - ? ??? ???? ?? OpenCR? ¡°Open-source Control module for ROS¡±?? ??? ? ?? ???? ????.
  • 33. OpenCR with OROCA 2016? ??? ???? OpenCR ??? @iMachine?, @BlueSky7?, @Baram?, @???? ???????. 2017? ??? ???? OpenCR ?? ?????.