# CHARMIE: A Collaborative Healthcare and Home Service and Assistant Robot for Elderly Care
## 2 Materials and Methods
### Components
#### 2.2.3 Navigation (Obstacle Detection and Avoidance)  
To safely navigate a previously mapped environment, CHARMIE must detect dynamic and static obstacles that might not be in the environment map and navigate accordingly to overcome these. Regarding obstacle detection, the robot uses the same sensors as in the mapping function, the 2D LiDAR and the RGB-D camera. The 2D LiDAR is used for small obstacles at the motion platform height. It starts by checking if there is any obstacle inside a 1.50 m radius and calculates both the obstacle position relative to the robot and its size. The RGB-D camera starts with the same principle regarding the 1.50 m radius, calculates its position relative to the robot and size, creating a virtual obstacle from the floor to the robot's height. In Figure 10, an example of the same image from three different angles is displayed, showing an example of data fusion between the RGB camera and the Depth camera. The obstacles derived from the sensors are combined in a temporary virtual obstacle map that is constantly updated. By applying this method in consecutive frames, the direction of movement of dynamic obstacles is also added to the virtual obstacle map. After parameterising all the static and dynamic obstacles in a nearby radius and defining a target location, CHARMIE uses dynamic non-linear systems [48; 49] as a distributed control architecture that generates navigation. Task constraints are component forces that are cast together into the vector field of this dynamical system. For example, the directions \(\varphi=\psi_{obs}\) (where obstacles are from the robot's viewpoint) and the directions \(\varphi=\psi_{tar}\) (where the target is) are constraints represented by repulsive and attractive forces acting on the heading direction. The attractive force attracts the system to the desired heading direction value, whereas the repulsive forces prevent the system from moving in an undesired direction. As the robot moves, the directions to the target and obstacles in the world variates, and consequently, the attractor and repellers move in the vector field. As stated above, the virtual obstacle map foresees the direction and size of all obstacles that must influence the robot's trajectories according to the robot's reference. So, a repulsive force is applied to all obstacles:  
\[f_{obs,i}(\varphi)=\lambda_{i}(\varphi-\psi_{i})\exp\left[\frac{-(\varphi- \psi_{i})^{2}}{2\sigma_{i}^{2}}\right],i=1,\;2,\ldots(no\;of\;obstacles), \tag{1}\]  
where \(\varphi\) is the robot direction, \(\psi_{i}\) is the obstacle direction, thus \((\varphi-\psi_{i})\) is the obstacle direction relative to the robot. \(\sigma\) is the angular magnitude on which a repulsive force acts, defined as:  
\[\sigma_{N}=arctan\left[tan\left(\frac{\Delta\theta}{2}\right)+\frac{R_{robot }}{d_{i}}\right] \tag{2}\]  
Figure 10: Three different perspectives (**a**–**c**) of three human users interacting with CHARMIE. The robot fuses the RGB and Depth cameras’ information to create a 3D view of the environment. where \(\Delta\theta\) is the angle the robot occupies, \(R_{robot}\) is the robot radius and \(d_{i}\) is the distance from the robot's centre to the obstacle. \(\lambda_{i}\) is the maximum repulsion force, defined as:  
\[\lambda_{i}=\beta_{1}*exp\left[-\frac{d_{i}}{\beta_{2}}\right] \tag{3}\]  
where \(\beta_{1}\) controls the maximum repulsion strength, and \(\beta_{2}\) controls the decay rate with increasing distance. The repulsors contributions from all obstacles are summed, creating the repulsor vector field. To get the target position, it starts by transforming the target coordinates into the target direction and apply an attractive force as:  
\[f_{tar}(\phi)=-\lambda_{tar}*sin(\phi-\psi_{tar}) \tag{4}\]  
where \(\psi_{tar}\) is the target direction and \(\lambda_{tar}\) is the attraction force magnitude. To finish the dynamic field vector system, all contributions are added.