Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation #8

Open
wants to merge 9 commits into
base: navigation
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ I had to change the turtlebot3 gazebo sim to run with no gui (slow computer). I

1. Copy the file
```
cp `rospack find turtlebot3_gazebo`/launch/turtlebot3_world.launch `rospack find mybot_gazebo`/launch
cp `` `rospack find turtlebot3_gazebo` ``/launch/turtlebot3_world.launch `` `rospack find mybot_gazebo` ``/launch
```
2. Using your [favorite text editor](http://vim.org), edit `turtlebot3_world.launch` and add
`<arg name="gui" default="false"/>` below launch. Now change
Expand Down Expand Up @@ -82,7 +82,7 @@ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=/tmp/test
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
```

6. In rviz, send a few `2D Navigation Goals` (click on `2D Nav Goal and click/drag to set position/orientation) and watch the robot autonomously navigate to the goal.
6. In rviz, send a few `2D Navigation Goals` (click on ``2D Nav Goal`` and click/drag to set position/orientation) and watch the robot autonomously navigate to the goal.

Close all terminals, you are done with the turtlebot3 simulation.

Expand All @@ -105,7 +105,7 @@ to
```

2. Copy and modify `turtlebot3_slam.launch`
* cp ``rospack find turtlebot3_slam``/launch/turtlebot3_slam.launch ``rospack find mybot_navigation``/launch/mybot_slam.launch
* cp `` `rospack find turtlebot3_slam` ``/launch/turtlebot3_slam.launch `` `rospack find mybot_navigation` ``/launch/mybot_slam.launch
* change line 8-11 from:
```
<!-- TurtleBot3 -->
Expand All @@ -130,24 +130,32 @@ to
to match what turtlebot_slam expects.

4. In Terminal 1, launch the gazebo world
`roslaunch mybot_gazebo mybot_tb3_world.launch`
```
roslaunch mybot_gazebo mybot_tb3_world.launch
```

5. In Terminal 2, start map building (also starts rviz)
`roslaunch mybot_navigation mybot_slam.launch slam_methods:=gmapping`
```
roslaunch mybot_navigation mybot_slam.launch slam_methods:=gmapping
```

6. In Terminal 3, start teleop
`roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch`
```
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
```

### Saving the map
1. In Terminal 4, save the map to some file path
`rosrun map_server map_saver -f /tmp/test_map`
```
rosrun map_server map_saver -f /tmp/test_map
```

### Loading the map
Close all previous terminals and run the following commands below. Once loaded, use rviz to set navigation waypoints and the robot should move autonomously.

1. Copy and modify `turtlebot3_navigation.launch`

* cp `rospack find turtlebot3_navigation`/launch/turtlebot3_navigation.launch `rospack find mybot_navigation`/launch/turtlebot3_navigation.launch
* cp `` `rospack find turtlebot3_navigation` ``/launch/turtlebot3_navigation.launch `` `rospack find mybot_navigation` ``/launch/turtlebot3_navigation.launch
* change line 8-11 from:
```
<!-- TurtleBot3 -->
Expand All @@ -168,15 +176,21 @@ to
```

2. In Terminal 1, launch the Gazebo world
`roslaunch mybot_gazebo mybot_tb3_world.launch`
```bash
roslaunch mybot_gazebo mybot_tb3_world.launch
```

3. In Terminal 2, start navigating with the map (will start rviz too)
`roslaunch mybot_navigation mybot_navigation.launch map_file:=/tmp/test_map.yaml`
```
roslaunch mybot_navigation mybot_navigation.launch map_file:=/tmp/test_map.yaml
```

4. In rviz, estimate initial pose - click `2D Pose Estimate` and click the approximate location of the robot on the map, and drag to indicate the direction.

5. In Terminal 3, start teleop and move the robot around. The estimated positions should converge on the true position pretty quickly.
`roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch`
```
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
```

6. In rviz, send a few `2D Navigation Goals` (click on `2D Nav Goal and click/drag to set position/orientation) and watch the robot autonomously navigate to the goal.

Expand Down
7 changes: 3 additions & 4 deletions src/mybot_description/urdf/mybot.gazebo
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<updateRate>10</updateRate>
<leftJoint>left_wheel_hinge</leftJoint>
<rightJoint>right_wheel_hinge</rightJoint>
<wheelSeparation>0.4</wheelSeparation>
<wheelSeparation>0.25</wheelSeparation>
<wheelDiameter>0.2</wheelDiameter>
<torque>10</torque>
<wheelTorque>10</wheelTorque>
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
Expand All @@ -48,7 +48,6 @@
<material>Gazebo/Blue</material>
</gazebo>


<gazebo reference="camera">
<material>Gazebo/Green</material>
<sensor type="camera" name="camera1">
Expand Down Expand Up @@ -98,7 +97,7 @@
</horizontal>
</scan>
<range>
<min>0.10</min>
<min>0.20</min>
<max>30.0</max>
<resolution>0.01</resolution>
</range>
Expand Down
23 changes: 12 additions & 11 deletions src/mybot_description/urdf/mybot.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<xacro:property name="cameraMass" value="0.1"/>

<xacro:include filename="$(find mybot_description)/urdf/mybot.gazebo" />
<xacro:include filename="$(find mybot_description)/urdf/materials.xacro" />
<!-- <xacro:include filename="$(find mybot_description)/urdf/materials.xacro" /> -->
<xacro:include filename="$(find mybot_description)/urdf/macros.xacro" />


Expand All @@ -23,7 +23,7 @@
/>
</inertial>

<collision name='collision'>
<collision name='chassis_collision'>
<geometry>
<box size=".4 .2 .1"/>
</geometry>
Expand All @@ -36,11 +36,10 @@
</geometry>
</visual>


<collision name='caster_collision'>
<collision name='caster_rear_collision'>
<origin xyz="-0.15 0 -0.05" rpy=" 0 0 0"/>
<geometry>
<sphere radius="0.05"/>
<sphere radius="0.049"/>
</geometry>
<surface>
<friction>
Expand All @@ -54,17 +53,17 @@
</surface>
</collision>

<visual name='caster_visual'>
<visual name='caster_rear_visual'>
<origin xyz="-0.15 0 -0.05" rpy=" 0 0 0"/>
<geometry>
<sphere radius="0.05"/>
<sphere radius="0.049"/>
</geometry>
</visual>

<collision name='caster_front_collision'>
<origin xyz="0.15 0 -0.05" rpy=" 0 0 0"/>
<geometry>
<sphere radius="0.05"/>
<sphere radius="0.049"/>
</geometry>
<surface>
<friction>
Expand All @@ -81,27 +80,29 @@
<visual name='caster_front_visual'>
<origin xyz="0.15 0 -0.05" rpy=" 0 0 0"/>
<geometry>
<sphere radius="0.05"/>
<sphere radius="0.049"/>
</geometry>
</visual>

</link>


<link name="left_wheel">
<!--origin xyz="0.1 0.13 0.1" rpy="0 1.5707 1.5707"/-->

<collision name="collision">
<origin xyz="0 0 0" rpy="0 1.5707 1.5707"/>
<geometry>
<cylinder radius="0.1" length="0.05"/>
</geometry>
</collision>

<visual name="left_wheel_visual">
<origin xyz="0 0 0" rpy="0 1.5707 1.5707"/>
<geometry>
<cylinder radius="0.1" length="0.05"/>
</geometry>
</visual>

<inertial>
<origin xyz="0 0 0" rpy="0 1.5707 1.5707"/>
<mass value="5"/>
Expand Down Expand Up @@ -192,7 +193,7 @@

<joint name="hokuyo_joint" type="fixed">
<axis xyz="0 1 0" />
<origin xyz=".15 0 .1" rpy="0 0 0"/>
<origin xyz="0.15 0 .085" rpy="0 0 0"/>
<parent link="chassis"/>
<child link="hokuyo"/>
</joint>
Expand Down
2 changes: 1 addition & 1 deletion src/mybot_gazebo/launch/mybot_world.launch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<include file="$(find gazebo_ros)/launch/empty_world.launch">
<!--arg name="world_name" value="$(find mybot_gazebo)/worlds/mybot.world"/-->
<arg name="world_name" value="$(find mybot_gazebo)/worlds/turtlebot_playground.world"/>
<!-- <arg name="world_name" value="$(find mybot_gazebo)/worlds/turtlebot_playground.world"/> -->
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="gui" value="$(arg gui)"/>
Expand Down