kompass.components.motion_server¶
Module Contents¶
Classes¶
MotionServer config parameters |
|
MotionServer component used for automatic testing by sending reference commands and recording resulting motion. |
API¶
- class kompass.components.motion_server.MotionServerConfig¶
Bases:
kompass.config.ComponentConfigMotionServer config parameters
- class kompass.components.motion_server.MotionServer(*, component_name: str, config: Optional[kompass.components.motion_server.MotionServerConfig] = None, config_file: Optional[str] = None, robot_cmd_topic: Optional[kompass.components.ros.Topic] = None, robot_odom_topic: Optional[kompass.components.ros.Topic] = None, callback_group: Optional[rclpy.callback_groups.CallbackGroup] = None, **kwargs)¶
Bases:
kompass.components.component.ComponentMotionServer component used for automatic testing by sending reference commands and recording resulting motion.
Input Topics:
run: Run tests on start
DefaultTopic(name="/run_tests", msg_type="Bool")robot_command: Control command.
DefaultTopic(name="/cmd_vel", msg_type="Twist")
Output Topics:
command: Control Command
DefaultTopic(name="/control", msg_type="Twist")
Note
Topic for ‘Control Command’ is both in MotionServer inputs and outputs:
The output is used when running automated testing (i.e. sending the commands directly from the MotionServer).
The input is used to purely record motion and control from external sources (example: recording output from Controller).
Different command topics can be configured for the input and the output. For example: to test the DriveManager, the control command from MotionServer output can be sent to the DriveManager, then the DriveManager output can be configured as the MotionServer input for recording.
Available Run Types:
Set directly from MotionServer ‘run_type’ property.
TIMED: Launches an automated test periodically after start.
EVENT: Launches automated testing when a trigger ir received on RUN input.
ACTIONSERVER: Offers a MotionRecording ROS action to record motion for location and control commands topics for given recording period.
Usage Example:
- custom_on_configure()¶
Component custom configuration method to set the core debug level
- init_variables() None¶
init_variables.
- main_action_callback(goal_handle: kompass_interfaces.action.MotionRecording.Goal) kompass_interfaces.action.MotionRecording.Result¶
Execute motion recording action
- Parameters:
goal_handle (MotionRecording.Goal) – Action goal
- Returns:
Action result
- Return type:
MotionRecording.Result
- run_motion_response_tests(msg, **_) None¶
Run a set of tests to record the robot motion response Used for robot model calibration
- generate_basic_ctr_tests(number_of_steps: int) List[Dict]¶
Generates a ser of basic tests
- Parameters:
number_of_steps (int) – Number of time steps in each test
- Returns:
Constructed tests
- Return type:
list[dict]
- send_test(test: numpy.ndarray, test_name: str, number_steps: int) bool¶
Send a new motion recording test to the robot cmd topic
- Parameters:
test (np.ndarray) – Set of control commands
test_name (str) – Name of the test
number_steps (int) – Test control time steps
- Returns:
Test processed
- Return type:
bool
- property robot: kompass.config.RobotConfig¶
Getter of robot config
- Returns:
Robot configuration
- Return type:
- property run_type: kompass.config.ComponentRunType¶
Component run type: Timed, ActionServer or Event
- Returns:
Timed, ActionServer or Server
- Return type:
str
- property inputs_keys: List[kompass.components.defaults.TopicsKeys]¶
Getter of component inputs key names that should be used in the inputs dictionary
- property outputs_keys: List[kompass.components.defaults.TopicsKeys]¶
Getter of component outputs key names that should be used in the inputs dictionary
- inputs(**kwargs)¶
Set component input streams (topics) : kwargs[topic_keyword]=Topic()
- outputs(**kwargs)¶
Set component output streams (topics)
- config_from_file(config_file: str)¶
Configure component from file
- Parameters:
config_file (str) – Path to file (yaml, json, toml)
- property odom_tf_listener: Optional[ros_sugar.tf.TFListener]¶
Gets a transform listener for Odometry (from odom to world)
- Returns:
- Return type:
- property scan_tf_listener: ros_sugar.tf.TFListener¶
Gets a transform listener for LaserScan (from scan to robot base)
- Returns:
- Return type:
- property depth_tf_listener: ros_sugar.tf.TFListener¶
Gets a transform listener for LaserScan (from scan to robot base)
- Returns:
- Return type:
- property pc_tf_listener: ros_sugar.tf.TFListener¶
Gets a transform listener for LaserScan (from scan to robot base)
- Returns:
- Return type:
- get_transform_listener(src_frame: str, goal_frame: str) ros_sugar.tf.TFListener¶
Gets a transform listener
- Parameters:
src_frame (str) – Source coordinates frame
goal_frame (str) – Goal coordinates frame
- Returns:
TF listener object
- Return type:
- in_topic_name(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[str, List[str], None]¶
Get the topic(s) name(s) corresponding to an input key name
- Parameters:
key (str) – Input key name
- Returns:
Topic(s) name(s)
- Return type:
Union[str, List[str], None]
- out_topic_name(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[str, List[str], None]¶
Get the topic(s) name(s) corresponding to an output key name
- Parameters:
key (str) – Output key name
- Returns:
Topic(s) name(s)
- Return type:
Union[str, List[str], None]
- get_in_topic(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[kompass.components.ros.Topic, List[kompass.components.ros.Topic], None]¶
Get the topic(s) corresponding to an input key name
- get_out_topic(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[kompass.components.ros.Topic, List[kompass.components.ros.Topic], None]¶
Get the topic(s) corresponding to an output key name
- get_callback(key: Union[str, kompass.components.defaults.TopicsKeys], idx: int = 0) Optional[kompass.callbacks.GenericCallback]¶
Get callback with given input key name
- Parameters:
key (str) – Input key name
idx (int, optional) – Index of the input of multiple inputs correspond to the same key, defaults to 0
- Raises:
KeyError – If key is not found in component inputs
- Returns:
Callback object
- Return type:
- get_publisher(key: Union[str, kompass.components.defaults.TopicsKeys], idx: int = 0) ros_sugar.io.Publisher¶
Get publisher with given output key name
- Parameters:
key (str) – Output topic key name
idx (int, optional) – Index of the output of multiple inputs correspond to the same key, defaults to 0
- Raises:
KeyError – If key is not found in component outputs
- Returns:
Publisher object
- Return type:
- callbacks_inputs_check(inputs_to_check: Optional[List[str]] = None, inputs_to_exclude: Optional[List[str]] = None) bool¶
Check that all node inputs are provided before executing callback