Browse Source

Fixed typos.

pull/14/head
Alan G. Sanchez 2 years ago
parent
commit
c055129d99
5 changed files with 47 additions and 12 deletions
  1. +3
    -3
      example_1.md
  2. +1
    -1
      example_2.md
  3. +21
    -3
      example_3.md
  4. +16
    -1
      example_4.md
  5. +6
    -4
      example_5.md

+ 3
- 3
example_1.md View File

@ -17,7 +17,7 @@ To drive the robot forward with the move node, type the following in a new termi
```bash
# Terminal 3
cd catkin_ws/src/stretch_ros_turotials/src/
cd catkin_ws/src/stretch_ros_tutorials/src/
python3 move.py
```
To stop the node from sending twist messages, type **Ctrl** + **c**.
@ -151,8 +151,8 @@ self.pub = rospy.Publisher('/stretch_diff_drive_controller/cmd_vel', Twist, queu
After saving the edited node, bringup [Stretch in the empty world simulation](gazebo_basics.md). To drive the robot with the node, type the follwing in a new terminal
```
cd catkin_ws/src/stretch_ros_turotials/src/
```bash
cd catkin_ws/src/stretch_ros_tutorials/src/
python3 move.py
```
To stop the node from sending twist messages, type **Ctrl** + **c**.

+ 1
- 1
example_2.md View File

@ -54,7 +54,7 @@ To filter the lidar scans for ranges that are directly in front of Stretch (widt
```bash
# Terminal 3
cd catkin_ws/src/stretch_ros_turotials/src/
cd catkin_ws/src/stretch_ros_tutorials/src/
python3 scan_filter.py
```

+ 21
- 3
example_3.md View File

@ -2,19 +2,22 @@
The aim of example 3 is to combine the two previous examples and have Stretch utilize its laser scan data to avoid collision with objects as it drives forward.
Begin by running `roscore` in a terminal. Then set the ros parameter to *navigation* mode by running the following commands in a new terminal.
Begin by running `roscore` in a terminal. Then set the ros parameter to *manipulation* mode by running the following commands in a new terminal.
```bash
rosparam set /stretch_driver/mode "navigation"
# Terminal 1
rosparam set /stretch_driver/mode "manipulation"
roslaunch stretch_core stretch_driver.launch
```
Then in a new terminal type the following to activate the LiDAR sensor.
```bash
# Terminal 2
roslaunch stretch_core rplidar.launch
```
To activate the avoider node, type the following in a new terminal.
```bash
cd catkin_ws/src/stretch_ros_turotials/src/
# Terminal 3
cd catkin_ws/src/stretch_ros_tutorials/src/
python3 avoider.py
```
To stop the node from sending twist messages, type **Ctrl** + **c** in the terminal running the avoider node.
@ -35,7 +38,15 @@ from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
class Avoider:
"""
A class that implements both a LaserScan filter and base velocity control
for collision avoidance.
"""
def __init__(self):
"""
Function that initializes the subscriber, publisher, and marker features.
:param self: The self reference
"""
self.pub = rospy.Publisher('/stretch/cmd_vel', Twist, queue_size=1) #/stretch_diff_drive_controller/cmd_vel for gazebo
self.sub = rospy.Subscriber('/scan', LaserScan, self.set_speed)
@ -52,6 +63,13 @@ class Avoider:
self.twist.angular.z = 0.0
def set_speed(self,msg):
"""
Callback function to deal with incoming laserscan messages.
:param self: The self reference.
:param msg: The subscribed laserscan message.
:publishes self.twist: Twist message.
"""
angles = linspace(msg.angle_min, msg.angle_max, len(msg.ranges))
points = [r * sin(theta) if (theta < -2.5 or theta > 2.5) else inf for r,theta in zip(msg.ranges, angles)]
new_ranges = [r if abs(y) < self.extent else inf for r,y in zip(msg.ranges, points)]

+ 16
- 1
example_4.md View File

@ -5,12 +5,14 @@
Let's bringup stretch in the willowgarage world from the [gazebo basics tutorial](gazebo_basics.md) and RViz by using the following command.
```bash
# Terminal 1
roslaunch stretch_gazebo gazebo.launch world:=worlds/willowgarage.world rviz:=true
```
the `rviz` flag will open an RViz window to visualize a variety of ROS topics. In a new terminal run the following commands to create a marker.
```bash
cd catkin_ws/src/stretch_ros_turotials/src/
# Terminal 2
cd catkin_ws/src/stretch_ros_tutorials/src/
python3 marker.py
```
The gif below demonstrates how to add a new *Marker* display type, and change the topic name from `visualization_marker` to `balloon`. A red sphere Marker should appear above the Stretch robot.
@ -26,7 +28,14 @@ import rospy
from visualization_msgs.msg import Marker
class Balloon():
"""
A class that attaches a Sphere marker directly above the Stretch robot.
"""
def __init__(self):
"""
Function that initializes the markers features.
:param self: The self reference
"""
self.publisher = rospy.Publisher('balloon', Marker, queue_size=10)
self.marker = Marker()
self.marker.header.frame_id = '/base_link'
@ -46,6 +55,12 @@ class Balloon():
self.marker.pose.position.z = 2.0
def publish_marker(self):
"""
Function that publishes the sphere marker
:param self: The self reference
:publishes self.marker: Marker message
"""
self.publisher.publish(self.marker)

+ 6
- 4
example_5.md View File

@ -1,15 +1,17 @@
## Example 5
![image]()
Begin by starting up the stretch driver launch file.
```bash
roslaunch stretch_gazebo gazebo.launch world:=worlds/willowgarage.world rviz:=true
# Terminal 1
roslaunch stretch_core stretch_driver.launch
```
```bash
cd catkin_ws/src/stretch_ros_turotials/src/
cd catkin_ws/src/stretch_ros_tutorials/src/
python3 marker.py
```
.
@ -131,7 +133,7 @@ The use of the `rospy.sleep()` function is to allow the *JSP* class to initializ
joints = ["joint_lift", "joint_arm_l0", "joint_wrist_yaw"]
JSP.print_states(joints)
```
Create a list of the desired joints that you want positions to be printed. Then use that list as an argument for the `print_states()` function.
Create a list of the desired joints that you want positions to be printed. Then use that list as an argument for the `print_states()` function.
```python
rospy.spin()

Loading…
Cancel
Save