![]() |
An open-source, flexible 3D physical simulation framework
|
"MotorManagerInterface" declares the interfaces for all motor operations that are used for the communication between the simulation modules. More...
#include <MotorManagerInterface.h>
Public Member Functions | |
virtual | ~MotorManagerInterface () |
Destructor. More... | |
virtual unsigned long | addMotor (MotorData *motorS, bool reload=false)=0 |
Add a motor to the simulation. More... | |
virtual int | getMotorCount () const =0 |
Returns the number of motors that are currently present in the simulation. More... | |
virtual void | editMotor (const MotorData &motorS)=0 |
Change motor properties. More... | |
virtual void | getListMotors (std::vector< core_objects_exchange > *motorList) const =0 |
Gives information about core exchange data for motors. More... | |
virtual const MotorData | getFullMotor (unsigned long index) const =0 |
Gives all information of a certain motor. More... | |
virtual void | removeMotor (unsigned long index)=0 |
Removes a motor from the simulation. More... | |
virtual void | moveMotor (unsigned long index, sReal value)=0 |
Sets the value of the motor with the given id to the given value. More... | |
virtual sim::SimMotor * | getSimMotor (unsigned long index) const =0 |
This function returns the SimMotor object for a given id. More... | |
virtual sim::SimMotor * | getSimMotorByName (const std::string &name) const =0 |
This function returns the SimMotor object for a given name. More... | |
virtual void | setMotorValue (unsigned long id, sReal value)=0 |
Sets the value of the motor with the given id to the given value. More... | |
virtual void | setMaxTorque (unsigned long id, sReal maxTorque)=0 |
Sets the maximum torque of the motor with the given id to the given value. More... | |
virtual void | setMaxSpeed (unsigned long id, sReal maxSpeed)=0 |
Sets the maximum speed of the motor with the given id to the given value. More... | |
virtual void | setMotorValueDesiredVelocity (unsigned long id, sReal velocity)=0 |
Sets the desired speed of a motor. More... | |
virtual void | setMotorP (unsigned long id, sReal value)=0 |
Sets the proportional term of the motor with the given id to the given value. More... | |
virtual void | setMotorI (unsigned long id, sReal value)=0 |
Sets the integral term of the motor with the given id to the given value. More... | |
virtual void | setMotorD (unsigned long id, sReal value)=0 |
Sets the derivative term of the motor with the given id to the given value. More... | |
virtual void | deactivateMotor (unsigned long id)=0 |
Deactivates the motor with the given id. More... | |
virtual void | clearAllMotors (bool clear_all=false)=0 |
Destroys all motors in the simulation. More... | |
virtual void | reloadMotors (void)=0 |
This function reloads all motors from a temporary motor pool. More... | |
virtual void | updateMotors (sReal calc_ms)=0 |
This function updates all motors with timing value calc_ms in miliseconds. More... | |
virtual sReal | getActualPosition (unsigned long motorId) const =0 |
virtual sReal | getTorque (unsigned long motorId) const =0 |
virtual unsigned long | getID (const std::string &motor_name) const =0 |
Retrieves the id of a motor by name. More... | |
virtual void | removeJointFromMotors (unsigned long joint_index)=0 |
Detaches the joint with the given index from all motors that act on it, if any. More... | |
virtual void | getDataBrokerNames (unsigned long jointId, std::string *groupName, std::string *dataName) const =0 |
Retrieves the groupName and dataName under which the motor with the specified id publishes its data in the DataBroker. More... | |
virtual void | connectMimics ()=0 |
virtual void | edit (MotorId id, const std::string &key, const std::string &value)=0 |
"MotorManagerInterface" declares the interfaces for all motor operations that are used for the communication between the simulation modules.
The class defines only pure virtual functions that are implemented within the simulation and can be used everywhere by accessing this interface via the ControlCenter class.
It is very important to assure the serialization between the threads to have the desired results. Currently the verified use of the functions is only guaranteed by calling it within the main thread (update callback from gui_thread
).
Definition at line 64 of file MotorManagerInterface.h.
|
inlinevirtual |
Destructor.
Definition at line 69 of file MotorManagerInterface.h.
|
pure virtual |
Add a motor to the simulation.
motorS | A pointer to the MotorData that defines the new motor. |
reload | Used internally by the simulation. The default value is false . If this param is set to true the new motor will not be reloaded after a reset of the simulation. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Destroys all motors in the simulation.
The clear_all
flag indicates if the reload motors should be destroyed as well. If set to false
they are left intact.
clear_all | Indicates if the reload motors should be destroyed as well. If set to false they are left intact. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Deactivates the motor with the given id.
id | The id of the motor that is to be deactivated. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Change motor properties.
The old struct is replaced by the new one completely, so prior to calling this function, one must ensure that all properties of this parameter are valid and as desired.
motorS | The id of the MotorData referred by this pointer must be the same as the id of the motor that is to be edited. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Retrieves the groupName and dataName under which the motor with the specified id publishes its data in the DataBroker.
true
if the names were successfully retrieved. false
if no motor with the given id exists. Implemented in mars::sim::MotorManager.
|
pure virtual |
Gives all information of a certain motor.
index | The unique id of the motor to get information for. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Retrieves the id of a motor by name.
motor_name | Name of the motor to get the id for |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Gives information about core exchange data for motors.
motorList | A pointer to a vector that is filled with a core_objects_exchange struct for every motor and its index. The vector is cleared in the beginning of this function. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Returns the number of motors that are currently present in the simulation.
Implemented in mars::sim::MotorManager.
|
pure virtual |
This function returns the SimMotor object for a given id.
index | The id of the motor to get the core motor object. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
This function returns the SimMotor object for a given name.
name | The name of the motor to get the core motor object. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the value of the motor with the given id to the given value.
Essentially this function triggers the motor and moves the joint that is attached to it. Equivalent to setMotorValue
id | The id of the motor whose value is to be changed. |
value | The new value. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
This function reloads all motors from a temporary motor pool.
All motors that have been added with reload
value as true
are added back to the simulation again with a reload
value of true
.
Implemented in mars::sim::MotorManager.
|
pure virtual |
Detaches the joint with the given index from all motors that act on it, if any.
Used when a joint is destroyed.
removeMotor
must be made to remove the motor completely.joint_index | The id of the joint that is to be detached. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Removes a motor from the simulation.
index | The unique id of the motor to remove form the simulation. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the maximum speed of the motor with the given id to the given value.
id | The id of the motor whose value is to be changed. |
maxSpeed | The new maximum speed for the motor. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the maximum torque of the motor with the given id to the given value.
id | The id of the motor whose value is to be changed. |
maxTorque | The new maximum torque for the motor. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the derivative term of the motor with the given id to the given value.
Only has effect on a PID motor. If the type of the motor with the given id is different from PID, no effect is observed, although the D value of the motor object is still changed.
id | The id of the motor whose D value is to be changed. |
value | The new D value. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the integral term of the motor with the given id to the given value.
Only has effect on a PID motor. If the type of the motor with the given id is different from PID, no effect is observed, although the I value of the motor object is still changed.
id | The id of the motor whose I value is to be changed. |
value | The new I value. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the proportional term of the motor with the given id to the given value.
Only has effect on a PID motor. If the type of the motor with the given id is different from PID, no effect is observed, although the P value of the motor object is still changed.
id | The id of the motor whose P value is to be changed. |
value | The new P value. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the value of the motor with the given id to the given value.
Essentially this function triggers the motor and moves the joint that is attached to it. Equivalent to moveMotor
id | The id of the motor whose value is to be changed. |
value | The new value. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
Sets the desired speed of a motor.
id | The id of the motor whose value is to be changed. |
value | The new value in rad/s. |
Implemented in mars::sim::MotorManager.
|
pure virtual |
This function updates all motors with timing value calc_ms
in miliseconds.
calc_ms | The timing value in miliseconds. |
Implemented in mars::sim::MotorManager.