Lars-Ki / px4_rrt_avoidance

A UAV collision avoidance package for px4 applications
MIT License
9 stars 7 forks source link

Unable to run #10

Open bhaskar-glitch opened 1 year ago

bhaskar-glitch commented 1 year ago

Hi @Lars-Ki unable to run the project facing some sort of rrt node error please help

Lars-Ki commented 1 year ago

Hi. Could you provide a view more details on what exactly is not working? Please provide the following:

Thanks

bhaskar-glitch commented 1 year ago

Hi. Could you provide a view more details on what exactly is not working? Please provide the following:

  • do you have local changes?
  • copy and paste the error message

Thanks

Im using Jetson xavier with custom depth camera and point cloud along with px4 flight controller...i tried running it on simualtion first but getting error saying:

[ERROR] [1686292411.124087, 1035.659000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f02033972b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not float

[ERROR] [1686292411.177534, 1035.695000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f02033972b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not flo

Tried implementing it on hardware too the avoidance system is showing ready but the drone just took off and holded on a height and didint move anywhere...projected_map topic was working good at 30hz You are also mentioned that it will fly only from 5 meters could u please explain why? also if i want to make it run below 5 what i will have to do.

Please help

Lars-Ki commented 1 year ago

You are also mentioned that it will fly only from 5 meters could u please explain why? also if i want to make it run below 5 what i will have to do.

One of the Issues in the noisy signal simulation was, that under a certain altitude, the ground was mapped as an obstacle. This happens when the drone's position starts to drift vertically. To avoid this my code only maps obstacles above 1m. (See here, Link) For real applications be aware of this. If the ground is mapped and seen as an obstacle, it will try to exit the safety radius and could go crazy (flying in one direction always mapping new ground, therefore obstacles and this circle will continue).

The error msg looks like it is returning nonsense. The indexes of the voxels in the local map could be none. Try a print() in the else part here in the local_planner.py Line 713

If I remember correctly you need to start the Master_node.py separately after launching the script (Here you can see why The master node is not launched. Did you do that?

Or did you forget to set the COM_OBS_AVOID = 1 in Q-Ground Control?

can you maybe run:
rqt_graph
and see which node is active or not.

If you manage to fly it outside on a drone, please send me a video. I would love to see it :D

bhaskar-glitch commented 1 year ago

Help us to Resolve the height issue we will run it in real world and surely send you the video:))

bhaskar-glitch commented 1 year ago

This is my RQT_GRAPH rosgraphRRT

This is my frames: framesrrt

Please help

Lars-Ki commented 1 year ago

Okay so on my setup it works: The error msg you provided in the second post:

[ERROR] [1686292411.124087, 1035.659000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f02033972b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not float

[ERROR] [1686292411.177534, 1035.695000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f02033972b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not flo

is "normal" as long as the master node is not running. When you run:
rosrun px4_rrt_avoidance Master_node.py
this should stop correct?
The next thing that I have noticed is on your rqt_graph, is that the local_map is not published by local_map_publisher.
I am very confident that this causes the route planning issue (your drone staying stationary). This could happen because of two reasons:

  1. There is an issue in the local_map_publisher node. Here just disable the node in the launch it manually (incl master noder) or kill the node and relaunch it. If you have an error msg please report.
  2. the local_map_publisher sees no obstacle and therefore does not publish a local_map. Here maybe try to bring the obstacle closer to the camera in gazebo

For reference, here is my rqt_graph
ROS_Image

Maybe also check rviz. If you launch roslaunch px4_rrt_avoidance iris_depth.launch there should be a fountain in front of the drone: gazebo_screenshot

in rviz you should see some voxels like these:

rviz_screenshot

Feel free to post those images as well, maybe this will help resolve your issue.

bhaskar-glitch commented 1 year ago

Okay so on my setup it works: The error msg you provided in the second post:

[ERROR] [1686292411.124087, 1035.659000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f02033972b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not float

[ERROR] [1686292411.177534, 1035.695000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f02033972b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not flo

is "normal" as long as the master node is not running. When you run: rosrun px4_rrt_avoidance Master_node.py this should stop correct? The next thing that I have noticed is on your rqt_graph, is that the local_map is not published by local_map_publisher. I am very confident that this causes the route planning issue (your drone staying stationary). This could happen because of two reasons:

1. There is an issue in the local_map_publisher node. Here just disable the node in the launch it manually (incl master noder) **or** kill the node and relaunch it. If you have an error msg please report.

2. the local_map_publisher sees no obstacle and therefore does not publish a local_map.  Here maybe try to bring the obstacle closer to the camera in gazebo

For reference, here is my rqt_graph ROS_Image

Maybe also check rviz. If you launch roslaunch px4_rrt_avoidance iris_depth.launch there should be a fountain in front of the drone: gazebo_screenshot

in rviz you should see some voxels like these:

rviz_screenshot

Feel free to post those images as well, maybe this will help resolve your issue.

Thank you for the reply.

I have tried the steps you told to manually launch the local_map_publisher node instead of launching it from launch file but then also there is same error. also i have add obstacle closer to the drone camera here is the image: Screenshot from 2023-06-19 22-45-22

this is the screenshot of my terminal where im launching things: Screenshot from 2023-06-19 22-44-59

this is the rosgraph again: rosgraph

also no voxels is being shown on rviz: Screenshot from 2023-06-19 22-49-50

Please help!!!:))

Lars-Ki commented 1 year ago

This is a different issue than before. Here gazebo is not publishing anything to camera/depth/points. This could be due to multiple reasons.

  1. Gazebo is not correctly set up. (Have you tried my launch script? Does it work there?)
  2. Your camera is not publishing the correct msg. Make sure to tell octomap to listen to the correct msg here
bhaskar-glitch commented 1 year ago

This is a different issue than before. Here gazebo is not publishing anything to camera/depth/points. This could be due to multiple reasons.

1. Gazebo is not correctly set up. (Have you tried my launch script? Does it work there?)

2. Your camera is not publishing the correct msg. Make sure to tell octomap to listen to the correct msg [here](https://github.com/Lars-Ki/px4_rrt_avoidance/blob/main/launch/iris_depth.launch#L42)

Sorry my bad my simulation drone publish pointcloud topic named /iris/camera/depth/points i made the change in launch file these are the screenshots : Screenshot from 2023-06-20 12-10-28 Screenshot from 2023-06-20 12-10-18 VOXELS are IN UPWARD DIRECTION it should be in forward :(

This is the new RQT_GRAPH: rosgraph

Lars-Ki commented 1 year ago

That should be easy to solve. There is a node camera_static_tf that tells octomap how the camera is mounted onto the drone. Make sure that this is setup correctly.

bhaskar-glitch commented 1 year ago

That should be easy to solve. There is a node camera_static_tf that tells octomap how the camera is mounted onto the drone. Make sure that this is setup correctly.

Yes thanks solved the orientation probl Screenshot from 2023-06-20 14-13-43 em.

Now i enabled avoidance system in px4 planned a mission and then launched it but the drone isn't avoiding the obstacle these are the screenshots: ROS_GRAPH rosgraph

FRAMES Screenshot from 2023-06-20 14-17-20

Launch file: Screenshot from 2023-06-20 14-20-13

It is not working:((

Lars-Ki commented 1 year ago

This is a little bit more tricky to solve without further information:

  1. Can you tell me more about the mission (altitude). It looks like you are sitting on the ground with your drone?
  2. In your rviz image, I do not see the local map. Did you disable the view in rviz? Maybe listen to this msg in your terminal and see if it is updating ( rostopic echo ... or rostopic hz ....)
  3. Are you sure that COM_OBS_AVOID = 1
  4. Maybe PX4 has changed their system and needs new parameter or they need it to be published on a different topic.
  5. listen to mavros/trajectory/generated to make sure master_node is publishing a path to follow.
  6. I believe to take off your drone needs to be initiated in a un-occupied local_map area for it to take off. This looks like it is already too close to the obstacle.

You could try a rosbag. If you send me the file or give me access rights to download it somewhere I can see for myself what is going on. (Pls also provide the rviz configuration for me)

FYI: Would be nice If you could upload your code with the "Add Code" Button instead of uploading your launch file or error msg as an image ;) A picture won't help me to find a specific error msg ;) Thank You!

bhaskar-glitch commented 1 year ago

This is a little bit more tricky to solve without further information:

1. Can you tell me more about the mission (altitude). It looks like you are sitting on the ground with your drone?

2. In your rviz image, I do not see the local map. Did you disable the view in rviz? Maybe listen to this msg in your terminal and see if it is updating ( `rostopic echo ...` or `rostopic hz ....`)

3. Are you sure that `COM_OBS_AVOID = 1`

4. Maybe PX4 has changed their system and needs new parameter or they need it to be published on a different topic.

5. listen to mavros/trajectory/generated to make sure master_node is publishing a path to follow.

6. I believe to take off your drone needs to be initiated in a **un**-occupied local_map area for it to take off. This looks like it is already too close to the obstacle.

You could try a rosbag. If you send me the file or give me access rights to download it somewhere I can see for myself what is going on. (Pls also provide the rviz configuration for me)

FYI: Would be nice If you could upload your code with the "Add Code" Button instead of uploading your launch file or error msg as an image ;) A picture won't help me to find a specific error msg ;) Thank You!

  1. My mission altitude is 4 meters i tried both with taking off prior and mission takeoff

  2. Local map is showing no map received Screenshot from 2023-06-20 22-05-55

  3. Yes COM_OBS_AVOID = 1

Error when launching iris_depth.launch

[ERROR] [1687278970.609805, 437.859000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f009e0a9310>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not float

[ERROR] [1687278970.641511, 437.891000]: bad callback: <bound method Drone.set_drone_position of <__main__.Drone object at 0x7f009e0a9310>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_planner.py", line 43, in set_drone_position
    local_map_value = local_map.map_matrix[y_ind][x_ind]
TypeError: list indices must be integers or slices, not float

Error when running local_map_publisher.py :

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_map_publisher.py", line 535, in separate_msg
    global_map.set_occupancy_matrix(msg.data)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_map_publisher.py", line 434, in set_occupancy_matrix
    local_map.publish_map()
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_map_publisher.py", line 466, in publish_map
    pub.publish(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 886, in publish
    raise ROSSerializationException(str(e))
rospy.exceptions.ROSSerializationException: field data[] must be an integer type

Here is the folder which have my workspace named drone_ws and rosbag of all the topics while running the mission i have recorded. https://enordpvtltd913-my.sharepoint.com/:f:/g/personal/bhaskar_enord_tech/EnBcg5xGN3lCjfZq9jwTzpUBMTixGJJ69WcYuRlb3BtNMw?e=5KmXnn

Thank you,:))

Lars-Ki commented 1 year ago

I believe I have found one issue. On your latest rqt_graph the local_map_publisher is not listening on all of the following mavros msg:

  1. /mavros/trajectory/desired (missing). I don't know why. This msg is also missing for the master node
  2. /mavros/state (OK)
  3. /mavros/local_position/pose (missing)
  4. and obviously /projected_map (from local_map_publisher)

2 is needed to create the second corner of the local map. 3 is needed for the first corner of the local map.

I believe I remember PX4 was working on changes back then. (This could help???: Link )

Try if you can find some information on that and let me know what you find ;)

bhaskar-glitch commented 1 year ago

I believe I have found one issue. On your latest rqt_graph the local_map_publisher is not listening on all of the following mavros msg:

1. /mavros/trajectory/desired (missing).  I don't know why. This msg is also missing for the master node

2. /mavros/state (OK)

3. /mavros/local_position/pose (missing)

4. and obviously /projected_map (from local_map_publisher)

2 is needed to create the second corner of the local map. 3 is needed for the first corner of the local map.

I believe I remember PX4 was working on changes back then. (This could help???: Link )

Try if you can find some information on that and let me know what you find ;)

Do you think it could be a problem of frames?? Screenshot from 2023-06-21 18-09-37 Please check my frames and could u share yours?

Also my /mavros/local_position/pose and /projected_map topic is working very fine i checked it properly and yes /mavros/trajectory/desired topic isnt working beacuse when i echoed it after running mission it isnt giving any points.:((

Please help

Lars-Ki commented 1 year ago

local_map_publisher

I am very certain that the issue lies in the missing desired trajectory. Have you read this paper ( link to pdf )? This should make it very clear why it is needed.
Did you check that:

  1. /mavros/local_position/pose is publishing data: rostopic echo /mavros/local_position/pose
  2. That you have uploaded the mission (check before and after rostopic echo /mavros/trajectory/desired (see example below)
  3. Try disabling all prints from local_map_publisher and see if there are any error msg coming up

And yes your local_map is most likely initiated but is not publishing any data:
try:
rostopic echo /local_map rostopic hz /local_map (mine is pub. at 12.6 hz)

Example Rostopics:

mavros/trajectory:/desired

---
header: 
  seq: 4542
  stamp: 
    secs: 0
    nsecs:   3867098
  frame_id: "local_origin"
type: 0
point_1: 
  header: 
    seq: 0
    stamp: 
      secs: 0
      nsecs:         0
    frame_id: ''
  coordinate_frame: 0
  type_mask: 0
  position: 
    x: 0.0062934695743
    y: 0.0159048866481
    z: -0.185148119926
  velocity: 
    x: nan
    y: nan
    z: nan
  acceleration_or_force: 
    x: nan
    y: nan
    z: nan
  yaw: nan
  yaw_rate: nan
point_2: 
  header: 
    seq: 0
    stamp: 
      secs: 0
      nsecs:         0
    frame_id: ''
  coordinate_frame: 0
  type_mask: 0
  position: 
    x: nan
    y: nan
    z: nan
  velocity: 
    x: nan
    y: nan
    z: nan
  acceleration_or_force: 
    x: nan
    y: nan
    z: nan
  yaw: nan
  yaw_rate: nan
point_3:
.
.
.

mavros/local_position/pose

---
header: 
  seq: 21819
  stamp: 
    secs: 732
    nsecs: 699953907
  frame_id: "map"
pose: 
  position: 
    x: 0.0217683389783
    y: -0.00763884140179
    z: -0.0043252883479
  orientation: 
    x: -0.000933672631935
    y: 0.00339157031752
    z: -0.00674492875459
    w: -0.999971070148
---

local_map

header: 
  seq: 14836
  stamp: 
    secs: 1177
    nsecs: 768000000
  frame_id: "map"
info: 
  map_load_time: 
    secs: 0
    nsecs:         0
  resolution: 0.5
  width: 24
  height: 24
  origin: 
    position: 
      x: -6.0
      y: -6.0
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.0
      w: 0.0
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---

Starting local_map_publisher

Local_map_pub gives me the following printouts (no changes)

lkillian@lkillian-All-Series:~$ rosrun px4_rrt_avoidance local_map_publisher.py 
local_LLC[1]: -6
global_LLC[1]: -1.5
local_LLC[1]: -6
global_LLC[1]: -1.5
local_LLC[1]: -6
global_LLC[1]: -1.5
local_LLC[1]: -6
global_LLC[1]: -1.5
local_LLC[1]: -6
global_LLC[1]: -1.5
local_LLC[1]: -6
global_LLC[1]: -1.5

Frames

The frames look good to me: image

Lars-Ki commented 1 year ago

Could you try again uploading a new rosbag with only the relevant rostopics? I have currently an issue with the one you have provided. Thx

bhaskar-glitch commented 1 year ago

Could you try again uploading a new rosbag with only the relevant rostopics? I have currently an issue with the one you have provided. Thx

Bag file of the desired topic that is : mavros/trajectory/desired mavros/local_position/pose /local_map (not working) https://enordpvtltd913-my.sharepoint.com/:u:/g/personal/bhaskar_enord_tech/Efpwlsg1PodIgDyffftOxb8BG1frs9hWq8ryya4eQyEWCQ?e=muMhEf

also as your local_map_publisher.py is printing some local_LLC and so, in my case it is printing the same but only sometime along with error that is:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_map_publisher.py", line 535, in separate_msg
    global_map.set_occupancy_matrix(msg.data)
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_map_publisher.py", line 434, in set_occupancy_matrix
    local_map.publish_map()
  File "/home/bhaskar/drone_ws/src/px4_rrt_avoidance/nodes/local_map_publisher.py", line 466, in publish_map
    pub.publish(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 886, in publish
    raise ROSSerializationException(str(e))
rospy.exceptions.ROSSerializationException: field data[] must be an integer type

**local_LLC[1]: -6
global_LLC[1]: -0.5**
[ERROR] [1687372923.984120, 195.728000]: bad callback: <function separate_msg at 0x7fd5e72f9f70>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/nav_msgs/msg/_OccupancyGrid.py", line 139, in serialize
    buff.write(struct.Struct(pattern).pack(*self.data))
struct.error: required argument is not an integer

During handling of the above exception, another exception occurred:

also here is the screenshot how i have planned mission in qgc: Screenshot from 2023-06-22 00-11-54

My steps of execution is:

  1. Im launching px4 by

    roslaunch px4 mavros_posix_sitl.launch

  2. Im launching px4 rrt avoidance by

    roslaunch px4_rrt_avoidance iris_depth.launch

  3. Im launching local_map_publisher.py by

    rosrun px4_rrt_avoidance local_map_publisher.py

  4. Im running Master_node.py by

    rosrun px4_rrt_avoidance Master_node.py

Then im running mission by QGC by that start mission toggle

Requesting you that can you pleas help me with your repository which u are using currently also the px4 autopilot version u r using along with gazebo and iris camera setup Please.

bhaskar-glitch commented 1 year ago

@Lars-Ki Have you gone through the steps i have sent you of my execution? Does it works only on ROS MELODIC?

Lars-Ki commented 1 year ago

Hey Sorry for the late reply. I#ve managed to play the rosbag. It looks like there is data inside the trajectory/desired. Unfortunately, I have not found the reason for your issue in local_map_publisher.

Can you print at the error line the value it trys to set and theactual value? This may be a bad idea but you can force it to be an integer in python. I have also found this for path planing: Link It seems to be a different topic than trajactory/genertaed. Only try this when the local_map is generated. I do not believe it is an issue of ros melodic or other ROSs.

Looks like I am using the following versions:

you can try to switch to those commits. Did you find anything in the mean time?

FYI. I will be on a business trip next week and won't be able to try anything on Linux.

bhaskar-glitch commented 1 year ago

Hey Sorry for the late reply. I#ve managed to play the rosbag. It looks like there is data inside the trajectory/desired. Unfortunately, I have not found the reason for your issue in local_map_publisher.

Can you print at the error line the value it trys to set and theactual value? This may be a bad idea but you can force it to be an integer in python. I have also found this for path planing: Link It seems to be a different topic than trajactory/genertaed. Only try this when the local_map is generated. I do not believe it is an issue of ros melodic or other ROSs.

Looks like I am using the following versions:

* mavros 1.6.0

* px4: commit e79b3930f37b7463dbcd48882f3b4fdd938cf8ce
  Author: PX4 BuildBot [bot@px4.io](mailto:bot@px4.io)
  Date:   Sun Mar 21 12:39:12 2021 +0000

you can try to switch to those commits. Did you find anything in the mean time?

FYI. I will be on a business trip next week and won't be able to try anything on Linux.

Was waiting for your reply Lars..Actually we have 2 laptops in one i have ros melodic and noetic in other the errors i shared you was from my noetic laptop i just tried to test it once on melodic and BOOM!! there was no error the local_map_publisher is also printing the same thing as your was. :)) i tried to test the same on my actual drone the 5 meter height is a issue bcoj 5 meter height is a big gap and how will i put any obstacle on that much height!! Please help me to reduce that height also how to run on noetic??

bhaskar-glitch commented 1 year ago

Hi @Lars-Ki fortunately i made it work on noetic today all the topic are working fine but the drone is not moving forward after takeoff. Occupancy grid is looking so weird. Here are the screenshots: Screenshot from 2023-06-25 22-35-11 Screenshot from 2023-06-25 22-35-23

As you can see here everything is working fine. Screenshot from 2023-06-25 22-35-37

Lars-Ki commented 1 year ago

Hey. Glad to here you made it work. So why the voxels look so strange could be due to a sensor issue (your camera obstacle data is very noisy) or the drone position from PX4 is noisy. Is the GPS good or other positioning system? Is the test outside? It looks like you have changed the voxels size could that be true? Then maybe we have a parameter issue on my code. We would need to fix this so the local map is working fine again.

As for the 5 m I have checked my code I could not find any remains of this minimum altitude (except >1m min altitude) for tests I would recommend a tree maybe for the beginning. Try flying slow and see if it starts deviating. Also make sure you do not loose ssh connect when you start the flight. If you loose it master mode will crash or stop. Try to find a command so it stays active even when you loose ssh connect.

Hope that helped for now.

bhaskar-glitch commented 1 year ago

Hey. Glad to here you made it work. So why the voxels look so strange could be due to a sensor issue (your camera obstacle data is very noisy) or the drone position from PX4 is noisy. Is the GPS good or other positioning system? Is the test outside? It looks like you have changed the voxels size could that be true? Then maybe we have a parameter issue on my code. We would need to fix this so the local map is working fine again.

As for the 5 m I have checked my code I could not find any remains of this minimum altitude (except >1m min altitude) for tests I would recommend a tree maybe for the beginning. Try flying slow and see if it starts deviating. Also make sure you do not loose ssh connect when you start the flight. If you loose it master mode will crash or stop. Try to find a command so it stays active even when you loose ssh connect.

Hope that helped for now.

What if i give /mavros/local_position/odom instead of pose?? will that work?

Lars-Ki commented 1 year ago

From what I have found on the internet the Odom topic is less reliable (covariance Matrix = 0, data coming directly from Sensor)

Have you tried it? How does it work?