GithubHelp home page GithubHelp logo

skiros2's People

Contributors

bjarne-riact avatar emmanuelkring avatar frvd avatar matthias-mayr avatar robberthofmanfm avatar simonklind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

skiros2's Issues

reuse parameter values across skills

In one Skill I update a parameter which I want to use in the "next skill".

This is getspeed that outputs forwardspeed and rotationspeed. It works great when used in the SkillManager, but it gives me always "forward speed: 0.0" (upon self.success) if used in a serialstar (while it is not 0.0, as tested standalone).

How can I get updated parameters from one skill to another?

`
class GetSpeed(SkillDescription):
def createDescription(self):
self.addParam("Distance", 0.0, ParamTypes.Required)
self.addParam("Angle", 0.0, ParamTypes.Required)
self.addParam("Duration", 1.0, ParamTypes.Required)
self.addParam("ForwardSpeed", 1.0, ParamTypes.Inferred)
self.addParam("RotationSpeed", 1.0, ParamTypes.Inferred)
class getspeed(PrimitiveBase):
def createDescription(self):
self.setDescription(GetSpeed(), self.class.name)

def execute(self):
    t = self.params["Duration"].value
    self.params["ForwardSpeed"].value = self.params["Distance"].value / t
    self.params["RotationSpeed"].value = self.params["Angle"].value / t
    return self.success("forward speed:" + str(self.params["ForwardSpeed"].value))

def onEnd(self):
    return True

`

while not working when used in :
`
class MoveDistance(SkillDescription):
def createDescription(self):
self.addParam("Turtle", Element("cora:Robot"), ParamTypes.Required)
self.addParam("Distance", 0.0, ParamTypes.Required)
self.addParam("Angle", 0.0, ParamTypes.Required)
self.addParam("Duration", 1.0, ParamTypes.Required)
self.addParam("ForwardSpeed", 0.0, ParamTypes.Optional)
self.addParam("RotationSpeed", 0.0, ParamTypes.Optional)

class movedistance(SkillBase):
def createDescription(self):
self.setDescription(MoveDistance(), self.class.name)

def expand(self, skill):
    skill.setProcessor(SerialStar()) 
    uid = id(self)
    skill(
        self.skill("GetSpeed", "getspeed"),
        self.skill("Move2", "move2")    <-- this one has ForwardSpeed as inputparameter (!)
   }

`

SkillManagerNode startup needs to turn on and off spinning

Currently the SkillManagerNode that brings up the skill manager needs spinning during the __init__ function to register the skills with the world model:

# Note: The WMI must spin to set up the skill manager. During operation, the SM-node does the spinning
self._wmi = wmi.WorldModelInterface(node, agent_name, make_cache=True, allow_spinning=True)

However after we're done starting up the SkillManagerNode, we enter a rclpy.spin. This means that the WorldModelInterface that is used inside the SkillManager must not spin anymore.

def run(self):
# Note: The WMI must spin initially to set up the skill manager. During operation, the SM-node does the spinning
self.sm._wmi._allow_spinning = False
rclpy.spin(self)

Currently this is resolved by setting an allow_spinning variable in the WorldModelInterface that is used here:

def _call(self, service, msg):
future = service.call_async(msg)
if self._allow_spinning:
log.info("Service call to {} with spining".format(service.srv_name))
rclpy.spin_until_future_complete(self._node, future, timeout_sec=1.)
while not future.done():
log.warn("[{}]".format(self.__class__.__name__), "Waiting for reply from service {} ...".format(service.srv_name))
rclpy.spin_until_future_complete(self._node, future, timeout_sec=1.)
else:
while rclpy.ok() and not future.done():
pass
return future.result()

That works, but it's not a very sound solution.

Re-evaluation of inferred parameters when looping over skills

Hi,

I created a skill that makes a robot pick parts from a container. In the world model, part instances are associated to a container instance through the following relations:

Scene-0 hasA Container-175
Container-175 contain Part-184
Container-175 contain Part-186
Container-175 contain Part-188
Container-175 contain ...

I created a skill description where I specify a robot and a container, and I let SkiROS automatically parametrize the Part parameter by imposing a precondition. This way, the skill chooses one of the parts in the container to pick:

class PickPart(SkillDescription):
        def CreateDescription(self):
                 #=======Params==
                 self.addParam('Robot', Element('cora:Robot'), ParamTypes.Required)
                 self.addParam('Container', Element('skiros:Container'), ParamTypes.Required)
                 self.addParam('Part', Element('skiros:Part'), ParamTypes.Inferred)

                 #=======PreConditions==
                 self.addPreCondition(self.getRelationCond('InferPart', 'skiros:contain', 'Container', 'Part', True))

During skill execution, the relation of the Part with the Container is broken once the robot picks the part from the container. This way, each time we launch the skill, another part instance is found when the parameter Part is autoparametrized through the preconditions. By launching the skill several times, the robot unloads the container.

However, we want the iterative behaviour to be automatic, i.e. instead of manually launching the picking skill several times in a row, it should automatically start looping the skill until there are no more Part instances linked to the Container.
Let's try to follow my way of reasoning:

  • I tried to include some kind of looping in the skill() statement in the skill's expand(self, skill) method, but that didn't work out.
  • I thought it might be a good solution to create a dedicated skill processor here, so I created a new processor Repeating() which is basically the same as SerialStar(), but it restarts the sequence of children if they all succeeded.
  • When SkiROS fails to automatically parametrize a parameter, it returns a status called Status.Idle. So, since I want to loop over the skill as long as the preconditions can render a suitable parametrization, I implemented the Repeating() processor such that it exits once the skill I want to loop returns Status.Idle. This way, I have a processor that keeps on executing the same skill as long as a parametrization can be obtained.

In short, I have now something like this:

class unload_container(SkillBase): 
        def expand(self, skill):
                skill.setProcessor(Repeating())
                skill(
                       self.skill('PickPart', 'pick_part', specify={'Robot': robot, 'Container': container})
                 )

The skill PickPart is now executed, and SkiROS autoparametrized a suitable Part instance that has the desired relation to the Container. Also, after successful execution, the Repeating() processor tries to restart the skill PickPart again.
However, The skill returns Status.Idle the second time, and I receive the message that the relation for the given Part instance is not met. Here, the message mentions the Part instance that has been autoparametrized in the previous iteration.
Actually, I want that the skill re-evaluates its pre-conditions each time the skill is triggered, and that the parameters are updated accordingly.

Since the first iteration always involves a suitable autoparametrization, and since I can entirely unload the container by manually pressing the playbutton several times, I definitely think it should be possible somehow, although I don't manage to find the right way to do it.
Thus far, I have been attracted to

Could you please point me in the right direction?

Regards,
Toon Daemen
Robotics engineer at Flanders Make, Belgium

Named individual not added to "the map"

Hello people. What is "the map"?
I altered the turtles example and added in the owl-file a named individual turtlebot.owl#planonce with class Sumo:Agent.
First of all, all the named individuals I defined are not added to the world model, but the robot turtle_robot is used in the world model (!)
But once I started the skillmanager I was able to add the namedindivudal under Scene:0 and use it.
However, when I use this as a parameter defined in a skill I get:
"error: Param turtlebot:Once is not in the map. Debug: Turtle: cora:Robot-1-turtlebot:turtle_robot Robot: sumo:Agent- DoOnce: sumo:Object-35-planonce ".

So probably I need to add it to a map, it is already in the world model, what more do I need to do to be able to use additional namedindividuals????

Appending Element() properties fails

in world_element.py there's a function appendProperty I wrote some unit tests for

    def appendProperty(self, key, value):
        """
        @brief Append a value to the property. If property doesn't exist it is created.
        >>> e = Element()
        >>> e.setProperty("Integer", 2, "xsd:int")
        >>> e.getProperty("Integer").value
        2
        >>> e.appendProperty("Integer", 3)
        >>> e.getProperty("Integer")
        [2, 3]
        """
        self._setLastUpdate()
        if self.hasProperty(key):
            self._properties[key].append(value)
        else:
            self.setProperty(key, value, is_list=True)

this one fails with AttributeError: 'Property' object has no attribute 'append'

Task planner unsupported operand type(s) for +: 'NoneType' and 'string'

When I try to launch the task planner example with
roslaunch skiros2_examples planning_example.launch and I run "task_plan"
skill from skiros GUI with a Goal in PDDL format.
skiros:contain skiros:LargeBox-80 skiros:Starter-145

I get the following error message
Task planner unsupported operand type(s) for +: 'NoneType' and 'string'
in the skiros GUI.

Any idea why this happens? I installed the Fast Downward planner using the script in skiros2/skiros2/scripts before running.

Kind regards

Problem with inferred parameters

Hi,

I experience the following problem when I want to use parameters of the type inferred:

Consider two skills that implement the functionality to respectively pick a part from a container, and place a part in a container. Both skills have a very similar SkillDescription:

class PickSkill(SkillDescription):
    def createDescription(self):
        #=======Params=========
        self.addParam("Container", Element("skiros:Container") , ParamTypes.Required)
        self.addParam("Part", Element("skiros:Part") , ParamTypes.Inferred)

        #=======PreConditions=========
        self.addPreCondition(self.getPropCond("PartPresent", "hasObject", "Part", "=", True, True))
        self.addPreCondition(self.getRelationCond("InferPart", "skiros:contain", "Container", "Part", True))

        #=======PostConditions=========
        self.addPostCondition(self.getPropCond("PartPresent", "hasObject", "Part", "=", False, True))
class PlaceSkill(SkillDescription):
    def createDescription(self):
        #=======Params=========
        self.addParam("Container", Element("skiros:Container") , ParamTypes.Required)
        self.addParam("Part", Element("skiros:Part") , ParamTypes.Inferred)

        #=======PreConditions=========
        self.addPreCondition(self.getPropCond("PartPresent", "hasObject", "Part", "=", False, True))
        self.addPreCondition(self.getRelationCond("InferPart", "skiros:contain", "Container", "Part", True))

        #=======PostConditions=========
        self.addPostCondition(self.getPropCond("PartPresent", "hasObject", "Part", "=", True, True))

The skills expect the container where we want to pick or place a part to be specified, and will infer the Part instance from the world model through the pre-condition labeled "InferPart": It will look which Part instance is related to the given Container instance through the predicate 'skiros:contain'. The Part instance here is actually a placeholder for a part, and the actual presence of a part is indicated by a parameter 'hasObject', that is being checked by the condition labeled "PartPresent".

This works as expected, If I run the pick skill or place skill, the right Part instance is inferred, and the skill only executes when the condition labeled 'PartPresent' is fulfilled.

however, it fails when I make a pick-and-place skill, which sequences the pick skill and place skill respectively:

skill(
         self.skill('PickSkill', 'pick_skill', specify={Container: container_pick}),
         self.skill('PlaceSkill', 'place_skill', specify={Container: container_place})
)

What happens now is that SkiROS fails to infer the part that is related to the container where we want to place the part, because it tries to find a relation between the container we specify for placing, and the part that was previously inferred in the picking skill. I suspect that it somehow is caused by world model elements that are listed on the Blackboard, because:

  • If I print the contents of the blackboard between execution of the pick skill and the place skill, I see the elements that I inferred in the pick skill.
  • If I choose an unique name for all parameters of the type inferred, across all SkillDescriptions (i.e. explicitly using PartPick and PartPlace instead of reusing the label Part), Inference is done like expected.

When I add parameters, I tried to specify parameter options, like Consume or Unspecify. According to the source code these options should result in the world model elements being removed from the blackboard after skill execution.

self.addParam("Part", Element("skiros:Part") , ParamTypes.Inferred, [ParamOptions.Unspecify])

However, I notice that it does not work when two skills are sequenced...

Could you please provide me some information on how I should address my issue?
I also would be happy if you could provide me some good examples on inference and resolving from the world model, as these are really powerful features.

Regards,

Toon Daemen
Robotics Researcher at Flanders Make, Belgium

Multiple robots = multiple skill managers?

Hi there,

I have a setup with multiple robots, and want to separate the skills for each of them.

On the wiki, I read sentences wherein the skill manager node is referenced in singular, and in the architecture there seems to be only one skill manager node.

At deployment time the skill manager node loads the desired skills [...].

However, when building the launch file for my application, I encounter an argument for the skill manager node, robot_name, singular.
<arg name="robot_name" value="$(arg robot_name)"/>
This makes me believe each robot should have its own skill manager node.

When I make two of these <include> blocks in the launch file, with a different libraries_list, skill_list and robot_name, two skill manager nodes are indeed started and two separate xterms pop up, all skills are loaded fine, the rostopics come up for each of them and everything seems in perfect harmony.

However, as soon as I execute some of those skills from the GUI, it fails (No plugin with name ... found), because all skills execute on the skill manager node that loaded first, the second skill manager never does anything.

How should I do this? Should I make two skill manager nodes, or is there a way to tell the skill manager node that I have two separate robots? What should I put for robot_name then?

Best regards,
Robbert

Interactive Marker in RViz2 throws log messages until a world model element is selected

SkiROS2 has an interactive marker server that allows to manipulate the pose of a world model element directly in RViz.

When having the marker activated in RViz2 it prints a lot of log messages until a first world model element is selected in the world model.
Possibly this could be resolved in "our" server side. The current situation means that we can not really have RViz configurations that have the marker enabled.

GUI crashing when adding properties

How to reproduce:
Run any example you like that uses the GUI. Click on the plus to add an object to the scene. As type choose Location, as subtype choose TransformationPose and as individual choose new TransformationPose. This should give the following output:

SkirosWidget Create element based on skiros:TransformationPose
[get_individual] error: Ignoring skiros:TransformationPose-rdfs:subClassOf-skiros:Location. Predicate is not defined in the ontology.
SkirosWidget Added element owl:Class-33-TransformationPose to skiros:Scene-0

Now select the object and add a property like PositionX. The GUI then crashes and the following error message is printed:

setValues error: skiros:PositionX: Input <type 'unicode'> != <type 'float'>. Debug: skiros:PositionX:[]
Service call failed: service [/wm/modify] responded with an error: error processing request: list index out of range
Traceback (most recent call last):
File "/home/emmanuel/rvmi_ws/src/libs/skiros2/skiros2/skiros2_gui/src/skiros2_gui/core/skiros_widget.py", line 681, in on_add_property_button_clicked
self._wmi.update_element_properties(elem)
File "/home/emmanuel/rvmi_ws/src/libs/skiros2/skiros2/skiros2_world_model/src/skiros2_world_model/ros/world_model_interface.py", line 230, in update_element_properties
res = self._call(self._modify, msg)
File "/home/emmanuel/rvmi_ws/src/libs/skiros2/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_interface.py", line 305, in _call
raise WmException("Service call failed: %s" % e)
skiros2_world_model.core.world_model_abstract_interface.WmException: Service call failed: service [/wm/modify] responded with an error: error processing request: list index out of range
[skiros_gui-3] process has died [pid 22690, exit code -6, cmd /opt/ros/melodic/lib/rqt_gui/rqt_gui -s gui.skiros __name:=skiros_gui __log:=/home/emmanuel/.ros/log/44ef3bea-8985-11ea-be3b-a86daad6e8db/skiros_gui-3.log].
log file: /home/emmanuel/.ros/log/44ef3bea-8985-11ea-be3b-a86daad6e8db/skiros_gui-3*.log

GUI: crash when saving scene to new folder

How to reproduce:
Launch turtlesim_example.The default path to save a scene should be scenes/simulation.turtle. Click save scene. The gui should then crash if the scenes folder does not exist in skiros2_test_lib/owl.

Pip installation of rdflib leads to crash

When installing rdflib using, e.g.: pip install --user rdflib (installing the following: isodate-0.6.0 pyparsing-2.4.7 rdflib-5.0.0 six-1.14.0) on ubuntu 18.04 leads to the following:

[ERROR] [1588781225.330220]: Error processing request: cannot import name parser
['Traceback (most recent call last):\n', ' File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/francesco/ros_ws/rvmi_ws/src/libs/skiros2/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_server.py", line 44, in _wo_query_cb\n for s in self._ontology.query(msg.query_string, context_id=msg.context):\n', ' File "/home/francesco/.local/lib/python2.7/site-packages/wrapt/decorators.py", line 502, in _synchronized_wrapper\n return wrapped(*args, **kwargs)\n', ' File "/home/francesco/ros_ws/rvmi_ws/src/libs/skiros2/skiros2/skiros2_world_model/src/skiros2_world_model/core/ontology_rdflib.py", line 138, in query\n return self.ontology(context_id).query(query)\n', ' File "/home/francesco/.local/lib/python2.7/site-packages/rdflib/graph.py", line 1127, in query\n result = plugin.get(result, query.Result)\n', ' File "/home/francesco/.local/lib/python2.7/site-packages/rdflib/plugin.py", line 107, in get\n return p.getClass()\n', ' File "/home/francesco/.local/lib/python2.7/site-packages/rdflib/plugin.py", line 69, in getClass\n module = import(self.module_path, globals(), locals(), [""])\n', ' File "/home/francesco/.local/lib/python2.7/site-packages/rdflib/plugins/sparql/init.py", line 33, in \n from . import parser\n', 'ImportError: cannot import name parser\n']

Python dependencies "wrapt" and "inflection" in 22.04 ROS 2

In ROS 1 we installed wrapt and inflection as pip packages with requirements.txt.
In ROS 2 Humble on 22.04 we used the system packages so far. This should be a more stable choice, however, there is currently no procedure to install them.

The easiest way is to have again an install script and/or some instructions.
The nice way would be to make a PR for rosdep and make a PR for a new rule and put them in the package.xml

How can I deal with symmetric property in world model

Hi, I am using skiros2 for a simple navigation planning. I uses a connection relation that shows the connectivity between way-points and the relation should be symmetric. But in precondition check, it seems to be a directional relation.
E.g. I have a graph showing
point1 connected point2
point2 connected point3
point3 connected point1,
and with the precondition " Connected, ns:hasConnection, Start, Target, True", and point1 as Start, point3 as Target, I can get a plan that goes from point1 to point2 and point3. However, a plan that goes from point1 to point3 is also possible.
How can I check the symmetric property in condition check? Sorry for non-native expressions.
Thanks.

Check timestamps of TF frames published by the world model in simulation

When running the Gazebo simulation of the WARA robotics, the robot TF frames are published in simulation time like in ROS 1, so a number in the several hundreds.

However frames that came from the world model were shown to be published in Linux time (about 1709320098) in rqt_tf_tree. This usually means that the transformations can not be resolved due to the time mismatch.

I already checked that skiros:TfTimestamp was not set in the world model. Maybe one needs to pay attention to what clock to use in tf2 in ROS 2.

Add feedback when waiting for task manager

The task_manager_interface would wait forever for the task manager to come up.

If the task manager was not started, this results in a stalled system without feedback.

Service call failed due error world model query

I am getting a strange error. I think it's caused by the /wm/ontology/query service not being able to set an attribute due to a "Parse error with following query: SELECT ?x WHERE { ?x rdfs:subPropertyOf* skiros:spatiallyRelated . } . "

Below is the output and error.

$roslaunch skiros2 skiros.launch

PARAMETERS

  • /rosdistro: noetic
  • /rosversion: 1.16.0
  • /test_robot/libraries_list: []
  • /test_robot/prefix: skiros
  • /test_robot/skill_list: []
  • /test_robot/verbose: False
  • /tm/verbose: False
  • /wm/init_scene:
  • /wm/load_contexts: []
  • /wm/reasoners_pkgs: ['skiros2_std_rea...
  • /wm/verbose: False
  • /wm/workspace_dir: /home/me/catkin_w...

NODES
/
map2world (tf/static_transform_publisher)
skiros_gui (rqt_gui/rqt_gui)
test_robot (skiros2_skill/skill_manager_node)
tm (skiros2_task/task_manager_node)
wm (skiros2_world_model/world_model_server_node)

[WorldModelServer] Workspace folder: /home/me/catkin_ws/src/skiros2/skiros2/owl
[load_reasoner] Loaded AauSpatialReasoner
[WorldModelInterface] Wm communications active.
[WorldModelInterface] Waiting wm communications...
[WorldModelInterface] Wm communications active.
AauSpatialReasoner warn: Adding relation to cora:Robot-1-skiros:test_robot
[AauSpatialReasoner] Publishing cora:Robot-1-skiros:test_robot parent: map
AauSpatialReasoner warn: Adding relation to skiros:Location-5-skiros:unknown_location
[SkillManager] Registered robot cora:Robot-1-skiros:test_robot
[wm_update] Wm not in sync, querying wm scene
[WoQuery] error: Parse error with following query: SELECT ?x WHERE { ?x rdfs:subPropertyOf* skiros:spatiallyRelated . } .
[ERROR] [1700793233.610550]: Error processing request: can't set attribute

['Traceback (most recent call last):\n', ' File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 633, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_server.py", line 60, in _wo_query_cb\n raise e\n', ' File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_server.py", line 44, in _wo_query_cb\n for s in self._ontology.query(msg.query_string, context_id=msg.context):\n', ' File "/usr/lib/python3/dist-packages/wrapt/decorators.py", line 500, in _synchronized_wrapper\n return wrapped(*args, **kwargs)\n', ' File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/core/ontology_rdflib.py", line 138, in query\n return self.ontology(context_id).query(query)\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/graph.py", line 1084, in query\n result = plugin.get(result, query.Result)\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugin.py", line 104, in get\n return p.getClass()\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugin.py", line 66, in getClass\n module = import(self.module_path, globals(), locals(), [""])\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugins/sparql/init.py", line 35, in \n from . import parser\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugins/sparql/parser.py", line 182, in \n Param('prefix', PN_PREFIX)) + Suppress(':').leaveWhitespace()\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugins/sparql/parserutils.py", line 113, in init\n self.name = name\n', "AttributeError: can't set attribute\n"]

Service call failed: service [/wm/ontology/query] responded with an error: b"error processing request: can't set attribute"
Traceback (most recent call last):
File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_interface.py", line 301, in _call
resp1 = service(msg)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 442, in call
return self.call(*args, **kwds)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 523, in call
responses = transport.receive_once()
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 742, in receive_once
p.read_messages(b, msg_queue, sock)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 360, in read_messages
self._read_ok_byte(b, sock)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 343, in _read_ok_byte
raise ServiceException("service [%s] responded with an error: %s"%(self.resolved_name, str))
rospy.service.ServiceException: service [/wm/ontology/query] responded with an error: b"error processing request: can't set attribute"

Loading of reasoners in ROS 2 - Missing TF reasoning in skills

Loading reasoners in ROS 2 needs to be tackled:

  1. Currently we do not use the reasoners_pkgs parameter that is passed
  2. When loading we initialize a new node. This means that one must not override the node name when launching the skill manager
  3. It seems that the AauSpatialReasoner is not spinning and therefore does not receive TF data

1. "reasoner_pkgs" parameter

As a workaround we hard-coded this parameter here for now:

# TODO: pass the node
Element._node = rclpy.create_node('skiros_element')
# TODO: HACK! Fixes reasoners_pkgs list (currently we would also not have other ones)
Element._node.declare_parameter('reasoners_pkgs', ["skiros2_std_reasoners"], descriptor=ParameterDescriptor(description='List of reasoner pkgs (optional)', type=ParameterType.PARAMETER_STRING_ARRAY))

2. Creating a new node

When loading the reasoners for the first time we create a new node. Not only should that prevent us from accessing the parameter (afaik), but if the name of the "SkillManagerNode" is overwritten in the launch file, this name would also be used here when creating the second node. This leads to issues with ROS.

# TODO: pass the node
Element._node = rclpy.create_node('skiros_element')

3. The AauSpatialReasoner does seem to spin

It looks like the reasoner that is started with the procedure above does not spin. The would make sense since this node is never spun by any executor.
The observation is that TF operations from within skills can not be performed.


Solution:
All those 3 issues could be resolved if the node is passed.

When setting optional parameters from the GUI they can not be unset anymore

If a skill with optional parameters is started with the optional parameters being set, this parameter can not be "unset" or not set in subsequent executions.
So even if one selects the empty entry for that optional parameter in the SkiROS GUI, the next time the skill is started, it would still receive the old value.
Setting new values works as expected, but not setting a value is currently not possible.

This can be cured by restarting the GUI.

API changes in data-model docs

Overview: Data-model

https://github.com/RVMI/skiros2/wiki/Overview:-Data-model

Example doesn't run:

import skiros2_world_model.ros.world_model_interface as wmi

(scene, scene_id) = wmi.get_scene()
for e in scene:
    print e.printState()

On develop it seems that it should rather be:

import skiros2_world_model.ros.world_model_interface as wmi
wmi_inst = wmi.WorldModelInterface()

(scene, scene_id) = wmi.WorldModelInterface.get_scene(wmi_inst)
for e in scene:
    print e.printState()

Scene generation

Hi,

i am trying to create a scene for the robot operation environment. I have defined the owl in Protege and then i launch it but only robot is added on the scene with skills list which i can see in WorldModel tab of Rviz. I have manually converted individuals to elements for accessing their properties. How can i use the owl to automatically add individuals to the WorldModel scene upon launching?

Thank you.

Execute skill by calling ROS service

I am working on an integration where I want an external python script to initiate the execution of a skill available in SkiROS2.
On the wiki home page, it says

The skills can be parametrized and executed through the SkiROS GUI, or directly through a ROS service for integrated solutions.

While everything works fine using the SkiROS GUI, I haven't got the ROS service working yet.

I just type in rosservice call, and then use tab completion until I see the name of the robot that lives in SkiROS. This give me four options:

  • /robot_name/command
  • /robot_name/get_skills
  • /robot_name/get_loggers
  • /robot_name/set_logger_level

of which I assume only the first two to be relevant for this problem.

Calling rosservice call /robot_name/get_skills prints a quite verbose list of skills with their parameters.

Then, further using tab completion on rosservice call /robot_name/command results in a multi-line completion in my terminal, with some parameters to be filled in:

  • author, where I put my own name between the quotes
  • action, where I put lower-case start between the quotes
  • execution_id, where I've tried -1, 0, and some bigger integers
  • skills, which expands to type, name and params

To keep things simple, I made a dummy_primitive, which takes no parameters, and on execution just prints dummy_primitive called and then returns success.

For type, I set skiros:DummyPrimitive, just like I named the SkillDescription class, and just like how it appears in the world model.
For name, I set dummy_primitive, like I named it in the primitives file, and also how it appears in the world model.
The params section, I either leave unchanged, or remove entirely.

Executing this command results in ok: True and yields the following output in the skill_manager_node terminal:

[start] Starting task 0.
[BtTicker] Execution starts.
[BtTicker] Execution stops.

However, when executing this very same primitive through the use of the GUI, we can already observe a difference:

[SkillManager] Add task skiros:DummyPrimitive:dummy_primitive
[start] Starting task 23.
[BtTicker] Execution starts.
MatchWm skiros:DummyPrimitive:[Robot=cora:Robot-1-robot_type:robot_name]
dummy_primitive called
[BtTicker] Execution stops.

It seems that the GUI also makes sure that the SkillManager adds a task, which is then executed.

So to summarize, my question is: how can I execute a skill from an external python script or command line?

Dealing with skill description & implementation missmatch

In a compound skill, it is possible to not have the the skill description and the explicitly set skill implementation to match. iirc, the chosen skill implementation is executed, but the post-conditions of the skill description are checked.

I think that this should result in an error. Otherwise it can be hard to track down.

Explore patterns to load different skill sets when launching in ROS 2

In ROS 1 we had patterns to load different sets of skills depending on arguments in the launch files. For example:

  <arg name="fake_vision" default="true"/>

  <arg if="$(arg fake_vision)" name="fake_vision_suffix" default="_fake"/>
  <arg unless="$(arg fake_vision)" name="fake_vision_suffix" default=""/>

  <arg name="skill_list" default="[object_localization$(arg fake_plugging_suffix),

This would load object_localization_fake if fake_vision is set.

It would be great to explore some patterns for ROS 2.

Skill creation: Not naming skill primitive correctly leads to pickle error

When expanding a skill like this:

        skill.setProcessor(Selector())
        skill(
            self.skill("check_if_reached", ""), 
            self.skill("PoseThreeAxis", "pose_three_axis"),
        )    

instead of this

        skill.setProcessor(Selector())
        skill(
            self.skill("Check", "check_if_reached"), 
            self.skill("PoseThreeAxis", "pose_three_axis"),
        )    

leads to a

Exception in thread Thread-17:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager.py", line 61, in _run
    printer.traverse(t)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/core/visitors.py", line 40, in traverse
    self._setState(root.visit(self))
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/core/skill.py", line 223, in visit
    return visitor.process(self)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/core/visitors.py", line 51, in process
    state = self.processChildren(procedure)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/core/visitors.py", line 106, in processChildren
[...]
  File "/usr/lib/python2.7/copy.py", line 182, in deepcopy
    rv = reductor(2)
TypeError: can't pickle thread.lock objects

that is not very descriptive.

Load SkiROS2 GUI from ROS 2 launch file

In eb2195f I disabled to load the GUI directly with arguments from the launch file with this block:

gui = Node(package='rqt_gui',
executable='rqt_gui',
# arguments=["-s skiros2_gui.gui.Skiros"], # does not find the plugin. Not sure why - it appears in the list and can be selected with "ros2 run"
output='screen')

For some reason it does not find it and then rqt does not startup at all.

Things that I checked:

  • the plugin appears in the rqt list of plugins
  • other plugins can not be loaded with "-s " as well
  • the generated node string works in the terminal directly:
    /opt/ros/humble/lib/rqt_gui/rqt_gui -s skiros2_gui.gui.Skiros --ros-args

For now this just does not load the GUI directly. Once rqt is up, one can select it from the menu. When rqt is started again, it would also automatically show the SkiROS2 GUI again.

Unfortunately I could not find a launch file example on the internet that directly loads an rqt plugin.

Skill crashes ungracefully if a required parameter is not set

Here a new skill has parameters "Target" and "Task", but the parent skill does not set them.
The expectation is that this is displayed in a nicer way than showing the exception in the UI

[skill_manager_node-4]   File "/home/matthias/Workspaces/skiros2_ws/build/skiros2_skill/skiros2_skill/core/visitors.py", line 145, in processNode
[skill_manager_node-4]     state = self.execute(procedure)
[skill_manager_node-4]   File "/home/matthias/Workspaces/skiros2_ws/build/skiros2_skill/skiros2_skill/core/skill_utils.py", line 229, in execute
[skill_manager_node-4]     if not self._ground(skill):
[skill_manager_node-4]   File "/home/matthias/Workspaces/skiros2_ws/build/skiros2_skill/skiros2_skill/core/skill_utils.py", line 181, in _ground
[skill_manager_node-4]     if not self._autoParametrizeBB(skill):
[skill_manager_node-4]   File "/home/matthias/Workspaces/skiros2_ws/build/skiros2_skill/skiros2_skill/core/skill_utils.py", line 143, in _autoParametrizeBB
[skill_manager_node-4]     raise Exception("Missing required parameter(s): {}".format(missing_params))
[skill_manager_node-4] Exception: Missing required parameter(s): ['Target', 'Task']
[skill_manager_node-4] 

GUI crashes when skill manager is restarted while a skill is running and a new skill is started afterwards

When restarting the skill manager while a skill is running, the GUI crashes when starting the first skill after the skill manager becomes online again:

Traceback (most recent call last):
  File "/home/matthias/Workspaces/skiros2_ws/build/skiros2_gui/skiros2_gui/core/skiros_widget.py", line 1331, in on_skill_exe_button_clicked
    if self._sli.agent.execute(execution_id=self._sli.agent.task):
  File "/home/matthias/Workspaces/skiros2_ws/build/skiros2_skill/skiros2_skill/ros/skill_manager_interface.py", line 42, in task
    return self.tasks[0]
IndexError: list index out of range

skill_manager loads skills from pyc files without existing python files

I ran into a couple of warning in the fashion:

PluginLoader        warn: WARNING: Multiple plugins with name demo_piston_insertion found!
[<class 'skills_sandbox.coordinator_psa_demos.demo_piston_insertion'>, <class 'skills_sandbox.demos.piston_insertion_demo.demo_piston_insertion'>]

As you might remember you recently restructured this repo. So I could find the current .py and the corresponding .pyc file. But I could also still find the .pyc at the old location and apparently the skill_manager tried to load that one as well.

I am not sure what the best solution would be. Delete pyc files on a regular basis? Check if there are still corresponding python file?
But I guess the result of this behavior could be that only the first implementation found will be loaded, which would probably confuse non-expert users.

Cannot import ConditionAbstractRelation

In the turtlesim_example, in turtlesim_skills.py, I tried to import ConditionAbstractRelation from skiros2_common.core.conditions (to use it in a precondition) and it gave me an error.

CI and using the tests

  • Rework the test to be used by catkin
  • Integrate Travis YAML
  • Create Github Action to run CI

Not related :

  • Open Rosdep for inflexion packages
  • Release 1.0.6 + Release on ROS buildfarm

Follow "pycodestyle" (pep8) guidelines

While still being quite new to "professional" python development, I would argue that it makes sense to follow some codestyle guidelines.

My current IDE spyder has a built-in parser that does some style checks following "pycodestyle" [1] - formerly pep8 - but also some checks about deprecated access types and so on.

They seem to be quite helpful to me, well supported and accepted in the python community.
What do you think?

[1] https://pypi.org/project/pycodestyle/

P.S.: While using spyder now, I am open for suggestions

static code analysis with 'pylint'

What about doing static code analysis with pylint or something similar?
It seems to catch a lot of errors that can easily be found with static code analysis and could prevent annoying crashes at runtime.

It would also be possible to easily integrate it with travis_ci so one wouldn't need to check manually.

Missing feedback on wrong remaps

If remaps are done wrongly, there is no direct indication.

A minimal example is a compound "SkillB" with

  • param_a
  • param_b

In this compound skill a wrong remap has been performed:

self.skill("SkillA "skill_a", remap={'param':'param_c'}),

Notably, param_c does not exist in "SkillB". Such a wrong remap does not lead to any error messages.
When using param inside "skill_a", it actually remapped to param_a.

element id with label not working properly

Hello,
I have a part which has a label "coupling_middle" and two frames that are linked to this part ([part_name]_approach and [part_name]_handle) in the ontology and when I access these elements as on line 17 and 18 I have the correct element, however it looks like the id is not updated in the element.

When I execute the skill ArmMove, the parameter "frame" is not giving the correct label when accessing it this way:
self.frame = self.params["frame"].value.label

On the gui I always receive the first frame as a success message suggesting that the label is not refreshed or something like this. Do you have an idea how to solve this?

gui


1. 
2. class PickSkill(SkillDescription):
3. 
4.     def createDescription(self):
5.          self.addParam("object_to_pick",Element("skiros:Part"),ParamTypes.Required)
6. 
7. 
8. class pick_skill_fake(SkillBase):
9.     
10.     def createDescription(self):
11.         self.setDescription(PickSkill(), self.__class__.__name__)
12. 
13.     def expand(self, skill):
14. 
15.         part =self.params["object_to_pick"].value
16.         part_name = part.label
17.         approach_frame = Element(etype="infraflex:ApproachPose", elabel=part_name+"_approach")
18.         handle_frame = Element(etype="infraflex:HandlePose", elabel=part_name+"_handle")
19. 
20.         skill.setProcessor(SerialStar())
21.         skill(
22.              self.skill("FindHandlePose", "find_handlePose", specify={"method": "skiros_wm","object_to_handle": self.params["object_to_pick"].value}),
23.              self.skill("ArmMove", "arm_move_fake", specify={ "frame":handle_frame}),
24.              self.skill("ArmMove", "arm_move_fake", specify={ "frame":approach_frame}),
25.             
26.              ) 

ArmMove primitive implementation:


class ArmMove(SkillDescription):
    """
    @brief returns moving until "done"
    """

    def createDescription(self):
        # =======Params=========
        self.addParam("frame",Element("skiros:TransformationPose"), ParamTypes.Required)


class arm_move_fake(PrimitiveBase):
    def createDescription(self):
        self.setDescription(ArmMove(), self.__class__.__name__)

    def onPreempt(self):
        return self.success("Interrupted")

    def onStart(self):
        self.actual_time = 50
        self.frame = self.params["frame"].value.label
        return True

    def execute(self):
        self.actual_time = self.actual_time - 1.0
        if self.actual_time <0 :
            return self.success("Arm moved to {}".format(self.frame))
        return self.step("Arm moving {}".format(self.actual_time))

"return self.fail(-1, "Location not reached")" in primitive doesn't work

Returning

return self.fail(-1, "Location not reached")

in a primitive leads to

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager.py", line 64, in _run
    self._tick()
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager.py", line 77, in _tick
    self.publish_progress(uid, visitor)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager.py", line 100, in publish_progress
    self._progress_cb(task_id=uid, id=id, **desc)
  File "/home/ar-14/catkin_ws/src/libs/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager.py", line 400, in _on_progress_update
    self._monitor.publish(msg)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 886, in publish
    raise ROSSerializationException(str(e))
ROSSerializationException: field progress_code must be an integer type

which is not very descriptive.

Skill (primitive) can receive an older parameter selection

When testing the YuMi gripper skill I started out by calling the actuate_yumi_gripper primitive with the left arm from the GUI.
When starting to test it on the right arm, it still received the world model element for the right arm inside the skill in the onStart function.

I haven't checked if this is a GUI issue or skill manager/world model issue. When debugging one can think about starting the skill directly from python.

@marcusklang: This should be possible to reproduce with that skill. I just set a breakpoint in onStart before it initializes the robot interface since that would not connect.

Understanding world_model_interface._resolve_elements2

Hi,

Last Friday, we were getting a cryptic error resulting from an argumentless "raise" in world_model_interface. In python2, that results in TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType.

This was resolved by simply increasing iters = 5 to iters = 10. The problem is: we have no clue if 10 is a sensible choice or whether it will scale to large world models, because we don't understand what _resolve_elements2 is doing.

The brief description for this function is to "Find all possible inputs for one or more keys of a skill parameter handler".
Does that mean that when you have a certain skill where parameters need to be inferred, this method will go into the world model to find out which world elements can be used to fill in those parameters?

If so, how does it differ from resolve_elements() or ontology_interface.get_individuals ?

Kind regards,
Robbert

Unit test state

I am currently looking at the unit tests and quite a lot of them fail on my platform and there could be several reasons for that.

========= Testing json serialization =========
**********************************************************************
File "/home/matthias/catkin_ws/src/skiros2/skiros2_common/src/skiros2_common/ros/utils.py", line 226, in skiros2_common.ros.utils.serializeParamMap
Failed example:
    serializeParamMap(ph._params)
Expected:
    [param: {"values": [], "specType": 2, "type": "dict", "description": "", "key": "MyDict"}]
Got:
    [param: "{\"values\": [], \"specType\": 0, \"type\": \"dict\", \"description\": \"\", \"key\"\
      : \"MyDict\"}"]
**********************************************************************
File "/home/matthias/catkin_ws/src/skiros2/skiros2_common/src/skiros2_common/ros/utils.py", line 229, in skiros2_common.ros.utils.serializeParamMap
Failed example:
    serializeParamMap(ph._params)
Expected:
    [param: {"values": [], "specType": 2, "type": "list", "description": "", "key": "MyList"}, param: {"values": [], "specType": 2, "type": "dict", "description": "", "key": "MyDict"}]
Got:
    [param: "{\"values\": [], \"specType\": 0, \"type\": \"list\", \"description\": \"\", \"key\"\
      : \"MyList\"}", param: "{\"values\": [], \"specType\": 0, \"type\": \"dict\", \"description\": \"\", \"key\"\
      : \"MyDict\"}"]

There's several things here:

  1. I get a lot of those backslashes in my results. I can compensate in the test result of course, but I was wondering if this is something platform specific since I am running Ubuntu 18.04 and python 2.7.

  2. In both tests specType should be 2 but is 0. Is the unittest outdated or is there a bug in the code?

There is also some of those:

File "/home/matthias/catkin_ws/src/skiros2_std_lib/skiros2_std_reasoners/src/skiros2_std_reasoners/aau_spatial_reasoner.py", line 465, in skiros2_std_reasoners.aau_spatial_reasoner.AauSpatialReasoner._getAIRelations
Failed example:
    sr._getAIRelations(3, 3, 3, 3, 'X')
Expected:
    [':mX']
Got:
    [':mX', 0.0]

But looking at the code it looks like the test hasn't been updated.

WorldModel service calls become slow on busy ROS 2 network

When having the whole real WARA robotics setup in the same ROS_DOMAIN_ID, the world model interface service calls to the world model become very slow. It looked like 3-4 per second. This means that the skill manager needs several second per skill to launch. Starting a new skill takes at least one or two seconds.

I am not sure if this is an issue in our current usage of the ROS 2 service client. Maybe a MultiThreadedExecutor could help, but it would probably also have other implications.

Introduce error handling for broken service connections

I am running a lot of tasks with SkiROS and received one of these recently:

1603701395.683933973 INFO /worker_manager [skiros_rl_client.py:215(SkirosRlClient.next_callback)] [topics: /skill_managers/discovery, /bh_robot_4/tick_rate, /bh_robot_4/set_debug, /rosout, /bh_robot_4/monitor, /skill_managers/description, /bh_robot_2/monitor, /bh_robot_3/monitor, /bh_robot_1/set_debug, /bh_robot_1/monitor, /bh_robot_3/tick_rate, /wm/monitor, /bh_robot_3/set_debug, /bh_robot_2/tick_rate, /bh_robot_1/tick_rate, /bh_robot_2/set_debug] 2: Ending task 65451
1603701395.701773881 INFO /worker_manager [skiros_rl_client.py:181(SkirosRlClient.next_callback)] [topics: /skill_managers/discovery, /bh_robot_4/tick_rate, /bh_robot_4/set_debug, /rosout, /bh_robot_4/monitor, /skill_managers/description, /bh_robot_2/monitor, /bh_robot_3/monitor, /bh_robot_1/set_debug, /bh_robot_1/monitor, /bh_robot_3/tick_rate, /wm/monitor, /bh_robot_3/set_debug, /bh_robot_2/tick_rate, /bh_robot_1/tick_rate, /bh_robot_2/set_debug] 4: Starting new task

1603701395.706203937 ERROR /worker_manager [tcpros_service.py:581(Service.error_handler)] [topics: /skill_managers/discovery, /bh_robot_4/tick_rate, /bh_robot_4/set_debug, /rosout, /bh_robot_4/monitor, /skill_managers/description, /bh_robot_2/monitor, /bh_robot_3/monitor, /bh_robot_1/set_debug, /bh_robot_1/monitor, /bh_robot_3/tick_rate, /wm/monitor, /bh_robot_3/set_debug, /bh_robot_2/tick_rate, /bh_robot_1/tick_rate, /bh_robot_2/set_debug] Error processing request: 32Broken pipe
['Traceback (most recent call last):\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n    response = convert_return_to_response(self.handler(request), self.response_class)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/blackdrops/src/skiros_integration/skiros_rl_client.py", line 193, in next_callback\n    self.task_id = self.agent.tick_once(skill_list=[skill], param_list=params_des)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 113, in tick_once\n    return self.execute(execution_id, skill_list, srvs.SkillCommandRequest().TICK_ONCE, param_list)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 101, in execute\n    res = self.call(self._skill_exe_client, msg)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 199, in call\n    resp1 = service(msg)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__\n    return self.call(*args, **kwds)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 519, in call\n    transport.send_message(request, self.seq)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 673, in send_message\n    self.write_data(self.write_buff.getvalue())\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 698, in write_data\n    raise TransportTerminated(str(ioe_errno)+msg)\n', 'TransportTerminated: 32Broken pipe\n']

1603701395.707558000 ERROR /blackdrops_1603679732000701267 [/tmp/binarydeb/ros-melodic-roscpp-1.14.9/src/libros/service_server_link.cpp:378(ServiceServerLink::call)] [topics: /rosout] Service call failed: service [/skiros_worker_4] responded with an error: error processing request: 32Broken pipe

1603701395.708432912 ERROR /worker_manager [tcpros_service.py:581(Service.error_handler)] [topics: /skill_managers/discovery, /bh_robot_4/tick_rate, /bh_robot_4/set_debug, /rosout, /bh_robot_4/monitor, /skill_managers/description, /bh_robot_2/monitor, /bh_robot_3/monitor, /bh_robot_1/set_debug, /bh_robot_1/monitor, /bh_robot_3/tick_rate, /wm/monitor, /bh_robot_3/set_debug, /bh_robot_2/tick_rate, /bh_robot_1/tick_rate, /bh_robot_2/set_debug] Error processing request: 'NoneType' object has no attribute 'close'
['Traceback (most recent call last):\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n    response = convert_return_to_response(self.handler(request), self.response_class)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/blackdrops/src/skiros_integration/skiros_rl_client.py", line 193, in next_callback\n    self.task_id = self.agent.tick_once(skill_list=[skill], param_list=params_des)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 113, in tick_once\n    return self.execute(execution_id, skill_list, srvs.SkillCommandRequest().TICK_ONCE, param_list)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 101, in execute\n    res = self.call(self._skill_exe_client, msg)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 199, in call\n    resp1 = service(msg)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__\n    return self.call(*args, **kwds)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 535, in call\n    transport.close()\n', '  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 846, in close\n    self.socket.close()\n', "AttributeError: 'NoneType' object has no attribute 'close'\n"]
1603701395.709977804 ERROR /blackdrops_1603679732000701267 [/tmp/binarydeb/ros-melodic-roscpp-1.14.9/src/libros/service_server_link.cpp:378(ServiceServerLink::call)] [topics: /rosout] Service call failed: service [/skiros_worker_4] responded with an error: error processing request: 'NoneType' object has no attribute 'close'
1603701395.761034965 INFO /worker_manager [skiros_rl_client.py:181(SkirosRlClient.next_callback)] [topics: /skill_managers/discovery, /bh_robot_4/tick_rate, /bh_robot_4/set_debug, /rosout, /bh_robot_4/monitor, /skill_managers/description, /bh_robot_2/monitor, /bh_robot_3/monitor, /bh_robot_1/set_debug, /bh_robot_1/monitor, /bh_robot_3/tick_rate, /wm/monitor, /bh_robot_3/set_debug, /bh_robot_2/tick_rate, /bh_robot_1/tick_rate, /bh_robot_2/set_debug] 4: Starting new task

h_robot_1/tick_rate, /bh_robot_2/set_debug] 4: Starting new task
1603701395.771452903 ERROR /worker_manager [tcpros_service.py:581(Service.error_handler)] [topics: /skill_managers/discovery, /bh_robot_4/tick_rate, /bh_robot_4/set_debug, /rosout, /bh_robot_4/monitor, /skill_managers/description, /bh_robot_2/monitor, /bh_robot_3/monitor, /bh_robot_1/set_debug, /bh_robot_1/monitor, /bh_robot_3/tick_rate, /wm/monitor, /bh_robot_3/set_debug, /bh_robot_2/tick_rate, /bh_robot_1/tick_rate, /bh_robot_2/set_debug] Error processing request: 'NoneType' object has no attribute 'tell'
['Traceback (most recent call last):\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n    response = convert_return_to_response(self.handler(request), self.response_class)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/blackdrops/src/skiros_integration/skiros_rl_client.py", line 193, in next_callback\n    self.task_id = self.agent.tick_once(skill_list=[skill], param_list=params_des)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 113, in tick_once\n    return self.execute(execution_id, skill_list, srvs.SkillCommandRequest().TICK_ONCE, param_list)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 101, in execute\n    res = self.call(self._skill_exe_client, msg)\n', '  
    File "/home/ubuntu/Workspaces/blackdrops_ws/src/skiros2/skiros2/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py", line 199, in call\n    resp1 = service(msg)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__\n    return self.call(*args, **kwds)\n', '  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 519, in call\n    transport.send_message(request, self.seq)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 672, in send_message\n    serialize_message(self.write_buff, seq, msg)\n', '  
    File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/msg.py", line 139, in serialize_message\n    start = b.tell()\n', "AttributeError: 'NoneType' object has no attribute 'tell'\n"]

My current workaround is this patch:

--- a/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py                                                                                                                                      
+++ b/skiros2_skill/src/skiros2_skill/ros/skill_manager_interface.py                                                                                                                                      
@@ -84,6 +84,16 @@ class SkillManagerInterface:                                                                                                                                                           
     def get_skill(self, name):                                                                                                                                                                           
         return self._skill_list[name]                                                                                                                                                                    
                                                                                                                                                                                                          
+    # Hack: This is a workaround because the connection breaks occasionally                                                                                                                              
+    def call_execute_client(self, msg):                                                                                                                                                                  
+        try:                                                                                                                                                                                             
+            resp1 = self._skill_exe_client(msg)                                                                                                                                                          
+            return resp1                                                                                                                                                                                 
+        except rospy.ServiceException as e:                                                                                                                                                              
+            log.error("[call]", "Service call failed: %s. Renewing connection."%e)                                                                                                                       
+            self._skill_exe_client = rospy.ServiceProxy(self._skill_mgr_name + '/command', srvs.SkillCommand)                                                                                            
+            return                                                                                                                                                                                       
+                                                                                                                                                                                                         
     def execute(self, execution_id=-1, skill_list=None, action=srvs.SkillCommandRequest().START, param_list=None):                                                                                       
         """                                                                                                                                                                                              
         @brief Execute a list of skills                                                                                                                                                                  
@@ -98,7 +108,7 @@ class SkillManagerInterface:                                                                                                                                                           
         if skill_list is not None:                                                                                                                                                                       
             for s in skill_list:                                                                                                                                                                         
                 msg.skills.append(s.toMsg())                                                                                                                                                             
-        res = self.call(self._skill_exe_client, msg)                                                                                                                                                     
+        res = self.call_execute_client(msg)                                                                                                                                                              
         if res is None:                                                                                                                                                                                  
             return -1                                                                                                                                                                                    
         if not res.ok:   

Since the call function does not easily have the information available to re-instantiate the connection.

Getting error that the owl "must be an rdflib term"

Hi,

I am getting a must be an rdflib term errors. An example of the error message looks like this, "Subject http://www.inf.ufrgs.br/phi-group/ontologies/cora.owl#Robot-1 must be an rdflib term". It doesn't seem that the errors are due to the skiros.owl and skirosExtra.owl files but rather from the owl files in the IEEE-1872-2015 folder. However, this doesn't make sense because I am able to view the owl files from the IEEE-1872-2015 folder in Protégé 5.6.3.

I have attached to outputs below.

Please also note that there are _SyntaxWarning: "is" with a literal. Did you mean "=="?_ errors but this is related to python 3.8 raising a SyntaxWarning due to the usage of "is" instead of "==".

GetImage
GetImage1
GetImage2

Environment:
Ubuntu 20.04.6
Python 3.8.10
ROS Noetic
rdflib 7.0.0

Please advise.
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.