Skip to content

Commit

Permalink
Use AMCL for navigation, minor update to some xacro files
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoobInventor committed Oct 16, 2023
1 parent 42f556c commit bd81ee4
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 45 deletions.
51 changes: 32 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -666,36 +666,49 @@ Drive around the environment to generate a map:

Then save the generated map.

TODO: Need to change slam_toolbox ROS parameter mode to `mapping` in `mapper_params_online_async.yaml` in `lidarbot_slam/config`. Show a snippet of the code and what needs to be changed for mapping. Same thing applies for localization

Prop robot and show different odometry movements in rviz. Then show the robot response when on the 'ground'
## Navigation

### Gazebo

TODO:
```
# ROS Parameters
odom_frame: odom
map_frame: map
base_frame: base_footprint
scan_topic: /scan
use_map_saver: true
mode: localization #mapping
Nav2's amcl package is used for localization with the map generated from slam_toolbox

# if you'd like to immediately start continuing a map at a given pose
# or at the dock, but they are mutually exclusive, if pose is given
# will use pose
map_file_name: /home/noobinventor/lidarbot_ws/src/lidarbot_navigation/maps/sim_map
#map_start_pose: [0.0, 0.0, 0.0]
map_start_at_dock: true
```
ros2 launch lidarbot_gazebo gazebo_launch.py
```

TODO: Note about the option of using AMCL for localization using nav2's localization launch file. Currently using slam_toolbox for localization
Note map location and name

```
ros2 launch nav2_bringup localization_launch.py map:=./sim_map.yaml use_sim_time:=true
```

```
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=true map_subscribe_transient_local:=true
```

```
rviz2 -d src/lidarbot_navigation/rviz/lidarbot_nav.rviz
```
### Lidarbot

Change `map_file_name` key to use real map
TODO: Prop robot and show different odometry movements in rviz. Then show the robot response when on the 'ground'

```
ros2 launch lidarbot_bringup lidarbot_bringup_launch.py
```

```
ros2 launch nav2_bringup localization_launch.py map:=./real_map.yaml use_sim_time:=false
```

```
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=false map_subscribe_transient_local:=true
```

```
rviz2 -d src/lidarbot_navigation/rviz/lidarbot_nav.rviz
```

## Acknowledgment

Expand Down
2 changes: 1 addition & 1 deletion lidarbot_description/urdf/gazebo_control.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<odometry_frame>odom</odometry_frame>
<robot_base_frame>base_footprint</robot_base_frame>
<publish_odom>true</publish_odom>
<publish_odom_tf>false</publish_odom_tf>
<publish_odom_tf>true</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>

</plugin>
Expand Down
1 change: 1 addition & 0 deletions lidarbot_description/urdf/imu.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<gazebo reference="imu_link">
<sensor name="mpu6050_imu" type="imu">
<plugin name="imu_controller" filename="libgazebo_ros_imu_sensor.so">
<frame_name>imu_link</frame_name>
<ros>
<remapping>~/out:=imu_broadcaster/imu</remapping>
</ros>
Expand Down
2 changes: 1 addition & 1 deletion lidarbot_description/urdf/lidarbot_core.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<xacro:property name="wheel_height" value="0.025"/>
<xacro:property name="wheel_mass" value="0.031"/>

<!-- Distance between centre of wheel and robot base/base -->
<!-- Distance between centre of wheel and robot base -->
<xacro:property name="wheel_zoff" value="0.0125"/>

<link name="base_footprint"/>
Expand Down
8 changes: 0 additions & 8 deletions lidarbot_gazebo/launch/gazebo_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ def generate_launch_description():
executable='spawner',
arguments=['diff_controller'])

# Spawn imu_sensor_broadcaser
start_imu_broadcaster_cmd = Node(
condition=IfCondition(use_ros2_control),
package='controller_manager',
executable='spawner',
arguments=['imu_broadcaster'])

# Spawn joint_state_broadcaser
start_joint_broadcaster_cmd = Node(
condition=IfCondition(use_ros2_control),
Expand Down Expand Up @@ -129,7 +122,6 @@ def generate_launch_description():
ld.add_action(start_spawner_cmd)
ld.add_action(start_diff_controller_cmd)
ld.add_action(start_joint_broadcaster_cmd)
ld.add_action(start_imu_broadcaster_cmd)
ld.add_action(start_robot_localization_cmd)
ld.add_action(start_joystick_cmd)
ld.add_action(start_twist_mux_cmd)
Expand Down
26 changes: 13 additions & 13 deletions lidarbot_navigation/rviz/lidarbot_nav.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Panels:
Property Tree Widget:
Expanded:
- /Odometry2/Shape1
- /Map2
- /Map2/Status1
- /Map2/Topic1
Splitter Ratio: 0.5
Tree Height: 495
Tree Height: 381
- Class: rviz_common/Selection
Name: Selection
- Class: rviz_common/Tool Properties
Expand Down Expand Up @@ -182,7 +183,7 @@ Visualization Manager:
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Max Intensity: 47
Max Intensity: 0
Min Color: 0; 0; 0
Min Intensity: 0
Name: LaserScan
Expand Down Expand Up @@ -215,7 +216,6 @@ Visualization Manager:
Value: /camera/image_raw
Value: false
Visibility:
"": true
Grid: true
LaserScan: true
Map: true
Expand Down Expand Up @@ -331,7 +331,7 @@ Visualization Manager:
Name: Map
Topic:
Depth: 5
Durability Policy: Volatile
Durability Policy: Transient Local
Filter size: 10
History Policy: Keep Last
Reliability Policy: Reliable
Expand Down Expand Up @@ -390,7 +390,7 @@ Visualization Manager:
Value: true
Views:
Current:
Angle: 0.005000018514692783
Angle: -1.5649993419647217
Class: rviz_default_plugins/TopDownOrtho
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Expand All @@ -400,23 +400,23 @@ Visualization Manager:
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Scale: 151.76046752929688
Scale: 96.04316711425781
Target Frame: <Fixed Frame>
Value: TopDownOrtho (rviz_default_plugins)
X: 1.487661600112915
Y: -0.19905652105808258
X: 0.33311280608177185
Y: -2.180479049682617
Saved: ~
Window Geometry:
Camera:
collapsed: false
Displays:
collapsed: false
Height: 1043
Height: 1016
Hide Left Dock: false
Hide Right Dock: false
Navigation 2:
collapsed: false
QMainWindow State: 000000ff00000000fd000000040000000000000217000003b9fc020000000bfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000027a000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00430061006d006500720061000000032a000000cc0000002800fffffffb000000220053006c0061006d0054006f006f006c0062006f00780050006c007500670069006e0000000271000001850000018500fffffffb00000018004e0061007600690067006100740069006f006e0020003201000002bd000001390000013900ffffff000000010000010f000003b9fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000003b9000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d006501000000000000045000000000000000000000044e000003b900000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd0000000400000000000002170000039efc020000000bfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d00000208000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00430061006d006500720061000000032a000000cc0000002800fffffffb000000220053006c0061006d0054006f006f006c0062006f00780050006c007500670069006e0000000271000001850000018500fffffffb00000018004e0061007600690067006100740069006f006e00200032010000024b000001900000012600ffffff000000010000010f0000039efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d0000039e000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d006501000000000000045000000000000000000000044e0000039e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
SlamToolboxPlugin:
Expand All @@ -426,5 +426,5 @@ Window Geometry:
Views:
collapsed: false
Width: 1920
X: 1920
Y: 0
X: 0
Y: 27
6 changes: 3 additions & 3 deletions lidarbot_slam/config/mapper_params_online_async.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ slam_toolbox:
base_frame: base_footprint
scan_topic: /scan
use_map_saver: true
mode: localization #mapping
mode: mapping #localization

# if you'd like to immediately start continuing a map at a given pose
# or at the dock, but they are mutually exclusive, if pose is given
# will use pose
map_file_name: /home/noobinventor/lidarbot_ws/src/lidarbot_navigation/maps/library_serial
# map_file_name: /home/noobinventor/lidarbot_ws/src/lidarbot_navigation/maps/library_serial
#map_file_name: /home/noobinventor/lidarbot_ws/src/lidarbot_navigation/maps/real_map
#map_file_name: /home/noobinventor/lidarbot_ws/src/lidarbot_navigation/maps/sim_map
# map_start_pose: [0.0, 0.0, 0.0]
map_start_at_dock: true
#map_start_at_dock: true

debug_logging: false
throttle_scans: 1
Expand Down

0 comments on commit bd81ee4

Please sign in to comment.