Try   HackMD
tags: ROSKY2 ROS2 Jetson Nano reComputer-J1010 lidar detection

CH 3: ROSKY2 - Detect distance with lidar

In this note, user will use lidar to detect distance of specific direction

Hardware user have to prepare before doing

  1. ROSKY2
  2. A host machine with the operating system is Window 10(above) or Ubuntu.

Some things user should know before operating

Please check the note and documentation below:

Now let’s go ahead to use lidar.


Step 1. Open Terminator in ROSKY2 through remote desktop

Step 1-1. Open terminal on the remote desktop

Because of the keyboard shortcut keys in NoMachine, user can not use the keyboard keys 【ctrl】+【alt】+【T】to open the terminal quickly.

Please right-click the mouse on the remote desktop to open the menu item and then choose【Open Terminal】to open terminal.

Once user see the roe_menu is shown on the terminal, please choose【2】to start the operating environment for ROSKY2.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Step 1-2. Open terminator on the remote desktop

Terminator is a nice terminal emulator, please check the Terminator’s documentation to know more detail.

User can type the command command to start terminator:

$ terminator

Once start the terminator successfully, user can see ros_menu is shown on the terminator. Like the operation in step 1-1, user have to choose [2] to start the environment for ROSKY2.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

More keyboard shortcut in the terminator user can find on the Terminator’s documentation - Using the keyboard.

Step 2. Start the communication with all sensors, motor control board and more on ROSKY2

Now user just running the system on the SBC and it can not send/receive data from sensor and more. Hence, user have to start the communication with these to send/receive data.

Note
Seneors on ROSKY2 will start running after typing the command below. Please make sure no more things result in stopping these sensor work, such as something is on the LiDAR, transfer cable connect between host machine and ROSKY2 and more.

Please type the command below in the terminator to start the communication:

$ ros2 launch rosky2_bringup bringup.launch.py

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Step 3. Run node "detect_distance"

Awesome! User start the communication between ROSKY2 and sensors. Now user can see lidar is rotating now.

From Step 1-2 in this note, user can know that use the keyboard shortcut 【ctrl】+【shift】+【E】 in terminator to split terminal vertically. The same thing is choosing 【2】 to start the environment for ROSKY2 after user opening ros_menu successfully.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Now is ready to detect the distance from specific direction, please type the command below in terminal to start the node "detect_distance":

$ ros2 run wall_follower detect_distance --ros-args -r /detect_distance/scan:=/scan

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

After running successfully, user can see the distance form the direction "BACK":

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Please feel free to put something behind ROSKY2 and then check what the information happen on the terminal.

Step 4. Change direction to detect distance

If user want to chang the direction to detect distance, please use the keyboard shortcut 【ctrl】+【shift】+【O】in terminator to split terminal horizontally and choose【2】to start the environment for ROSKY2 after user opening ros_menu successfully.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Next, please type the command below to call the ROS2 service "/detect_distance/update_direction" for changing the direction detect:

$ ros2 service call /detect_distance/update_direction rosky2_interfaces/srv/DirectionUpdate "{data: [direction]}"

Note
User have to type the direction to replace [direction]. Until now, just these direction can use: back, right, front, left.

Below the image is the example that change the direction from back to front:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

And user can find infromation change from "BACK" to "FRONT" in the window that the node "detect_distance" running.

Step 5. Shutdown all running node.

If user finished the keyboard teleop for ROSKY2, please remember to shutdown all running node through the shortcut key 【ctrl】+【C】 in terminal.

Next

User can continue the note -> CH4: wall_fallower

Please have fun to use ROSKY2 :)