src/conntact/assembly_tools.py
def swap_pose_tf(input:PoseStamped, child_frame:String) -> TransformStamped:
        """Swaps pose for tf and vice-versa.
        :param input: (geometry_msgs.PoseStamped or geometry_msgs.TransformStamped) Input data type.
        :param child_frame: (string) Child frame name if converting Pose to Transform.
        :return: (geometry_msgs.TransformStamped or geometry_msgs.PoseStamped) Output data, of the other type from input.
        """
        if('PoseStamped' in str(type(input))):
            output = TransformStamped()
            output.header = input.header
            # output.transform = input.pose
            [output.transform.translation.x, output.transform.translation.y, output.transform.translation.z] = [input.pose.position.x, input.pose.position.y, input.pose.position.z]
            output.transform.rotation   = input.pose.orientation  

            output.child_frame_id = child_frame
            return output
        else:
            if('TransformStamped' in str(type(input))):
                output = PoseStamped()
                output.header = input.header
                output.pose = input.transform
                return output
        rospy.logerr("Invalid input to swap_pose_tf !!!")
Swaps pose for tf and vice-versa.
        :param input: (geometry_msgs.PoseStamped or geometry_msgs.TransformStamped) Input data type.
        :param child_frame: (string) Child frame name if converting Pose to Transform.
        :return: (geometry_msgs.TransformStamped or geometry_msgs.PoseStamped) Output data, of the other type from input.
        
Swaps pose for tf and vice-versa.
Swaps pose for tf and vice - versa .
def swap_pose_tf(input:PoseStamped, child_frame:String) -> TransformStamped:
        if('PoseStamped' in str(type(input))):
            output = TransformStamped()
            output.header = input.header
            [output.transform.translation.x, output.transform.translation.y, output.transform.translation.z] = [input.pose.position.x, input.pose.position.y, input.pose.position.z]
            output.transform.rotation   = input.pose.orientation  
            output.child_frame_id = child_frame
            return output
        else:
            if('TransformStamped' in str(type(input))):
                output = PoseStamped()
                output.header = input.header
                output.pose = input.transform
                return output
        rospy.logerr("Invalid input to swap_pose_tf !!!")
def swap_pose_tf ( input : PoseStamped , child_frame : String ) -> TransformStamped : if ( 'PoseStamped' in str ( type ( input ) ) ) : output = TransformStamped ( ) output . header = input . header [ output . transform . translation . x , output . transform . translation . y , output . transform . translation . z ] = [ input . pose . position . x , input . pose . position . y , input . pose . position . z ] output . transform . rotation = input . pose . orientation output . child_frame_id = child_frame return output else : if ( 'TransformStamped' in str ( type ( input ) ) ) : output = PoseStamped ( ) output . header = input . header output . pose = input . transform return output rospy . logerr ( "Invalid input to swap_pose_tf !!!" )
Swaps pose for tf and vice-versa.
Swaps pose for tf and vice - versa .
"""Swaps pose for tf and vice-versa.
        :param input: (geometry_msgs.PoseStamped or geometry_msgs.TransformStamped) Input data type.
        :param child_frame: (string) Child frame name if converting Pose to Transform.
        :return: (geometry_msgs.TransformStamped or geometry_msgs.PoseStamped) Output data, of the other type from input.
        """ # output.transform = input.pose
(geometry_msgs.TransformStamped or geometry_msgs.PoseStamped) Output data, of the other type from input.
( geometry_msgs . TransformStamped or geometry_msgs . PoseStamped ) Output data of the other type from input .
input
PoseStamped
(geometry_msgs.PoseStamped or geometry_msgs.TransformStamped) Input data type.
( geometry_msgs . PoseStamped or geometry_msgs . TransformStamped ) Input data type .
child_frame
String
(string) Child frame name if converting Pose to Transform.
( string ) Child frame name if converting Pose to Transform .