spike.scenario.model
Classes describing lego robot static structure
Classes
Class modelling robot static relative geometry |
- class spike.scenario.model.ScenarioModel
Class modelling robot static relative geometry
- __init__()
Constructor
- configure(filename)
Configure robot
- Parameters:
filename (string) – Robot configuration file path
- Raises:
ValueError – Component not found for port, component type does not match ldraw type or 2 parts connected to the same hub port or missing attribute for component or missing robot design file or missing ldraw unit size or unknown topic in configuration file
- altitude()
Returns the robot wheels center altitude in NED local reference
- Returns:
robot altitude
- Return type:
float (cm)
- ports()
Returns the allocated ports with their part type
- Returns:
ports associated with their components
- Return type:
dictionary
- by_port()
Returns the robot parts indexed by port
- Returns:
robot parts
- Return type:
dictionary
- by_type()
Returns the robot parts indexed by type
- Returns:
robot parts
- Return type:
dictionary
- all()
Returns the robot active or sensive parts
- Returns:
robot parts
- Return type:
list
- __check_configuration(conf)
Check input json configuration
- Parameters:
conf (dictionary) – configuration file content
- Raises:
ValueError – missing attribute for component or missing robot design file or missing ldraw unit size or unknown topic in configuration file
- __read(filename, ldu=0.04)
Build robot model from ldraw file
- Parameters:
filename (string) – ldraw formatted filename path
ldu (float) – ldu (ldraw unit) size in centimeters, default 0.4 mm
- Returns:
robot parts, robot model, ldraw parts
- Return type:
list, list, dictionary
- __convert_pose(parts, system)
Convert part pose in a new coordinates system
- Parameters:
parts (list) – robot parts with pose in ldraw reference
system (CoordinateSystem) – coordinate system to transform parts into
- Returns:
converted parts
- Return type:
list
- __add_port_to_parts(conf, parts)
Add hub ports info to parts from the robot configuration file. Extract wheel spins info for further use
- Parameters:
conf (dictionary) – robot configuration file content
parts (list) – robot parts
- Raises:
ValueError – Component not found for port, component type does not match ldraw type or 2 parts connected to the same hub port
- Returns:
parts, wheel spins
- Return type:
tuple (list, dictionary)
- __organize_parts(parts, spins)
Organize parts to be accessible by port or by type
- Parameters:
parts (list) – list of parts to organize
spins (dictionary) – wheel spins already extracted from the configuration file
- Returns:
extended parts, parts by type, parts by port
- Return type:
tuple (list, dictionary, dictionary)
- Raises:
ValueError – Can not manage other than 2 wheels