Mobile Robot Control 2024 Ultron:Solution 1: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
(add solution of Nan)
Line 1: Line 1:
'''Exercise 1: the art of not crashing'''
==='''Exercise 1: the art of not crashing'''===


Hao:
[[File:Execise1 Hao.png|thumb|350px|right|Solution of Hao]]
 
====Solution of Hao====
#Boolean Flag:
#Boolean Flag:  
#*A boolean flag named 'move ' is used to control whether the robot should continue moving or stop.
#*A boolean flag named 'move ' is used to control whether the robot should continue moving or stop.
#* It is initialized to 'true', indicating that the robot is initially allowed to move.
#*It is initialized to 'true', indicating that the robot is initially allowed to move.
# Obstacle Detection:
#Obstacle Detection:
#*The program continuously reads laser sensor data inside the control loop.
#* The program continuously reads laser sensor data inside the control loop.
#*If any distance measurement from the laser scan is less than 0.2, an obstacle is detected.
#*If any distance measurement from the laser scan is less than 0.2, an obstacle is detected.
# Stopping Action:
#Stopping Action:  
#*When an obstacle is detected, the  'move ' flag is set to 'false'.
#*When an obstacle is detected, the  'move ' flag is set to 'false'.
#*Setting 'move ' to 'false'  indicates that the robot should stop moving.
#*Setting 'move ' to 'false'  indicates that the robot should stop moving.
Line 15: Line 15:
#Control Loop Condition:
#Control Loop Condition:
#*The control loop continues executing as long as the robot is properly connected 'io.ok()' and the  'move ' flag is 'true'.
#*The control loop continues executing as long as the robot is properly connected 'io.ok()' and the  'move ' flag is 'true'.
#*Once the 'move' flag is set to 'false' , the control loop stops executing, effectively halting the robot's motion.[[File:Execise1 Hao.png|thumb]]
#*Once the 'move' flag is set to 'false' , the control loop stops executing, effectively halting the robot's motion.
 
 
 
 
 
 
 
 
 
 
 


Chuyu:


[[File:Exercise1 Chuyu.png|thumb|350px|right|Solution of Chuyu]]
====Solution of Chuyu====
   Initialization:
   Initialization:


Line 53: Line 43:


       The loop continues executing as long as the robot is properly connected (io.ok() is true).
       The loop continues executing as long as the robot is properly connected (io.ok() is true).
[[File:Exercise1 Chuyu.png|thumb]]
 
       The loop also incorporates obstacle detection and stopping actions.
       The loop also incorporates obstacle detection and stopping actions.


[[File:Exercise1 Nan.png|350px|thumb|Solution of Nan]]


====Solution of Nan====


I defined a vector whose elements represent the distance of a "'''safe outer contour'''" from the LiDAR sensor in all directions that the sensor can detect. The robot stops immediately when this safe outer contour hits an object, i.e., when any element of the <code>emc::LaserData::rangs</code> vector is smaller than the corresponding element of the safe outer contour vector.


The "safe outer contour" is defined as the actual outer contour of the robot plus the safe braking distance of the robot in all directions. In the current implementation, this outer contour is simply set as a circle and it is assumed that the safe braking distance is the same in all directions and independent of speed, i.e., a segment of a circular arc centered on the sensor with a fixed value of radius. And after experimentation, the radius was set to 0.15 meters.


However, theoretically, the real outer contour data can be determined and a mapping model of speed and safe braking distance can be constructed. Thus, the accurate safe outer contour can be calculated at runtime.




Line 66: Line 61:




 
----
 
 
'''Exercise 2: Testing your don't crash'''
'''Exercise 2: Testing your don't crash'''


Hao
Hao  


# [[File:Exercise2-1 Hao.png|thumb]]In map1 the robot can stop as the designed purpose.
#[[File:Exercise2-1 Hao.png|thumb]]In map1 the robot can stop as the designed purpose.
# [[File:Exercise2-2 Hao.png|thumb]]In map2 the robot stopped when detected the wall on the right side with distance<=0.2
#[[File:Exercise2-2 Hao.png|thumb]]In map2 the robot stopped when detected the wall on the right side with distance<=0.2




Line 99: Line 92:




Chuyu:
Chuyu:    


# In map 1, the robot keeps moving and does not collide with obstacles
#In map 1, the robot keeps moving and does not collide with obstacles
# In map 2, the robot keeps moving and does not collide with obstacles
#In map 2, the robot keeps moving and does not collide with obstacles
[[File:Exercise2-1 Chuyu.png|thumb]]
[[File:Exercise2-1 Chuyu.png|thumb]]
[[File:Exercise2-2 Chuyu.png|thumb]]
[[File:Exercise2-2 Chuyu.png|thumb]]

Revision as of 21:43, 3 May 2024

Exercise 1: the art of not crashing

Solution of Hao

Solution of Hao

  1. Boolean Flag:
    • A boolean flag named 'move ' is used to control whether the robot should continue moving or stop.
    • It is initialized to 'true', indicating that the robot is initially allowed to move.
  2. Obstacle Detection:
    • The program continuously reads laser sensor data inside the control loop.
    • If any distance measurement from the laser scan is less than 0.2, an obstacle is detected.
  3. Stopping Action:
    • When an obstacle is detected, the 'move ' flag is set to 'false'.
    • Setting 'move ' to 'false' indicates that the robot should stop moving.
    • Additionally, a stop command 'io.sendBaseReference(0, 0, 0)' is sent to the base controller immediately after detecting the obstacle.
  4. Control Loop Condition:
    • The control loop continues executing as long as the robot is properly connected 'io.ok()' and the 'move ' flag is 'true'.
    • Once the 'move' flag is set to 'false' , the control loop stops executing, effectively halting the robot's motion.


Solution of Chuyu

Solution of Chuyu

   Initialization:

       The IO object initializes the io layer.

       The Rate object helps keep the loop at a fixed frequency.

   Obstacle Detection:

       Laser data is continuously read within the control loop.

       If any distance measurement from the laser scan is less than 0.5, an obstacle is detected.

   Stopping Action:

       If an obstacle is detected:

           Different actions are taken based on the distance to the obstacle.

           If the obstacle distance is less than 0.2, the robot stops.

   Control Loop Condition:

       The loop continues executing as long as the robot is properly connected (io.ok() is true).

       The loop also incorporates obstacle detection and stopping actions.

Solution of Nan

Solution of Nan

I defined a vector whose elements represent the distance of a "safe outer contour" from the LiDAR sensor in all directions that the sensor can detect. The robot stops immediately when this safe outer contour hits an object, i.e., when any element of the emc::LaserData::rangs vector is smaller than the corresponding element of the safe outer contour vector.

The "safe outer contour" is defined as the actual outer contour of the robot plus the safe braking distance of the robot in all directions. In the current implementation, this outer contour is simply set as a circle and it is assumed that the safe braking distance is the same in all directions and independent of speed, i.e., a segment of a circular arc centered on the sensor with a fixed value of radius. And after experimentation, the radius was set to 0.15 meters.

However, theoretically, the real outer contour data can be determined and a mapping model of speed and safe braking distance can be constructed. Thus, the accurate safe outer contour can be calculated at runtime.





Exercise 2: Testing your don't crash

Hao

  1. Exercise2-1 Hao.png
    In map1 the robot can stop as the designed purpose.
  2. Exercise2-2 Hao.png
    In map2 the robot stopped when detected the wall on the right side with distance<=0.2













Chuyu:

  1. In map 1, the robot keeps moving and does not collide with obstacles
  2. In map 2, the robot keeps moving and does not collide with obstacles
Exercise2-1 Chuyu.png
Exercise2-2 Chuyu.png