220 likes | 236 Views
This presentation explores ROSLab, a high-level programming language for robotic applications, including an overview, demonstration, current and future work, and hardware integration.
E N D
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 4th 2013 Nov. 4th 2013
PPR Meeting Outline 2/22 Outline • Review of ROS • Overview of ROSLab • How it works • Demonstration on Quadrotor and UGV • Current and Future Work • Insect Robot Integration • Hardware Generation • Conclusion Nov. 4th 2013
PPR Meeting ROS 3/22 • Based in Menlo Park, California • Hardware: PR2, Texai, Turtlebot • Software: ROS • Code reusability • 100 ROBOTS • 70 SENSORS/INTERFACES • 2000+ LIBRARIES http://www.ros.org Nov. 4th 2013
PPR Meeting ROS 4/22 What is ROS? • Meta-operating System/ Middleware for Robots IPC App App • Message passing • IPC • TCP/IP – UDP • C++, Python ROS App App UBUNTU HARDWARE Nov. 4th 2013
5/22 COMPUTER Operating System (Ubuntu 12.04) ROS (Groovy) 1) Subscribe to TWIST 2) Subscribe to GPS ROS Master 1) Advertise to GPS 2) Advertise to TWIST 3) Host + Port 4) Topic Request GPS Node Controller Node Motor 5) Topic Stream ROS Drivers ACTUATORS SENSORS
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. 4th 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 • floatodomPoseX; • intfl_enc; • Callbacks • void encoderCallback(const messages::encoder_msg::ConstPtr& enc_message) • { • } • void imuCallback(const messages::imu_msg::ConstPtr& imu_message) • { • } Nov. 4th 2013
PPR Meeting Pseudo Code 2/3 8/22 Main Program int main (int argc, char** argv) { ros::init(argc, argv, “node_name”); ros::NodeHandle 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, encoderCallback); ros::Subscriber imu_sub; imu_sub = node.subscribe("/imu", 1, imuCallback); ros::Rate r(50.0); geometry_msgs::Twist command; Nov. 4th 2013
PPR Meeting Pseudo Code 3/3 9/22 while(ros::ok()) { ros::spinOnce(); 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. 4th 2013
PPR Meeting ROSLab 10/22 GUI based Programming Language CONTROLLER ACTUATORS ENCODER IMU See next slide Nov. 4th 2013
PPR Meeting ROSLab 11/22 #include <messages/encoder.h> void encoderCallback (const messages::encoder_msg::ConstPtr& enc_message) { EncoderVelC = “operation involving number of ticks read by encoder” } ros::Subscriber enc_sub; enc_sub = node.subscribe ("/encoder_topic", 1, encoderCallback); = ENCODER /encoder_topic EncoderVelC Nov. 4th 2013
PPR Meeting ROSLab 12/22 How does ROSLab generate code? • Written in Java • Formal Code Generation to C++ / ROS • Template with “holes” • $includes$ • $pub_ports$ • $sub_port_values$ • $sub_port_callbacks$ • int main(int argc, char **argv) { //----MAIN • ros::init(argc, argv, $node name$); • ros::NodeHandle node; • $pub_connections$ • $sub_callback_setup$ • ros::Rate r(100); • while(ros::ok()) { //----WHILE • ros::spinOnce(); • // ***** ADD YOUR CODE HERE ***** • // ********************************* • r.sleep(); • } // --- end while • return EXIT_SUCCESS; • } // --- end main • Advertise Example • $port_name$ = node.advertise<$port_type$> ("$port_topic$", 1); port_name port_topic port_type Nov. 4th 2013
PPR Meeting Demo 13/22 Demo - Quadrotor Nov. 4th 2013
PPR Meeting Demo 14/22 Demo - UGV Nov. 4th 2013
PPR Meeting Current Work 15/22 ROSLab on MIT Insect Robot • Current Work on Insect Robot • Insect treated like a black-box (controlled with joystick) • ZigBee communication (main focus) Insect Joy Insect node Joy node Nov. 4th 2013
ROSLab ROS NODE (e.g., Quad_joy) 16/22 TRPY LL-SW CONTROLLER TRPY POSE ESTIMATE PWM PWM PWM PWM Accel/AngVel M2 M1 M3 M4 RADIO μC IMU HW
ROSLab ROS NODE (e.g., Quad_joy) 17/22 TRPY LL-SW CONTROLLER TRPY POSE ESTIMATE PWM PWM PWM PWM Accel/AngVel M2 M1 M3 M4 RADIO μC μC IMU HW
PPR Meeting Future Work 18/22 Quadrotor HW Components RADIO MICROCONTROLLER IMU HALF-BRIDGE FOR MOTORS Nov. 4th 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_I2C 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. 4th 2013
PPR Meeting Future Work 20/22 Challenges • 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. 4th 2013
PPR Meeting Conclusions 21/22 Conclusions • 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. 4th 2013
PPR Meeting Questions 22/22 THANK YOU! Nov. 4th 2013