Open AbBaSaMo opened 4 months ago
Following instructions from: https://docs.nav2.org/plugin_tutorials/docs/writing_new_costmap2d_plugin.html and https://www.youtube.com/watch?v=X128gB2lVF0
Got this to work:
Seems to be overlaying nicely. Although I don't know why there seems to be 3 parts when there should only be 2.
There was this constant warning in terminal: It didn't seem to make any trouble so hopefully we don't need to worry about it.
It also occasionally gave this message: Not too sure why this is happening either.
Seems like a good start. We will be researching how to get occupancy grids from ros2 topics and using that instead of the gradient. We will be looking at static layer's code as that has a topic input for occupancy grids.
Nav2's static layer actually provides updating costmap functionality. The only difference is that it requires messages of type "OccupancyGridUpdate" from "map_msgs" instead of "OccupancyGrid" from "nav_msgs".
For testing, I have just passed it dummy data of a grid with a single line of obstacles. Here are some observations of the results: Obstacles are indicated by bright pink. Kinda confusing since some parts that is clear is in pink/purple. Inflation layer works on this. Obstacles will remain there, unless something overwrites it. Where the obstacle starts, which is currently at the center of this map is actually (200, 200). Not sure if that will change based on grid size. Kinda makes sense since each of those grey grid squares has a resolution of 20x20 occupancy grid squares.
https://drive.google.com/file/d/1Y_nrtleCLj4pSTPHsCZQyk6lNB0huH79/view?usp=sharing
@AbBaSaMo How would we be able to test this? Since the update message requires (x, y) to update from. Does the sensors provide current position (not sure what the 3 sensors are)? We would also need to change the zed topic publisher to use "OccupancyGridUpdate" messages as well as listen to current position.
Also just for reference, these transforms need to be run: ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link odom ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link map
x and y of the robot? this would be provided by odom: robot localisation takes imu and gnss data and outputs odom https://docs.ros2.org/foxy/api/nav_msgs/msg/Odometry.html
@Jiawei-Liao @Jokua
is there some parameter to specify a link or frame for it to be relative to? or does the message type have a frame attribute you can change?
@Jokua @Jiawei-Liao industry night demo week 8, we want this configured with the esda sim by then too
industry night demo will only use lidar
also find the gazebo map of the igvc comp that anthony made and push it to the github. he might have it on his personal device
is there some parameter to specify a link or frame for it to be relative to? or does the message type have a frame attribute you can change?
I haven't noticed one when looking through the code. Although I have also noticed that it wasn't able to spawn an entity, which might be why the (0, 0) point is off center.
I was trying to look at why it gives a spawning error. Haven't found anything yet.
industry night demo will only use lidar
does this mean we don't need the zed layer?
sorry for the late reply, we need the zed layer for the actual build but not industry night demo
@Jokua Instead of having another costmap on nav2 (I don't think this works?), you can try to fuse the occupancy grids of both slam and zed camera.
This node would:
To try it out, you could launch tb3 as that generates slam topic. You can just publish a dummy zed cam topic. Finally, launch rviz and view the combined occupancy grid topic to check if its right.
Overview
Occupancy grids are a grid of the space around the vehicle that show spaces that the vehicle can move in and spaces the vehicle cannot move in. We have 2 occupancy grids produced by our system:
Nav2 requires a cost map (basically an occupancy grid with some differences) as an input so it can calculate where and how to drive but since we have 2 grids, we need to merge these. Luckily, Nav2 also provides a system by which we can merge grids as layers that are then concatenated and this task aims to implement these layers.
Relevant resources
This is what an occupancy grid looks like when visualised
Acceptance criteria
Todo