Scarrion-tfg

From jderobot
Jump to: navigation, search

Project Card[edit]

Project Name: Scratch4Robots tool

Author: Santiago Carrión [carrionvs@gmail.com]

Academic Year: 2017/2018

Degree: Degree in Telematics Engineering

GitHub Repositories: TFG-Santiago-Carrion Scratch4Robots

Tags: Scratch, Python, ROS


new version of ROS package with this changes

Development second iteration[edit]

Week 26[edit]

Week 27[edit]

  • TUM firts test, available, easy implementation. Done POC of takeoff, easy move and landing with TUM.
  • Problems: old tool, and bad maintenance.

Week 28[edit]

  • Learning MAVROS, MAVLINK
  • Search models and worlds in gazebo of drones that works correctly with MAVROS
  • Solutions: PX4

Week 29-30-31[edit]

  • Drones Full integration with ROS

Integration second iteration[edit]

week 19-20-21[edit]

prepare upload to official repositories of ROS

  • creation or release-scratch4robots Scratch4Robots-release
  • creation of documents and adaptation of the code of the tool

problems: When going through the official JENKINS machine of ROS, the compilation of the proyect fail

Solution: Direct communication with the develpment support team of ROS, They indicate to us to do a few changes in code, and after apply this changes the compilation is generated successfully

week 22[edit]

Study of how modules works in Python, and possibilities of installation through official repositories python-modules

Solutions: Looks like pip is the easiest and best choice

week 23[edit]

How pip works? pip-basics packaging-with-pip

POC of the first pip package

Refactorization and creation of pip packages with the dependencies of kurt, config, jderobottypes, and necessary modules

week 24[edit]

Change in all installation guides to support the new pip packages

videos of new installation

week 25[edit]

Integration First iteration[edit]

In addition to the integration of the tooling in JdeRobot two new insulated lines of the tool are developed. These versions will help make it easier for the user to use the tool, not depending on the installation of the complete Jderobot environment

Dependecies[edit]

week 13[edit]

First study of dependencies of the tool, obtaining the following dependencies.

Solved problems: study how to outsource those dependencies of Jderobot, and integrate them in our standalone version

JdeRobot Dependencies

  • comm
  • config
  • JdeRobotTypes

External Dependencies:

  • kurt

week 14[edit]

The dependencies are introduced into the project, relating the necessary refactoring for its coorect working. NOW OUR TOOL IS A STANDALONE TOOL.

  • Problems: very heavy and messy package for the end user, with little felixibility
  • Solutions: study ways to package or disaggregate these dependencies, Important check how to introduce third party dependencies as Kurt

POC ROS standalone version[edit]

Learning basics of ROS

Week 15[edit]

Week 16[edit]

  • POC subscriber / publisher with Python rospy-basics : created simple node that publish and suscribe to the motors of a Turtlebot.

Week 17[edit]

Proof of concept

Created a proof of concept of a ros package that executes by roslaunch the translation script receiving the name of the file to be translated as argument

 ~$ roslaunch scratch4robots scratch2python.launch file:=test_robot_blocks_2.sb2

Functional example of the ROS package

Quick guide to launch a test of the tool on a robot

  • robots and purely ROS:
  • drones working with Ice communicators:

week 18[edit]

  • AppImage

The possibility of creating an appimage for the easy installation is studied

What is appImage?

AppImage doc: AppImage official page

How to create an AppImage

Guide of creation: Creating-AppImages

tool of creation: build.opensuse.org

Development First iteration[edit]

week 9 and 10[edit]

  1. Objetive: Add compatibility with lists

We add the following funcionalities:

  • length of list
  • Inster item in position
  • get item stored in position
  • add item at the beginning of list
  • delet item stored in position
   ...
   ['length of {}', 'len({l[0]})'],
   ['insert {} at {} of {}', '{l[2]}.insert({l[1]}, {l[0]})'],
   ['item {} of {}', '{l[1]}[0][{l[0]}]'],
   ['add {} to {}', '{l[1]}.append({l[0]})'],
   ['delete {} of {}', '{l[1]}.pop({l[0]})'],
   ...
  • Problems: There is no list initialization block, so we have to find a way for our translator to detect that lists are being used and generate de python code that start it automatically.
  • Solutions: By modifying the translation script and adding several new features we are able to make the code compatible with the lists already integrated in scratch.

In scratch the list is not started explicitly, so our script is able to recognize when one of the blocks of lists is used and create the necessary variable for the lists that we are going to use, We also add new logic to the translator to make more efficient recusive translations.

week 11[edit]

  1. Objetive:Grouping in a single block of color detection AND validate his correct working

currently we have three blocks, one with each variable returned, this way we return a list with the three variables.

  1. Grouping in a single block of pose 3d AND validate his correct working

week 12[edit]

  1. Modify movement blocks to receive a velocity vector as an argument
  2. Add mathematical blocks included in scratch
  3. Modify all the examples and tests created to work on the new blocks

summary[edit]

At first we used a single block to return a single variable, which was very inefficient, we needed several blocks to handle variables that were generated by the same code. With the help of the lists we are able to return a list containing all the generated variables.

Week 8[edit]

Solving the problem of last week we created the template in which the translated Scratch code is embedded, This being the only outpu python node:

   #!/usr/bin/env python\n\
   # -*- coding: utf-8 -*-\n\n\
   import time\n\
   import config\n\
   import sys\n\
   import os\n\
   import yaml\n\
   import math\n\n\
   from drone import Drone\n\
   from robot import Robot\n\n\
   def execute(robot):\n\
   \ttry:\n\
   \t%s\  # SCRATCH CODE IS HERE
   except KeyboardInterrupt:\n\
   \t\traise\n\n\
   if __name__ == '__main__':\n\
   \tif len(sys.argv) == 2:\n\
   \t\tpath = os.getcwd()\n\
   \t\topen_path = path+'/'\n\
   \t\tfilename = sys.argv[1]\n\n\
   \telse:\n\
   \t\tsys.exit(\"ERROR: Example:python my_generated_script.py cfgfile.yml\")\n\n\
   \t# loading parameters\n\
   \tif os.path.isabs(filename):\n\
   \t\tstream = open(filename, \"r\")\n\
   \t\tcfg = config.load(filename)\n\
   \telse:\n\
   \t\tstream = open(open_path + filename, \"r\")\n\
   \t\tcfg = config.load(open_path + filename)\n\
   \tyml_file = yaml.load(stream)\n\n\
   \tfor section in yml_file:\n\
   \t\tif section == 'drone':\n\
   \t\t\t#TODO\n\
   \t\t\trobot = Drone(cfg)\n\n\
   \t\t\tbreak\n\
   \t\telif section == 'robot':\n\
   \t\t\trobot = Robot(cfg)\n\n\
   \t\t\tbreak\n\
   \t# executing the scratch program\n\
   \texecute(robot)\n\n\
   "

Week 7[edit]

Tasks:

Number Task Comments
1 Change the tool execution steps
  • Instead of current two steps ((a) scratch to python and (b) merging with drone or turtlebot connections). The output node should read its configuration from an YML file at runtime.

Week 6[edit]

Tasks:

Number Task Comments
1 Document Scratch2Jderobot on the wiki
1 Try to group perceptual blocks in one
  • Problems when the block to be translated is recursively analyzed



Week 5[edit]

Tasks:

Number Task Comments
1 Make the tool functional with drones
  • Created new file drone.yml
  • Changes to make it compatible with the comm library
2 New perceptive block of odometry
  • Try to work with tuples
3 Complete simulation of the cat and mouse using scratch2jderobot

Fixes:

In order to make the example of the cat and the mouse I had to change the blocks referring to the movement of the drone.

First of all I had to add the functionality that allowed vertical movement (up and down).

Once this functionality was added I had to make some adjustments to be able to send several speeds at once, allowing the drone to make diagonal or circular movements and not only in one direction.

Week 4[edit]

Tasks:

Number Task Comments
1 Create new Block
  • block move_meters: the robot moves the indicated meters, we use odometry(Pose3d) to calculate the distance traveled
2 Create new perceptive block
  • That block is split in three diferents blocks:
    • get_size : that block return the size of the object detect
    • get_x_position: return the x coordinate of the object's centre
    • get_y_position: return the y coordinate of the object's centre
  • Actually only can detect red color by default


Creating a new block[edit]

  • Add block code to scratch2robot.s2e
   ["", "move robot %m.robotDirections meters %n", "robot/move/meters", "forward", 1],
   ["r", "size of object", "camera/size"],
   ["r", "x position of object", "camera/x_pos"],
   ["r", "y position of object", "camera/y_pos"],
  • Add block code to scratch2python.py
   ['move robot {} meters {}', 'robot.move_meters("%s", %s)'],
   ['size of object', 'robot.get_size_object()'],
   ['x position of object', 'robot.get_x_position()'],
   ['y position of object', 'robot.get_y_position()'],
  • Add block code to robot.py or drone.py
   def move_meters(self,direction, meters=None)
      //code    
   def get_size_object(self):
       //code
       return size
   def get_x_postion(self):
       //code
       return x_position
   def get_y_position(self):
       //code
       return y_position
  • Add block code to kurt extension in commands_src_extras.py
   [' ', 'move robot %m.robotDirections meters %n', 'Scratch2JdeRobot/robot/move/meters', 'forward', 1],
   ['r', 'size of object', 'Scratch2JdeRobot/camera/size'],
   ['r', 'x position of object', 'Scratch2JdeRobot/camera/x_pos'],
   ['r', 'y position of object', 'Scratch2JdeRobot/camera/y_pos'],

Week 3[edit]

Tasks:

Number Task Comments
1 Install JdeRobot 5.6.0
  • problems to run scratch2jderobot properly due to a dependenci problem with changes in jderobotComm library
2 Run scratch2jderobot in JdeRobot 5.6.0
  • After fix the issues only the turtlebot run properly
3 Understand changes in library jderobotcomm now called Comm

Week 2[edit]

Tasks:

Number Task Comments
1 Study how scratch2jderobot tool works
  • simplifying:
    • scratch2python.py does de conversion from scratch to python using kurt library
    • main_robot.py or main_drone.py creates the necessary objects for a correct communication with the robot and initiates the execution
2 Study how jderobotComm library works
  • simplifying:
    • Uses ICE or ROS as necessary without having to specify it in the code

Week 1[edit]

Tasks:

Number Task Comments
1 Install JdeRobot


2 Install Scratch 2.0


3 Test scracth2jderobot tool with drone and turtlebot