UWB Simulation

ROS Pozyx Simulation

This package is to simulate the UWB range measurements in ROS environment. Generated data published to “uwb_data_topic”

UWB Anchors Add

The file that contains the UWB anchor information is in “launch/uwb_anchors_set.launch” file. It is possible to add or remove the UWB anchors as you like.

Note : uwb tag frame name should be as follows uwb_anchor_0, uwb_anchor_1, uwb_anchor_2 …

UWB Tag information

Location of the tag has been taken from the robot position so to use this information “modelstate_index” parameter (for turtlebot3 modelstate_index =2) which is in “launch/uwb_simulation_initializing.launch” file must set correctly depending on the robot model used. It is possible to find your own robot parameter in “gazebo/model_states” topic.

Initialize

Use the command below in terminal to start it with default settings

roslaunch pozyx_simulation uwb_simulation_initializing.launch

Publish Topic

Name of the publisher topic is “uwb_data_topic”. You can check it by using the command below in terminal

rostopic echo /uwb_data_topic


Message type consists of 3 different arrays
1. anchors name => int64[] destination_id
2. anchors distance to robot => float64[] distance
3. time stamp => time[] stamp

Map and Rviz

If you want to start manually with custom maps. You can change map and map configuration in maps folder and start manually with the codes below.

rosrun map_server map_server map.yaml
rosrun rviz rviz
rosrun pozyx_simulation uwb_simulation.py

Noise

Noise has been added to the every UWB ranging data

np.random.normal(0, uwb_dist*0.015,1)

How to use

Firstly run gazebo simulation after than run rviz

  1. run rqt
  2. in rqt window “Plugins” => “Topics” => “Topic Monitor”
  3. in that window find /gazebo/model_states/ topic and checked that line
  4. control robot pose in which parameter for example [‘ground_plane’,‘robot_symbol’,‘turtlebot_waffle’] in thise case index 2
  5. go repo folder /launch/uwb_manually_initializing.launch file and change modelstate_index parameter
 <node pkg="pozyx_simulation" name="pozyx_simulation"  type="uwb_simulation.py" output="screen">
       <param name="modelstate_index" value="2" />

For this process get robot or drone real position afther that to place uwb anchor in maps.

  1. go repo folder /launch/uwb_anchors_set.launch and open
  2. for each uwb anchor’s set a name and position for example
<launch>
   <node pkg="tf" type="static_transform_publisher" name="uwb_anchor_0x6e36" args="1.4 2.0 0.0 0 0 0 1 map uwb_anchor_0 100" />
   <node pkg="tf" type="static_transform_publisher" name="uwb_anchor_0x6e33" args="-1.4 2.0 0.0 0 0 0 1 map uwb_anchor_1 100" />
   <node pkg="tf" type="static_transform_publisher" name="uwb_anchor_0x6e49" args="1.4 -2.0 0.0 0 0 0 1 map uwb_anchor_2 100" />   
   <node pkg="tf" type="static_transform_publisher" name="uwb_anchor_0x6e30" args="-1.4 -2.0 0.0 0 0 0 1 map uwb_anchor_3 100" />
</launch>
  1. go /src/uwb_simulation.py file and add anchors
def uwb_simulate(sensor_pos):
    while not rospy.is_shutdown():
        time.sleep(0.1)
        all_distance = [] 
        all_destination_id = []

        for i in range(len(sensor_pos)):
            #calculate distance uwb to robot for all anchors 
            dist = calculate_distance(sensor_pos[i])   
            all_distance.append(dist) 
        
        #uwb_anchors_set.launch same order (not important for simulation)
        all_destination_id.append(0x694b)
        all_destination_id.append(0x6948)
        all_destination_id.append(0x694f)
        all_destination_id.append(0x694a)
            
        #publish data with ROS             
        publish_data(all_destination_id , all_distance)  

Now pack is ready to run.

  1. Firstly call anchors
    roslaunch pozyx_simulation uwb_anchors_set.launch
  2. After that run main calculation script
    roslaunch pozyx_simulation uwb_manually_initializing.launch

For check all pack is working
rostopic echo /uwb_data_topic

This process give robot to uwb_anchor distance for example

destination_id: [26955, 26952, 26959, 26954]
distance: [4192.039813830616, 2564.0268225317145, 3703.2810901751322, 1621.13755039097]
stamp: 
  - 
    secs: 1039
    nsecs: 440000000
  - 
    secs: 1039
    nsecs: 440000000
  - 
    secs: 1039
    nsecs: 440000000
---

This simulation give only robot to anchors distance. For calculate robot position use ieuagv_localization repo

UWB Simulation

2 Likes

@bekir_bostanci It might help if you give people some context about what this sensor is and why they would want to use it. ROS Discourse has a lot of people from a lot of different domains of robotics. I had to google Pozyx UWB myself. Am I correct in assuming you are taking about this product? Are you affiliated with the vendor?

Of course, let me give you some information about where and how it can be used. By the way, I am not a seller, I do not have any connection with the company. At the university IEU(Izmir University of Economics in Turkey) we have a group related robotics and localization. We have developed this simulation for the product you have shown on the link, but you can use it by changing the sensitivity rates for a different brand. This simulation is arranged according to the error rates given according to the factory data. Since we wanted to position with uwb at university and there was no simulation, We had to do a simulation ourself.
When Uwb is normally used with Kalman or particle filters, it can be used for position determination with high precision (1-4 cm). Since errors in positioning using odometer or imu are updated on the position, the error starts to become too much after robot movement. With UWB, you can correct these errors and always keep the error in the location data within a certain range.
The positions of the robots can be determined using uwb in drones and especially in crowded areas (areas where lidars cannot be used).

If there is anything else you wonder about, I would be happy to help.

2 Likes

@bekir_bostanci
I’m trying to run Your ROS IEU AGV project. I have uwb_simulation.py already configured and when i’m calling rosrun pozyx_simulation uwb_simulation.py it apears:
[INFO] [1609840788.624124, 77186.292000]: UWB Anchor List:
*Warning : uint is mm *
[[ 2000. 2000. 0.]

  • [ 2000. 30000. 0.]*
  • [ 30000. 2000. 0.]*
  • [ 30000. 30000. 0.]]*
    [INFO] [1609840788.627789, 77186.294000]: /pozyx_simulation/modelstate_index is 1
    It seems legit and when i’m typing rostopic echo /uwb_data_topic it apears distances so I think it’s configured good, but…
    Can you tell me why there is such an error when I run ROS IEU AGV Localization:
    "process[kalman_filter_localization-1]: started with pid [11378]
    Traceback (most recent call last):
  • File “/home/ubuntu/catkin_ws/src/ieuagv_localization-master/src/kalman_filter_localization.py”, line 17, in *
  • from ieu_agv.msg import uwb_data*
    ImportError: No module named ieu_agv.msg"
    Then processes die and roslaunch closes.

You have to catkin_make and source the package. But such questions would probably be better asked as issues in the respective github projects.

Thank You for reply!
Of course, i’m runinng following commands in directory catkin_ws:
catkin_make
source devel/setup.bash
roslaunch ieuagv_localization kalman_localization.launch
But error still apears.
Full Massage:

  • Ubuntu@ubuntupbl:~/catkin_ws$ roslaunch ieuagv_localization kalman_localization.launch
    … logging to /home/ubuntu/.ros/log/b556db82-4e87-11eb-ba85-0800279b46d2/roslaunch-ubuntupbl-11360.log
    Checking log directory for disk usage. This may take a while.
    Press Ctrl-C to interrupt
    Done checking log file disk usage. Usage is <1GB.
    started roslaunch server http://ubuntupbl:46623/

SUMMARY

PARAMETERS

  • /rosdistro: melodic
  • /rosversion: 1.14.10

NODES
/
kalman_filter_localization (ieuagv_localization/kalman_filter_localization.py)

ROS_MASTER_URI=http://localhost:11311

process[kalman_filter_localization-1]: started with pid [11378]
Traceback (most recent call last):
File “/home/ubuntu/catkin_ws/src/ieuagv_localization-master/src/kalman_filter_localization.py”, line 17, in
from ieu_agv.msg import uwb_data
ImportError: No module named ieu_agv.msg
[kalman_filter_localization-1] process has died [pid 11378, exit code 1, cmd /home/ubuntu/catkin_ws/src/ieuagv_localization-master/src/kalman_filter_localization.py __name:=kalman_filter_localization __log:=/home/ubuntu/.ros/log/b556db82-4e87-11eb-ba85-0800279b46d2/kalman_filter_localization-1.log].
log file: /home/ubuntu/.ros/log/b556db82-4e87-11eb-ba85-0800279b46d2/kalman_filter_localization-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor…
… shutting down processing monitor complete
done

Can you change packet folder name /ieuagv_localization-master to /ieuagv_localization

I did, but it still doesn’t work. :frowning: Any other suggestions?

Can you redownload repository again? I fixed problems and added “how to work simulation information”.

This is the uwb simulation repository
Note: You can not localization only this pack.
If you want to localize your robot or something you have to download advoard_localization pack.

Hello , thank you for your explaination.
I’m trying to run your Ros project but advoard_localization doesn’t work for me .
i type :
rosrun advoard_localisation kalman_filter_localization.py
but nothing happened .
can you please help me to resolve this .

@Smel
Hi
Before the run kalman_filter_localization.py script can you check GitHub - advoard/pozyx_simulation: Pozyx uwb sensors can simulate on ROS this part. Because kalman filter needs to uwb simulation and that is pozyx_simulation pack. Firstly you have to install pozyx_simulation and add plugin as stated in the documentation and than you have to add uwb anchors with launch file.

If you have a more question feel free to ask

Hello , Thank you for reply .
First , I start with pozyx_simulation , i configure uwb_anchors in launch and src file .
i run gazebo simulation robot , and i call anchors with :
roslaunch pozyx_simulation uwb_anchors_set.launch
and :
roslaunch pozyx_simulation uwb_manually_initializing.launch

But : when i did : rostopic echo /uwb_data_topic

It publish nothing at all .

I restart many times , but didn’t work for me , any help please ?

Did you insert plugin on your urdf?

    <gazebo>
        <plugin name="p3d_base_controller" filename="libgazebo_ros_p3d.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>10.0</updateRate>
        <bodyName>base_link</bodyName>
        <topicName>ground_truth/state</topicName>
        <gaussianNoise>0.0</gaussianNoise>
        <frameName>world</frameName>
        <xyzOffsets>0 0 0</xyzOffsets>
        <rpyOffsets>0 0 0</rpyOffsets>
        </plugin>
    </gazebo>

Hello I am having hard time implementing the github readme. I am fairly new to ros and would like your guidance. I have 4 anchors and 2 tags (drones).

I have already built a simulation in gazebo and would like the 2 drones to publish and subscribe to the pozyx sensor topics.

This is what i get when i try to run the first command aswell

RLException: [uwb_simulation_initializing.launch] is neither a launch file in package [pozyx_simulation] nor is [pozyx_simulation] a launch file name
The traceback for the exception was written to the log file

Hi you can try this repository but can you ask your question on http://answers.ros.org/ because this is not a discussion platform
GitHub - advoard/pozyx_simulation: Pozyx uwb sensors can simulate on ROS