byu-magicc / rosplane

A basic fixed-wing autopilot for ROS - based on the textbook "Small Unmanned Aircraft: Theory and Practice" by Randy Beard and Tim McLain
94 stars 47 forks source link

Where are docs? Need Simple python script for manuvering #76

Open itskd opened 3 years ago

itskd commented 3 years ago

Can someone give a simple example of how to plan path and make fixed wing follow dubins path. I created a simple scipt for path planning, but nothing happens when i run this. I just want a fixed wing to go from point a to b, can someone help me achieve this!!

from rosplane_msgs.msg import Waypoint

rospy.init_node('rc_pp')

rc_pub = rospy.Publisher('/multirotor/RC', RCRaw, queue_size=10)

rc_pub = rospy.Publisher('/fixedwing/rosplane_simple_path_planner', Waypoint, queue_size=10)

rate = rospy.Rate(1)

msg = Waypoint()

msg.w[0]= 1111 msg.w[1] = 1111 msg.w[2]= 1111 msg.chi_d = 0.9 msg.chi_valid = True msg.Va_d = 12 msg.set_current = True msg.clear_wp_list = False rc_pub.publish(msg) print(msg) rate.sleep()

gellings commented 3 years ago

I looks like there is an example of publishing a waypoint list: https://github.com/byu-magicc/rosplane/blob/d8fe9ffd75fb9ed6786793d96225f3d98812ff50/rosplane/src/path_planner.cpp#L27

There is also an example launch file: https://github.com/byu-magicc/rosplane/blob/RC1.0/rosplane_sim/launch/fixedwing.launch

From what I can see the python example you posted should work. It will just fly you 1111 meters down (below the ground plane in gazebo). There is also some documentation in the message definition: https://github.com/byu-magicc/rosplane/blob/RC1.0/rosplane_msgs/msg/Waypoint.msg

Most of the rest of the documentation is in the textbook http://uavbook.byu.edu/doku.php

Hope this helps!

cgnarendiran commented 3 years ago

Hey guys,

Launching roslaunch rosplane_sim fixedwing.launch, that contains the rosplane_path_planner node. However, the plane doesn't move at all. It seems like the node is sending waypoints. But, I could not see any messages being published in the topic /fixedwing/waypoint_path that this node advertises.

So I tried to run this node separately (rosrun rosplane rosplane_path_planner __ns:=fixedwing) without the launch file and it seems to work fine. I could echo the topic and see three messages published before the node dies. But for some reason with the gazebo launched, the node sleeps for infinite time (more than the given ros::Duration(0.5).sleep()). Any ideas as to what is happening?

gellings commented 3 years ago

It seems to work for me... Can you give more details about your setup?

Also don't forget to push play in gazebo (bottom left of the gazebo window). It starts "paused" by default.

cgnarendiran commented 3 years ago

Ahh! That was it. I didn't notice that Gazebo is launched in paused state. It works now.

When launching in the unpaused mode (setting <arg name="paused" value="false"/>), the plane doesn't move however. The path_planner node published all the messages and died before the path_manager could get its hands on those messages. A better solution instead of pausing in Gazebo is to use ROS Services instead of Topics since this is clearly an asynchronous communication. I will send a PR if I implement it.