OpTaS  1.0.7
An optimization-based task specification library for trajectory optimization and model predictive control.
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
optas.templates.ROSManager Class Reference

Manager setup specifically for ROS. More...

Inheritance diagram for optas.templates.ROSManager:
Inheritance graph
[legend]
Collaboration diagram for optas.templates.ROSManager:
Collaboration graph
[legend]

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...
 

Detailed Description

Manager setup specifically for ROS.

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ _callback()

None optas.templates.ROSManager._callback (   self,
Any  msg,
str  topic_name 
)
private

The subcriber callback.

   @param msg The message from ROS.
   @param topic_name the name of the topic the message is from.

◆ _setup_target_publisher()

Any optas.templates.ROSManager._setup_target_publisher (   self)
private

Creates the target publisher.

   @return Instance of the target publisher.

◆ add_subscriber()

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.

◆ create_state_listener()

None optas.templates.ROSManager.create_state_listener (   self)

Creates the state listener.

◆ get_state()

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.

◆ is_ready()

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.

◆ publish_target()

None optas.templates.ROSManager.publish_target (   self,
cs.DM  target 
)

Publish a target to ROS.

   @param target The target array.

Member Data Documentation

◆ Float64MultiArray

optas.templates.ROSManager.Float64MultiArray

Float array message type.

◆ msgs

optas.templates.ROSManager.msgs

Dictionary containing messages from the state listener.

◆ rosapi

optas.templates.ROSManager.rosapi

For ROS 1, this is rospy (ie.

import rospy, and pass the module). For ROS 2, this is the node.

◆ rosver

optas.templates.ROSManager.rosver

ROS version (i.e.

1 or 2).

◆ state_listener

dictionary optas.templates.ROSManager.state_listener = {}
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

◆ target_pub

optas.templates.ROSManager.target_pub

Target publisher.


The documentation for this class was generated from the following file: