2 minute read

For this week the focus was centered in the development of the tools system while I waited for the npm packages migration.

Fixing the formatting of the behavior tree xml

After separating the executable code into an xml and the python files, the next step was to finally fix the style of the xml. Here is an example of the changes:

Old Laser Bump & Go:

<?xml version="1.0" ?>
<Root name="Tree Root">
  
  
  <BehaviorTree>
    
    
    <ReactiveSequence name="ReactiveSequence">
      
      
      <ReactiveFallback name="ReactiveFallback">
        
        
        <Inverter name="Inverter">
          
          
          <CheckObstacle name="CheckObstacle" amplitude="20" obs_dist="1.0"/>
          
        
        </Inverter>
        
        
        <Turn name="Turn"/>
        
      
      </ReactiveFallback>
      
      
      <Forward name="Forward" speed="0.5"/>
      
    
    </ReactiveSequence>
    
  
  </BehaviorTree>
  
</Root>
<Code>
 Source code goes here ....
</Code>

New Laser Bump & Go:

<?xml version="1.0" ?>
<Root name="Tree Root">
  <BehaviorTree>
    <ReactiveSequence name="ReactiveSequence">
      <ReactiveFallback name="ReactiveFallback">
        <Inverter name="Inverter">
          <CheckObstacle name="CheckObstacle" amplitude="20" obs_dist="1.0"/>
        </Inverter>
        <Turn name="Turn"/>
      </ReactiveFallback>
      <Forward name="Forward" speed="0.5"/>
    </ReactiveSequence>
  </BehaviorTree>
</Root>

Now it looks much better and also improves readibility.

Finally moving the npm packages to the correct account

Another time wasting step that was needed to do during this week was to finally migrate the npm packages (jderobot-commsmanager and jderobot-ide-interface) to the jderobot account in npm. This took a week because the number of downloads of the interface package was higher than 300 (the limit permitted to delete a package) because of my testing. So after waiting until the number decreased, I could finally unpublished it and then wait 1 day for it to be reupload in the new account.

Finished work on the tools system

As instructed by the mentors I continued to refactor the tools system from the week before until they were polished. The final system is the following:

  • Entry in the universe database in Robotics Infrastructure for the tools, containing the name and the base config of the tool:
COPY public.tools (name, base_config) FROM stdin;
console        None
simulator      None
web_gui        None
state_monitor  None
\.
  • In Robotics Academy this tools are assigned to each exercise using a database table for a many to many field called exercise:
COPY public.exercises_tools (id, exercise_id, tool_id) FROM stdin;
1  1  console
2  1  simulator
3  1  web_gui
  • In BT Studio, this will be stated in a config file inside each project named config.json.

  • A new model will be added for the tools in order to comply with Django:

class Tool(models.Model):
    name = models.CharField(max_length=50, blank=False, unique=True, primary_key=True)
    base_config = models.CharField(max_length=200, blank=False)

    def __str__(self):
        return str(self.name)

    class Meta:
        db_table = '"tools"'
  • The old field in the worlds table, visualization_config_path, has been renamed to tools_config and now contains and stringified json with the tools configuration. Also the old field visualization has been removed.

  • Now the RAM stores the world type in order to remove the tools: gazebo and gzsim, and only handle them as simulator VNC and use the RAM to determine which of the tools is.

  • As we have two different sets of configs for the tools, we combined them in the CommsManager, giving priority to the config coming from the universe over the base one.

Github Pull Request

Repositories in use