System that controls an elevator. It closely models the structure and functionality of a real elevator. It individually controls the cabin and doors of the elevator, queues commands for the elevator and stops at intermediate floors if a command is received while the last one is ongoing, and keeps a door open if the doorway is blocked. The model of the elevator can have arbitrarily many floor levels and at arbitrary heights each. More...
#include <Elevator.hh>
Public Member Functions | |
Elevator () | |
Constructor. More... | |
~Elevator () override=default | |
Destructor. More... | |
void | Configure (const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr) override |
Configure the system. More... | |
void | PostUpdate (const UpdateInfo &_info, const EntityComponentManager &_ecm) override |
Public Member Functions inherited from System | |
System ()=default | |
Constructor. More... | |
virtual | ~System ()=default |
Destructor. More... | |
Additional Inherited Members | |
Public Types inherited from System | |
using | PriorityType = int32_t |
Signed integer type used for specifying priority of the execution order of PreUpdate and Update phases. More... | |
Static Public Attributes inherited from System | |
constexpr static PriorityType | kDefaultPriority = {0} |
Default priority value for execution order of the PreUpdate and Update phases. More... | |
constexpr static std::string_view | kPriorityElementName |
Name of the XML element from which the priority value will be parsed. More... | |
Detailed Description
System that controls an elevator. It closely models the structure and functionality of a real elevator. It individually controls the cabin and doors of the elevator, queues commands for the elevator and stops at intermediate floors if a command is received while the last one is ongoing, and keeps a door open if the doorway is blocked. The model of the elevator can have arbitrarily many floor levels and at arbitrary heights each.
Assumptions on the Elevator Model
In the default configuration, the cabin is at the ground floor and the doors are closed
In the default configuration, the cabin and door joints are at zero position
There are reference floor links along the cabin joint that indicate the cabin joint positions for each floor. The names of links follow the pattern indicated by <floor_link_prefix>
There is a door in each floor and the names of the doors follow the pattern indicated by <door_joint_prefix>
Each cabin and door joint has an associated joint position controller system that listens for command to /model/{model_name}/joint/{joint_name}/0/cmd_pos
Each door (optionally) has a lidar that, if intercepted, indicates that the doorway is blocked. The lidar publishes sensor data on topic /model/{model_name}/{door_joint_name}/lidar
System Parameters
<update_rate>
: System update rate. This element is optional and the default value is 10Hz. A value of zero gets translated to the simulation rate (no throttling for the system).<floor_link_prefix>
: Prefix in the names of the links that function as a reference for each floor level. When the elevator is requested to move to a given floor level, the cabin is commanded to move to the height of the corresponding floor link. The names of the links will be expected to be{prerix}i
, where \(i=[0,N)\) and N is the number of floors. This element is optional and the default value isfloor_
.<door_joint_prefix>
: Prefix in the names of the joints that control the doors of the elevator. The names of the joints will be expected to be{prerix}i
, where \(i=[0,N)\) and N is the number of floors. This element is optional and the default value isdoor_
.<cabin_joint>
: Name of the joint that controls the position of the cabin. This element is optional and the default value islift
.<cmd_topic>
: Topic to which this system will subscribe in order to receive command messages. This element is optional and the default value is/model/{model_name}/cmd
.<state_topic>
: Topic on which this system will publish state (current floor) messages. This element is optional and the default value is/model/{model_name}/state
.<state_publish_rate>
: State publication rate. This rate is bounded by<update_rate>
. This element is optional and the default value is 5Hz.<open_door_wait_duration>
: Time to wait with a door open before the door closes. This element is optional and the default value is 5 sec.
Constructor & Destructor Documentation
◆ Elevator()
Elevator | ( | ) |
Constructor.
◆ ~Elevator()
|
overridedefault |
Destructor.
Member Function Documentation
◆ Configure()
|
overridevirtual |
Configure the system.
- Parameters
-
[in] _entity The entity this plugin is attached to. [in] _sdf The SDF Element associated with this system plugin. [in] _ecm The EntityComponentManager of the given simulation instance. [in] _eventMgr The EventManager of the given simulation instance.
Implements ISystemConfigure.
◆ PostUpdate()
|
overridevirtual |
Implements ISystemPostUpdate.
The documentation for this class was generated from the following file: