OpTaS
1.0.7
An optimization-based task specification library for trajectory optimization and model predictive control.
|
Manager setup specifically for ROS. More...
Public Member Functions | |
def | __init__ (self, Any rosapi, int rosver, Union[None, str] config_filename, bool record_solver_perf=False) |
Initializer for the ROSManger class. More... | |
None | add_subscriber (self, str topic_name, Any msg_type) |
Creates a subscriber. More... | |
Any | get_state (self, str topic_name) |
Get the most current message. More... | |
bool | is_ready (self) |
True when messages have been recieved on all topics. More... | |
None | publish_target (self, cs.DM target) |
Publish a target to ROS. More... | |
None | create_state_listener (self) |
Creates the state listener. More... | |
Public Member Functions inherited from optas.templates.Manager | |
def | __init__ (self, Union[None, str] config_filename=None, bool record_solver_perf=False) |
Initializer for the Manger class. More... | |
None | reset_manager (self) |
Reset basic variables in the manager. More... | |
float | get_solver_duration (self) |
Returns the duration of the solver. More... | |
bool | is_first_solve (self) |
True when the solver is being run for the first time. More... | |
None | setup_solver (self) |
Abstract methods. More... | |
None | reset (self) |
Reset the optimization problem. More... | |
cs.DM | get_target (self) |
Return the target from the solution. More... | |
Public Attributes | |
rosapi | |
For ROS 1, this is rospy (ie. More... | |
rosver | |
ROS version (i.e. More... | |
Float64MultiArray | |
Float array message type. More... | |
target_pub | |
Target publisher. More... | |
msgs | |
Dictionary containing messages from the state listener. More... | |
Public Attributes inherited from optas.templates.Manager | |
config_filename | |
record_solver_perf | |
config | |
solver | |
solve | |
num_solves | |
solver_duration | |
solution | |
Static Public Attributes | |
dictionary | state_listener = {} |
ROS state listener. More... | |
Private Member Functions | |
Any | _setup_target_publisher (self) |
Creates the target publisher. More... | |
None | _callback (self, Any msg, str topic_name) |
The subcriber callback. More... | |
Manager setup specifically for ROS.
def optas.templates.ROSManager.__init__ | ( | self, | |
Any | rosapi, | ||
int | rosver, | ||
Union[None, str] | config_filename, | ||
bool | record_solver_perf = False |
||
) |
Initializer for the ROSManger class.
@param rosapi For ROS 1, this is rospy (ie. import rospy, and pass the module). For ROS 2, this is the node. @param rosver When using ROS 1, pass 1, and if using ROS 2, pass 2. @param config_filename Filename for a YAML configuration file. When None is passed, it is assumed there is no configuration. @param record_solver_perf When true the solver duration is recorded when there is a call to solve. @return An instance of the ROSManager class.
Reimplemented in optas.templates.ROSPlanner.
|
private |
The subcriber callback.
@param msg The message from ROS. @param topic_name the name of the topic the message is from.
|
private |
Creates the target publisher.
@return Instance of the target publisher.
None optas.templates.ROSManager.add_subscriber | ( | self, | |
str | topic_name, | ||
Any | msg_type | ||
) |
Creates a subscriber.
@param topic_name Name of the topic to subscribe. @param msg_type The message type for the given topic.
None optas.templates.ROSManager.create_state_listener | ( | self | ) |
Creates the state listener.
Any optas.templates.ROSManager.get_state | ( | self, | |
str | topic_name | ||
) |
Get the most current message.
@return The message from ROS. None is returned if the message is not yet received.
bool optas.templates.ROSManager.is_ready | ( | self | ) |
True when messages have been recieved on all topics.
@return Boolean indicating if the manager is ready to use.
Reimplemented from optas.templates.Manager.
None optas.templates.ROSManager.publish_target | ( | self, | |
cs.DM | target | ||
) |
Publish a target to ROS.
@param target The target array.
optas.templates.ROSManager.Float64MultiArray |
Float array message type.
optas.templates.ROSManager.msgs |
Dictionary containing messages from the state listener.
optas.templates.ROSManager.rosapi |
For ROS 1, this is rospy (ie.
import rospy, and pass the module). For ROS 2, this is the node.
optas.templates.ROSManager.rosver |
ROS version (i.e.
1 or 2).
|
static |
ROS state listener.
Dictionary that defines the state listener. This is used to setup subscribers that listen to the input that defines the parameters for the solver. The key should be the topic name, and the value should be the message type. E.g. "joint_states": JointState
optas.templates.ROSManager.target_pub |
Target publisher.