Browse Source

Includefurther details in the comments.

noetic
Alan G. Sanchez 2 years ago
parent
commit
8faa63ead4
6 changed files with 23 additions and 23 deletions
  1. +1
    -1
      example_11.md
  2. +2
    -2
      example_12.md
  3. +9
    -6
      example_9.md
  4. +1
    -6
      src/aruco_tag_locator.py
  5. +1
    -1
      src/pointcloud_transformer.py
  6. +9
    -7
      src/voice_teleoperation_base.py

+ 1
- 1
example_11.md View File

@ -93,7 +93,7 @@ class PointCloudTransformer:
:param self: The self reference.
:param msg: The PointCloud message.
:returns new_cloud: PointCloud message.
:returns new_cloud: The transformed PointCloud message.
"""
while not rospy.is_shutdown():
try:

+ 2
- 2
example_12.md View File

@ -148,7 +148,7 @@ class LocateArUcoTag(hm.HelloNode):
:param self: The self reference.
:param tag_name: A string value of the ArUco marker name.
:returns transform: A TransformStamped message type.
:returns transform: The docking station's TransformStamped message.
"""
pan_command = {'joint': 'joint_head_pan', 'position': self.min_pan_position}
self.send_command(pan_command)
@ -325,7 +325,7 @@ def find_tag(self, tag_name='docking_station'):
:param self: The self reference.
:param tag_name: A string value of the ArUco marker name.
:returns transform: A TransformStamped message type.
:returns transform: The docking station's TransformStamped message.
"""
pan_command = {'joint': 'joint_head_pan', 'position': self.min_pan_position}
self.send_command(pan_command)

+ 9
- 6
example_9.md View File

@ -98,16 +98,17 @@ class GetVoiceCommands:
def callback_direction(self, msg):
"""
A callback function that converts the sound direction from degrees to radians.
A callback function that converts the incoming message, sound direction,
from degrees to radians.
:param self: The self reference.
:param msg: The Int32 message type.
:param msg: The Int32 message type that represents the sound direction.
"""
self.sound_direction = msg.data * -self.rad_per_deg
def callback_speech(self,msg):
"""
A callback function that takes all items in the iterable list and join
them into a single string.
A callback function takes the incoming message, a list of the speech to
text, and joins all items in that iterable list into a single string.
:param self: The self reference.
:param msg: The SpeechRecognitionCandidates message type.
"""
@ -119,7 +120,7 @@ class GetVoiceCommands:
base motion.
:param self:The self reference.
:returns inc: A dictionary type.
:returns inc: A dictionary type the contains the increment size.
"""
if self.step_size == 'small':
inc = {'rad': self.small_rad, 'translate': self.small_translate}
@ -159,7 +160,7 @@ class GetVoiceCommands:
A function that defines the teleoperation command based on the voice command.
:param self: The self reference.
:returns command: A dictionary type.
:returns command: A dictionary type that contains the type of base motion.
"""
command = None
if self.voice_command == 'forward':
@ -192,6 +193,7 @@ class VoiceTeleopNode(hm.HelloNode):
"""
A function that declares object from the GetVoiceCommands class, instantiates
the HelloNode class, and set the publishing rate.
:param self: The self reference.
"""
hm.HelloNode.__init__(self)
self.rate = 10.0
@ -370,6 +372,7 @@ class VoiceTeleopNode(hm.HelloNode):
"""
A function that declares object from the GetVoiceCommands class, instantiates
the HelloNode class, and set the publishing rate.
:param self: The self reference.
"""
hm.HelloNode.__init__(self)
self.rate = 10.0

+ 1
- 6
src/aruco_tag_locator.py View File

@ -65,7 +65,6 @@ class LocateArUcoTag(hm.HelloNode):
# Define the head actuation rotational velocity
self.rot_vel = 0.5 # radians per sec
def joint_states_callback(self, msg):
"""
A callback function that stores Stretch's joint states.
@ -74,7 +73,6 @@ class LocateArUcoTag(hm.HelloNode):
"""
self.joint_state = msg
def send_command(self, command):
'''
Handles single joint control commands by constructing a FollowJointTrajectoryGoal
@ -125,7 +123,6 @@ class LocateArUcoTag(hm.HelloNode):
self.trajectory_client.send_goal(trajectory_goal)
self.trajectory_client.wait_for_result()
def find_tag(self, tag_name='docking_station'):
"""
A function that actuates the camera to search for a defined ArUco tag
@ -133,7 +130,7 @@ class LocateArUcoTag(hm.HelloNode):
:param self: The self reference.
:param tag_name: A string value of the ArUco marker name.
:returns transform: A TransformStamped message type.
:returns transform: The docking station's TransformStamped message.
"""
# Create dictionaries to get the head in its initial position
pan_command = {'joint': 'joint_head_pan', 'position': self.min_pan_position}
@ -177,7 +174,6 @@ class LocateArUcoTag(hm.HelloNode):
# Notify that the requested tag was not found
rospy.loginfo("The requested tag '%s' was not found", tag_name)
def main(self):
"""
Function that initiates the issue_command function.
@ -203,7 +199,6 @@ class LocateArUcoTag(hm.HelloNode):
# Search for the ArUco marker for the docking station
pose = self.find_tag("docking_station")
if __name__ == '__main__':
# Use a try-except block
try:

+ 1
- 1
src/pointcloud_transformer.py View File

@ -74,7 +74,7 @@ class PointCloudTransformer:
:param self: The self reference.
:param msg: The PointCloud message.
:returns new_cloud: PointCloud message.
:returns new_cloud: The transformed PointCloud message.
"""
while not rospy.is_shutdown():
try:

+ 9
- 7
src/voice_teleoperation_base.py View File

@ -69,16 +69,17 @@ class GetVoiceCommands:
def callback_direction(self, msg):
"""
A callback function that converts the sound direction from degrees to radians.
A callback function that converts the incoming message, sound direction,
from degrees to radians.
:param self: The self reference.
:param msg: The Int32 message type.
:param msg: The Int32 message type that represents the sound direction.
"""
self.sound_direction = msg.data * -self.rad_per_deg
def callback_speech(self,msg):
"""
A callback function that takes all items in the iterable list and join
them into a single string.
A callback function takes the incoming message, a list of the speech to
text, and joins all items in that iterable list into a single string.
:param self: The self reference.
:param msg: The SpeechRecognitionCandidates message type.
"""
@ -90,7 +91,7 @@ class GetVoiceCommands:
base motion.
:param self:The self reference.
:returns inc: A dictionary type.
:returns inc: A dictionary type the contains the increment size.
"""
if self.step_size == 'small':
inc = {'rad': self.small_rad, 'translate': self.small_translate}
@ -130,7 +131,7 @@ class GetVoiceCommands:
A function that defines the teleoperation command based on the voice command.
:param self: The self reference.
:returns command: A dictionary type.
:returns command: A dictionary type that contains the type of base motion.
"""
command = None
# Move base forward command
@ -181,6 +182,7 @@ class VoiceTeleopNode(hm.HelloNode):
"""
A function that declares object from the GetVoiceCommands class, instantiates
the HelloNode class, and set the publishing rate.
:param self: The self reference.
"""
hm.HelloNode.__init__(self)
self.rate = 10.0
@ -200,7 +202,7 @@ class VoiceTeleopNode(hm.HelloNode):
"""
Function that makes an action call and sends base joint trajectory goals.
:param self: The self reference.
:param command: A dictionary type.
:param command: A dictionary that contains the base motion type and increment size.
"""
joint_state = self.joint_state
# Conditional statement to send joint trajectory goals

Loading…
Cancel
Save