PPR Meeting 122 ROSLab a High Level Programming
PPR Meeting 1/22 ROSLab: a High Level Programming Language for Robotic Applications Nicola Bezzo, Andrew King, Junkil Park, Radoslav Ivanov, Peter Gebhard, Insup Lee University of Pennsylvania Monday November 4 th 2013 Nov. 4 th 2013
PPR Meeting Outline 2/22 Outline u u Review of ROS Overview of ROSLab u How it works u Demonstration on Quadrotor and UGV Current and Future Work u Insect Robot Integration u Hardware Generation Conclusion Nov. 4 th 2013
PPR Meeting u u u ROS 3/22 Based in Menlo Park, California Hardware: PR 2, Texai, Turtlebot Software: ROS - 100 ROBOTS - 70 SENSORS/INTERFACES - 2000+ LIBRARIES u Code reusability http: //www. ros. org Nov. 4 th 2013
PPR Meeting ROS 4/22 What is ROS? u Meta-operating System/ Middleware for Robots IPC App - Message passing - IPC App ROS App - TCP/IP – UDP - C++, Python UBUNTU HARDWARE Nov. 4 th 2013
5/22 COMPUTER Operating System (Ubuntu 12. 04) ROS (Groovy) 2) Subscribe to GPS 2) Advertise to TWIST ROS Master 1) Subscribe to TWIST 1) Advertise to GPS 3) Host + Port 4) Topic Request GPS Node Controller Node Motor 5) Topic Stream ROS Drivers SENSORS ACTUATORS
PPR Meeting ROSLab 6/22 OBJECTIVE: 1) Development of a Simplified High-Level Programming Language for Robotic Applications. 2) Complete Robot Synthesis. HL code generation LL code generation Hardware description generation PRINTABLE QUADROTOR MICROCONTROLLER SYNTHESIS Nov. 4 th 2013
PPR Meeting Pseudo Code 1/3 7/22 ROS Pseudo Code - Example Headers #include <ros/ros. h> #include <messages/encoder. h> #include <messages/imu. h> #include <other messages> #include <cstdio> Declaration of variables float odom. Pose. X; int fl_enc; Callbacks void encoder. Callback(const messages: : encoder_msg: : Const. Ptr& enc_message) { } void imu. Callback(const messages: : imu_msg: : Const. Ptr& imu_message) { } Nov. 4 th 2013
PPR Meeting Pseudo Code 2/3 8/22 Main Program int main (int argc, char** argv) { ros: : init(argc, argv, “node_name”); ros: : Node. Handle node; ros: : Publisher vel_pub; vel_pub = node. advertise<geometry_msgs: : Twist>("/cmd_vel", 1); ros: : Subscriber enc_sub; enc_sub = node. subscribe("/encoder", 1, encoder. Callback); ros: : Subscriber imu_sub; imu_sub = node. subscribe("/imu", 1, imu. Callback); ros: : Rate r(50. 0); geometry_msgs: : Twist command; Nov. 4 th 2013
PPR Meeting Pseudo Code 3/3 9/22 while(ros: : ok()) { ros: : spin. Once(); create your own logic, e. g. : Cruise Control “if (measured velocity < 0. 5) { command. linear. x += 0. 005; } else if (measured velocity > 0. 5) { command. linear. x -= 0. 005; } else { }” vel_pub. publish(command); r. sleep(); } return 0; } Nov. 4 th 2013
PPR Meeting ROSLab 10/22 GUI based Programming Language CONTROLLER ACTUATORS ENCODER See next slide IMU Nov. 4 th 2013
PPR Meeting ROSLab 11/22 #include <messages/encoder. h> void encoder. Callback (const messages: : encoder_msg: : Const. Ptr& enc_message) { Encoder. Vel. C = “operation involving number of ticks read by encoder” } ros: : Subscriber enc_sub; enc_sub = node. subscribe ("/encoder_topic", 1, encoder. Callback); = ENCODER /encoder_topic Encoder. Vel. C Nov. 4 th 2013
PPR Meeting ROSLab 12/22 How does ROSLab generate code? u Written in Java Formal Code Generation to C++ / ROS u Template with “holes” u $includes$ $pub_ports$ $sub_port_values$ $sub_port_callbacks$ int main(int argc, char **argv) { //----MAIN ros: : init(argc, argv, $node name$); ros: : Node. Handle node; u Advertise Example $port_name$ = node. advertise<$port_type$> ("$port_topic$", 1); $pub_connections$ $sub_callback_setup$ ros: : Rate r(100); while(ros: : ok()) { //----WHILE ros: : spin. Once(); // ***** ADD YOUR CODE HERE ***** // ***************** r. sleep(); } // --- end while return EXIT_SUCCESS; } // --- end main port_name port_topic port_type Nov. 4 th 2013
PPR Meeting Demo 13/22 Demo - Quadrotor Nov. 4 th 2013
PPR Meeting Demo 14/22 Demo - UGV Nov. 4 th 2013
PPR Meeting Current Work 15/22 ROSLab on MIT Insect Robot ♦ Current Work on Insect Robot Joy node ♦ ♦ Insect Joy Insect node Insect treated like a black-box (controlled with joystick) Zig. Bee communication (main focus) Nov. 4 th 2013
ROSLab ROS NODE (e. g. , Quad_joy) TRPY LL-SW TRPY POSE ESTIMATE CONTROLLER PWM PWM M 1 M 2 M 3 M 4 Accel/Ang Vel RADIO μC IMU HW 16/22
ROSLab ROS NODE (e. g. , Quad_joy) TRPY LL-SW TRPY POSE ESTIMATE CONTROLLER PWM PWM M 1 M 2 M 3 M 4 Accel/Ang Vel RADIO μC μC IMU HW 17/22
PPR Meeting Future Work 18/22 Quadrotor HW Components MICROCONTROLLER HALF-BRIDGE FOR MOTORS RADIO IMU Nov. 4 th 2013
PPR Meeting Future Work 19/22 Peripheral Setup #define ZIGBEE_SPI 3 //Number, ex: 1 #define ZIGBEE_SCK_PORT A //Letter, ex: A #define ZIGBEE_SCK_PIN 1 //Number, ex: 1 #define ZIGBEE_SCK_AF 6 //Number, ex: 1 #define ZIGBEE_MISO_PORT A //Letter, ex: A #define ZIGBEE_MISO_PIN 2 //Number, ex: 1 #define ZIGBEE_MISO_AF 6 //Number, ex: 1 #define ZIGBEE_MOSI_PORT A //Letter, ex: A #define ZIGBEE_MOSI_PIN 3 //Number, ex: 1 #define ZIGBEE_MOSI_AF 6 //Number, ex: 1 #define ZIGBEE_SS_PORT A //Letter, ex: A #define ZIGBEE_SS_PIN 4 //Number, ex: 1 #define IMU_I 2 C 1 //Number, 1 or 2 #define IMU_SCL_PORT A //Letter, ex: A #define IMU_SCL_PIN 15 //Number, ex: 1 #define IMU_SDA_PORT A //Letter, ex: A #define IMU_SDA_PIN 14 //Number, ex: 1 Nov. 4 th 2013
PPR Meeting Future Work 20/22 Challenges u u u Limited number of ports in a microcontroller; Power Usage; Limited processing power: how to make sure everything can run with some timing guarantees? Hardware physical setup. For insect we would like to specify: - the number of legs and DOF; - sensors. For quad we would like to specify: - the number of propellers; - sensors. Nov. 4 th 2013
PPR Meeting Conclusions 21/22 Conclusions u u Why ROSLab - Simple; - Intuitive; - Fast; - Modular/Reusable Prove Properties - Time execution: e. g. , response time analysis - Information flow: e. g. , output depends only on inputs - Simulation tool: e. g. , power draw given HW setup Nov. 4 th 2013
PPR Meeting Questions 22/22 THANK YOU! Nov. 4 th 2013
- Slides: 22