Ask Your Question
0

How to program a drone to fly

asked 2021-09-14 14:15:28 -0600

Hello, I'm VERY new at ROS (and rotors_ simulator). I need to work on my project and my task is to fly a mav_hovering_example_with_vi_sensor. I should be able to make it fly in a straight line, around the rectangular object, like different kinds of trajectories. And later to use image processing to plan trajectories. But I have no idea where to start. I only found this line $ rostopic pub /firefly/command/motor_speed mav_msgs/Actuators '{angular_velocities: [100, 100, 100, 100, 100, 100]}' in documentation and I'm not sure where to find more about this topic and how to make it fly in a specific trajectory? Any help would be appreciated. I know this issue is not 100% ROS related, but I don't know where to find resources... Sorry

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-09-15 06:36:53 -0600

Ranjit Kathiriya gravatar image

updated 2021-09-15 07:53:36 -0600

Hello @lovelysunshinr,

$ rostopic pub /firefly/command/motor_speed mav_msgs/Actuators '{angular_velocities: [100, 100, 100, 100, 100, 100]}'

I think this is to control motor speed. If you want to fly you need to subscribe to another channel. I am not sure but I can tell it /set_model_state gazebo_msgs/ModelState.

 # For reset your done
rostopic pub --once gazebo/set_model_state gazebo_msgs/ModelState '{model_name:firefly,pose:{position:{x:0,y:0,z:0},orientation:{x:0,y:0,z:0,w:0}},twist:{linear:{x:0,y:0,z:0},angular:{x:0,y:0,z:0}},reference_frame:world}'

Over here from the above, It is publishing position, orientation, twist, I think if you have to publish the twist message and then you can be able to control your done. You can publish this by using scripts in cpp or python or command line.

Command-line: I think it will work. Over here your done will move 10mm from the current position.

rostopic pub --once gazebo/set_model_state gazebo_msgs/ModelState '{model_name:firefly,twist:{linear:{x:0.01,y:0,z:0},angular:{x:0,y:0,z:0}},reference_frame:world}'

I would suggest to take a look at this tutorial for more understanding about ros publish and subscribers.

I'm not sure where to find more about this topic and how to make it fly in a specific trajectory?

Over here you can make a trajectory based on Image detection, GPS, or let's say current position to next position for example from my current position at that time you can publish coordinate just from your script and the drone will perform tasks accordingly.

I am not sure if I answer your question is perfect if you have any question feel free to drop a comment.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2021-09-14 14:15:28 -0600

Seen: 23 times

Last updated: Sep 15