<commit_before>import rospy

import geometry_msgs.msg


class PositionMixin:
    def __init__(self):
        # TODO: Select a more suitable initial value
        self.position = None
        self.orientation = None

        # Would be nice to use /mavros/position/local here, but ArduCopter doesn't
        # transmit the required POSITION_LOCAL_NED messages. Instead, mavros converts
        # the global coordinates passed via the POSITION_GLOBAL_INT message into UTM
        # coordinates, which can be used for local navigation assuming the drone
        # doesn't cross zone boundaries.
        rospy.Subscriber("/mavros/global_position/local",
                geometry_msgs.msg.PoseWithCovarianceStamped,
                self.handle_position_message)

    def handle_position_message(self, msg):
        """
        Handle mavros/global_position/local messages, published by the FCU at
        around 1 Hz.
        """
	pose = msg.pose.pose
        self.position = pose.position
        self.orientation = pose.orientation
<commit_msg>position: stream position telemetry at 50 Hz<commit_after>import rospy

import geometry_msgs.msg

from mavros.srv import StreamRate, StreamRateRequest


class PositionMixin:
    def __init__(self, stream_rate_hz=50):
        # TODO: Select a more suitable initial value
        self.position = None
        self.orientation = None

	# Request higher telemetry stream rate
	set_stream_rate = rospy.ServiceProxy("mavros/set_stream_rate", StreamRate)
	set_stream_rate(StreamRateRequest.STREAM_POSITION, stream_rate_hz, True)

        # Would be nice to use /mavros/position/local here, but ArduCopter doesn't
        # transmit the required POSITION_LOCAL_NED messages. Instead, mavros converts
        # the global coordinates passed via the POSITION_GLOBAL_INT message into UTM
        # coordinates, which can be used for local navigation assuming the drone
        # doesn't cross zone boundaries.
        rospy.Subscriber("/mavros/global_position/local",
                geometry_msgs.msg.PoseWithCovarianceStamped,
                self.handle_position_message)

    def handle_position_message(self, msg):
        """
        Handle mavros/global_position/local messages, published by the FCU at
        around 1 Hz.
        """
	pose = msg.pose.pose
        self.position = pose.position
        self.orientation = pose.orientation

{'fraction_non_alphanumeric': 0.06268405553218342, 'fraction_numerical': 0.002524190155658393, 'mean_word_length': 2.8919803600654665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '494505', 'n_tokens_mistral': 676, 'n_tokens_neox': 638, 'n_words': 193}