agimus_sot.supervisor.Supervisor Class Reference

Supervise the consecutive execution of several SoT. More...

Inheritance diagram for agimus_sot.supervisor.Supervisor:
[legend]
Collaboration diagram for agimus_sot.supervisor.Supervisor:
[legend]

Public Member Functions

def __init__ (self, sotrobot, lpTasks=None, hpTasks=None)
 
def makeInitialSot (self)
 
def setBasePose (self, basePose)
 Set the robot base pose in the world. More...
 
def topics (self)
 
def plugTopicsToRos (self)
 
def printQueueSize (self)
 
def isSotConsistentWithCurrent (self, transitionName, thr=1e-3)
 Check consistency between two SoTs. More...
 
def clearQueues (self)
 
def waitForQueue (self, minQueueSize, timeout)
 Wait for the queue to be of a given size. More...
 
def readQueue (self, delay, minQueueSize, duration, timeout)
 Start reading values received by the RosQueuedSubscribe entity. More...
 
def stopReadingQueue (self)
 
def plugSot (self, transitionName, check=False)
 
def runPreAction (self, transitionName)
 
def runPostAction (self, targetStateName)
 Execute a post-action. More...
 
def getJointList (self, prefix="")
 
def publishState (self, subsampling=40)
 

Public Attributes

 sotrobot
 
 hpTasks
 
 lpTasks
 
 currentSot
 
 sot_switch
 
 error_events
 
 keep_posture
 
 rosSubscribe
 
 rosTf
 
 ros_publish_state
 

SoT managements

def addPreAction (self, name, preActionSolver)
 
def addSolver (self, name, solver)
 
def duplicateSolver (self, existingSolver, newSolver)
 
def addPostActions (self, name, postActionSolvers)
 

Detailed Description

Supervise the consecutive execution of several SoT.

Typically, these sots are created via factory.Factory. They can also be added manually.

Steps: P = placement, G = grasp, p = pre-P, g = pre-G
0. P <-> GP
1. P <-> gP
2. gP <-> GP
3. GP <-> G
4. GP <-> Gp
5. Gp <-> G

Constructor & Destructor Documentation

◆ __init__()

def agimus_sot.supervisor.Supervisor.__init__ (   self,
  sotrobot,
  lpTasks = None,
  hpTasks = None 
)
Parameters
lpTaskslist of low priority tasks. If None, a Posture task will be used.
hpTaskslist of high priority tasks (like balance)

Member Function Documentation

◆ addPostActions()

def agimus_sot.supervisor.Supervisor.addPostActions (   self,
  name,
  postActionSolvers 
)

◆ addPreAction()

def agimus_sot.supervisor.Supervisor.addPreAction (   self,
  name,
  preActionSolver 
)

References agimus_sot.supervisor.Supervisor._addSignalToSotSwitch(), and agimus_sot.factory.Factory.preActions.

◆ addSolver()

def agimus_sot.supervisor.Supervisor.addSolver (   self,
  name,
  solver 
)

References agimus_sot.supervisor.Supervisor._addSignalToSotSwitch(), and agimus_sot.factory.Factory.sots.

◆ clearQueues()

def agimus_sot.supervisor.Supervisor.clearQueues (   self)

◆ duplicateSolver()

def agimus_sot.supervisor.Supervisor.duplicateSolver (   self,
  existingSolver,
  newSolver 
)

◆ getJointList()

def agimus_sot.supervisor.Supervisor.getJointList (   self,
  prefix = "" 
)

◆ isSotConsistentWithCurrent()

def agimus_sot.supervisor.Supervisor.isSotConsistentWithCurrent (   self,
  transitionName,
  thr = 1e-3 
)

Check consistency between two SoTs.

This is not used anymore because it must be synchronized with the real-time thread.

Todo:
Re-enable consistency check between two SoTs.

References agimus_sot.supervisor.Supervisor.currentSot, agimus_sot.supervisor.Supervisor.sotrobot, agimus_sot.factory.Factory.sotrobot, and agimus_sot.factory.Factory.sots.

Referenced by agimus_sot.supervisor.Supervisor.plugSot().

◆ makeInitialSot()

def agimus_sot.supervisor.Supervisor.makeInitialSot (   self)

◆ plugSot()

◆ plugTopicsToRos()

def agimus_sot.supervisor.Supervisor.plugTopicsToRos (   self)

◆ printQueueSize()

def agimus_sot.supervisor.Supervisor.printQueueSize (   self)

◆ publishState()

def agimus_sot.supervisor.Supervisor.publishState (   self,
  subsampling = 40 
)

◆ readQueue()

def agimus_sot.supervisor.Supervisor.readQueue (   self,
  delay,
  minQueueSize,
  duration,
  timeout 
)

Start reading values received by the RosQueuedSubscribe entity.

Parameters
delay(integer) how many periods to wait before reading. It allows to give some delay to network connection.
minQueueSize(integer) waits to the queue size of rosSubscribe to be greater or equal to minQueueSize
durationexpected duration (in seconds) of the queue.
timeouttime in seconds after which to return a failure.
Returns
success, time boolean, SoT time at which reading starts (invalid if success is False)
Warning
If minQueueSize is greater than the number of values to be received by rosSubscribe, this function does an infinite loop.

References agimus_sot.supervisor.Supervisor.currentSot, agimus_sot.supervisor.Supervisor.error_events, agimus_sot.supervisor.Supervisor.rosSubscribe, agimus_sot.supervisor.Supervisor.sotrobot, agimus_sot.factory.Factory.sotrobot, and agimus_sot.supervisor.Supervisor.waitForQueue().

◆ runPostAction()

def agimus_sot.supervisor.Supervisor.runPostAction (   self,
  targetStateName 
)

Execute a post-action.

Returns
success, time boolean, SoT time at which reading starts (invalid if success is False)

References agimus_sot.supervisor.Supervisor._selectSolver(), agimus_sot.supervisor.Supervisor.currentSot, agimus_sot.factory.Factory.postActions, agimus_sot.supervisor.Supervisor.sotrobot, and agimus_sot.factory.Factory.sotrobot.

◆ runPreAction()

def agimus_sot.supervisor.Supervisor.runPreAction (   self,
  transitionName 
)

◆ setBasePose()

def agimus_sot.supervisor.Supervisor.setBasePose (   self,
  basePose 
)

Set the robot base pose in the world.

Parameters
basePosea list: [x,y,z,r,p,y] or [x,y,z,qx,qy,qz,qw]
Returns
success True in case of success

References agimus_sot.supervisor.Supervisor.currentSot, agimus_sot.supervisor.Supervisor.keep_posture, agimus_sot.supervisor.Supervisor.sotrobot, and agimus_sot.factory.Factory.sotrobot.

◆ stopReadingQueue()

def agimus_sot.supervisor.Supervisor.stopReadingQueue (   self)

◆ topics()

◆ waitForQueue()

def agimus_sot.supervisor.Supervisor.waitForQueue (   self,
  minQueueSize,
  timeout 
)

Wait for the queue to be of a given size.

Parameters
minQueueSize(integer) waits to the queue size of rosSubscribe to be greater or equal to minQueueSize
timeouttime in seconds after which to return a failure.
Returns
True on success, False on timeout.

References agimus_sot.supervisor.Supervisor.rosSubscribe, agimus_sot.supervisor.Supervisor.sotrobot, and agimus_sot.factory.Factory.sotrobot.

Referenced by agimus_sot.supervisor.Supervisor.readQueue().

Member Data Documentation

◆ currentSot

◆ error_events

agimus_sot.supervisor.Supervisor.error_events

◆ hpTasks

agimus_sot.supervisor.Supervisor.hpTasks

◆ keep_posture

agimus_sot.supervisor.Supervisor.keep_posture

◆ lpTasks

agimus_sot.supervisor.Supervisor.lpTasks

◆ ros_publish_state

agimus_sot.supervisor.Supervisor.ros_publish_state

◆ rosSubscribe

◆ rosTf

agimus_sot.supervisor.Supervisor.rosTf

◆ sot_switch

agimus_sot.supervisor.Supervisor.sot_switch

◆ sotrobot