Skip to content
Draft
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
2 changes: 2 additions & 0 deletions CustomRobots/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ install(
Turtlebot2/turtlebot2_simulated/turtlebot2/launch
Turtlebot2/turtlebot2_simulated/turtlebot2/rviz
Turtlebot2/turtlebot2_simulated/turtlebot2/urdf
Turtlebot2/Turtlebot2_physical/kobuki_launch/config
Turtlebot2/Turtlebot2_physical/kobuki_launch/launch
# F1
f1/models
f1/params
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,65 @@
# Setup Kobuki base

1. Download Kobuki_base repositories with drivers and utils inside your workspace (inside src directory):
~~~

```
vcs import < /kobuki_instructions/repos
~~~
```

2. Ensure you have all dependencies:
~~~

```
cd <workspace_root> && rosdep install --from-paths src --ignore-src -r -y
~~~
```

3. Build workspace:
~~~

```
cd <workspace_root> && colcon_build --symlink-install
~~~
```

4. Source workspace:
~~~

```
source <workspace_root>/install/setup.bash
~~~
```

#

## Try Kobuki

Connect serial cable to the Robot and **Switch Kobuki ON**.

Kobuki’s default means of communication is over usb (it can instead use the serial comm port directly, more on that later). On most linux systems, your Kobuki will appear on /dev/ttyUSBO as soon as you connect the cable. This is a typical serial2usb device port and if you happen to be using more than one such device, Kobuki may appear at ttyUSB1, ttyUSB1, …
~~~

```
ls /dev/ttyUSB0
~~~
```

In order to provide a constant identifier for the connection, use the udev rule prepared in kobuki_ftdi:
~~~

```
sudo cp <workspace_root>/src/kobuki_ftdi/60-kobuki.rules /etc/udev/rules.d
sudo service udev reload
sudo service udev restart
~~~
```

Check for existance of `/dev/kobuki`
~~~

```
ls /dev/kobuki
~~~
```

Does kobuki appear as USB device?
~~~

```
lsusb
0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
~~~
```

Do you see it in dmesg when you insert the usb cable?
~~~

```
dmesg
[ 118.984126] usb 3-1: new full-speed USB device number 5 using xhci_hcd
[ 119.139253] usb 3-1: New USB device found, idVendor=0403, idProduct=6001
Expand All @@ -59,36 +74,64 @@ dmesg
[ 119.152505] ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected
[ 119.152530] usb 3-1: Detected FT232RL
[ 119.152665] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0
~~~
```

and when you remove it?
~~~

```
dmesg
[ 184.386124] usb 3-1: USB disconnect, device number 5
[ 184.386507] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 184.386547] ftdi_sio 3-1:1.0: device disconnected
~~~
```

Get the serial number:

~~~
```
sudo <workspace>/install/kobuki_ftdi/lib/kobuki_ftdi/get_serial_number
1 device(s) found.

Device #0
Manufacturer : Yujin Robot
Product : iClebo Kobuki
Serial Number: kobuki_A505QO28
~~~

```

Finally try to move Kobuki robot:

1. Launch Kobuki_node with specific configuration ( provided inside kobuki_launch package):
~~~

```
ros2 launch kobuki_launch kobuki_base.launch.py
# check that ros topics appear:
ros2 topic list
# teleoperate robot:
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap /cmd_vel:=/commands/velocity
~~~
```

_Change topic names if necessary inside kobuki_ros/kobuki_node/src/kobuki_ros.cpp_

*Change topic names if necessary inside kobuki_ros/kobuki_node/src/kobuki_ros.cpp*
cd /home/ws
apt install ros-humble-image-geometry libuvc-dev nlohmann-json3-dev
apt install ros-humble-diagnostic-updater
apt install ros-humble-image-publisher
cd src/CustomRobots/Turtlebot2/Turtlebot2_physical
vcs import < kobuki_instructions/repos
cd ..
cd ..
rosdep install --from-paths src --ignore-src -r -y
cd src/CustomRobots/
cd Turtlebot2/Turtlebot2_physical/
mv ecl ../../../ecl
mv kobuki_core ../../../kobuki_core
mv kobuki_ftdi ../../../kobuki_ftdi
mv kobuki_ros ../../../kobuki_ros
mv kobuki_iterfaces ../../../kobuki_iterfaces
mv kobuki_ros_iterfaces ../../../kobuki_ros_iterfaces
mv sophus ../../../sophus
cd ../../..
colcon build --symlink-install --packages-ignore kobuki_ftdi
cd src
git clone https://github.com/Juancams/ros_astra_camera.git
cd ..
colcon build --symlink-install --packages-ignore kobuki_ftdi
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from launch import LaunchDescription
from launch_ros.actions import Node
import yaml
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():
shared_dir = get_package_share_directory("kobuki_launch")
shared_dir = FindPackageShare(package="custom_robots").find("custom_robots")

params_file = os.path.join(shared_dir, "config", "kobuki_node_params.yaml")
with open(params_file, "r") as f:
Expand Down
119 changes: 119 additions & 0 deletions Launchers/follow_person_real.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import os
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.conditions import IfCondition, UnlessCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import Command, LaunchConfiguration, PythonExpression
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():

# Set the path to the Gazebo ROS package
pkg_gazebo_ros = FindPackageShare(package="gazebo_ros").find("gazebo_ros")

# Set the path to the Turtlebot2 ROS package
pkg_share_dir = FindPackageShare(package="custom_robots").find("custom_robots")

# Set Turtlebot2 Arguments
x_turtlebot2_position = "0"
y_turtlebot2_position = "10"
z_turtlebot2_position = "0"

declare_x_position_cmd = DeclareLaunchArgument(
"-x",
default_value=x_turtlebot2_position,
description="Position on the axis x of Turtlebot2",
)
declare_y_position_cmd = DeclareLaunchArgument(
"-y",
default_value=y_turtlebot2_position,
description="Position on the axis y of Turtlebot2",
)
declare_z_position_cmd = DeclareLaunchArgument(
"-z",
default_value=z_turtlebot2_position,
description="Position on the axis z of Turtlebot2",
)

world_file_name = "hospital_follow_person.world"
worlds_dir = "/opt/jderobot/Worlds"
world_path = os.path.join(worlds_dir, world_file_name)

# Set the path to the SDF model files
gazebo_models_path = os.path.join(pkg_share_dir, "models")
os.environ["GAZEBO_MODEL_PATH"] = (
f"{os.environ.get('GAZEBO_MODEL_PATH', '')}:{':'.join(gazebo_models_path)}"
)

########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ##############
# Launch configuration variables specific to simulation
headless = LaunchConfiguration("headless")
use_sim_time = LaunchConfiguration("use_sim_time")
use_simulator = LaunchConfiguration("use_simulator")
world = LaunchConfiguration("world")

declare_simulator_cmd = DeclareLaunchArgument(
name="headless",
default_value="False",
description="Whether to execute gzclient",
)

declare_use_sim_time_cmd = DeclareLaunchArgument(
name="use_sim_time",
default_value="False",
description="Use simulation (Gazebo) clock if true",
)

declare_use_simulator_cmd = DeclareLaunchArgument(
name="use_simulator",
default_value="False",
description="Whether to start the simulator",
)

declare_world_cmd = DeclareLaunchArgument(
name="world",
default_value=world_path,
description="Full path to the world model file to load",
)

# Specify the actions

# Start Gazebo server
start_gazebo_server_cmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_gazebo_ros, "launch", "gzserver.launch.py")
),
condition=IfCondition(use_simulator),
launch_arguments={"world": world, "pause": "true"}.items(),
)

start_turtlebot2_cmd = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_share_dir, "launch", "kobuki_base.launch.py")
),
launch_arguments={
"-x": x_turtlebot2_position,
"-y": y_turtlebot2_position,
"-z": z_turtlebot2_position,
}.items(),
)

# Create the launch description and populate
ld = LaunchDescription()

# Declare the launch options
ld.add_action(declare_simulator_cmd)
ld.add_action(declare_use_sim_time_cmd)
ld.add_action(declare_use_simulator_cmd)
ld.add_action(declare_world_cmd)
ld.add_action(declare_x_position_cmd)
ld.add_action(declare_y_position_cmd)
ld.add_action(declare_z_position_cmd)

# Add any actions
ld.add_action(start_gazebo_server_cmd)
ld.add_action(start_turtlebot2_cmd)

return ld
2 changes: 2 additions & 0 deletions database/universes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ COPY public.universes (id, name, world_id, robot_id) FROM stdin;
52 Montreal Circuit Classic 52 0
53 Nurburgring Circuit Classic 53 0
54 Vacuums House Roof Classic 54 0
55 Real Follow Person 55 0
\.


Expand Down Expand Up @@ -243,6 +244,7 @@ COPY public.worlds (id, name, launch_file_path, tools_config, ros_version, type,
52 Montreal Circuit Classic /opt/jderobot/Launchers/montreal_circuit_classic.launch.py None ROS2 gazebo {0.0,0.0,0.0,0.0,0.0,0.0}
53 Nurburgring Circuit Classic /opt/jderobot/Launchers/nurburgring_circuit_classic.launch.py None ROS2 gazebo {0.0,0.0,0.0,0.0,0.0,0.0}
54 Vacuums House Roof Classic /opt/jderobot/Launchers/montecarlo_visual_loc_classic.launch.py None ROS2 gazebo {0.0,0.0,0.0,0.0,0.0,0.0}
55 Real Follow Person /opt/jderobot/Launchers/follow_person_real.launch.py None ROS2 physical {0.0,0.0,0.0,0.0,0.0,0.0}
\.

--
Expand Down
Loading