ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Kathir's profile - activity

2023-05-18 15:10:34 -0500 received badge  Famous Question (source)
2018-08-08 01:18:00 -0500 marked best answer Drone's motion is unstable with ROS topics

Hi,

import rospy  
import time

from geometry_msgs.msg import Twist
from std_msgs.msg import String 
from std_msgs.msg import Empty 
from ardrone_autonomy.msg import Navdata



COMMAND_PERIOD = 1000


class AutonomousFlight():
    def __init__(self):
        self.status = ""
        rospy.init_node('forward', anonymous=False)
        self.rate = rospy.Rate(10)
        self.pubTakeoff = rospy.Publisher("ardrone/takeoff",Empty, queue_size=10)
        self.pubLand = rospy.Publisher("ardrone/land",Empty, queue_size=10)
        self.pubCommand = rospy.Publisher('cmd_vel',Twist, queue_size=10)
        self.command = Twist()
        #self.commandTimer = rospy.Timer(rospy.Duration(COMMAND_PERIOD/1000.0),self.SendCommand)
        self.state_change_time = rospy.Time.now()    
        rospy.on_shutdown(self.SendLand)

    def SendTakeOff(self):
        self.pubTakeoff.publish(Empty()) 
        self.rate.sleep()

    def SendLand(self):
        self.pubLand.publish(Empty())


    def SetCommand(self, linear_x, linear_y, linear_z, angular_x, angular_y, angular_z):
        self.command.linear.x = linear_x
        self.command.linear.y = linear_y
        self.command.linear.z = linear_z
        self.command.angular.x = angular_x
        self.command.angular.y = angular_y
        self.command.angular.z = angular_z
        self.pubCommand.publish(self.command)
        self.rate.sleep()

if __name__ == '__main__': 
    try: 
        i = 0
        uav = AutonomousFlight()

        while not rospy.is_shutdown():
            uav.SendTakeOff()
            if i <= 30 :
                uav.SetCommand(0,0,1,0,0,0)
                i+=1
            elif i<=60 :
                uav.SetCommand(0,0,0,0,0,0)
                i+=1
            else:
                uav.SendLand()

    except rospy.ROSInterruptException:
        pass

I need to just takeoff, go up and go to hover mode,

uav.SendTakeOff()
            if i <= 30 :
                uav.SetCommand(0,0,1,0,0,0)
                i+=1
            elif i<=60 :
                uav.SetCommand(0,0,0,0,0,0)

after take off, this code makes the drone go to little back and some random motion and going up and going to hover mode. How can I fix this ? and the motion is stable sometimes

2018-06-23 13:48:11 -0500 received badge  Famous Question (source)
2017-07-04 01:51:33 -0500 received badge  Notable Question (source)
2017-07-03 23:01:16 -0500 received badge  Popular Question (source)
2017-07-03 14:07:21 -0500 edited question Drone's motion is unstable with ROS topics

Drone's motion is unstable with ROS topics Hi, import rospy import time from geometry_msgs.msg import Twist from st

2017-07-03 11:31:37 -0500 asked a question Drone's motion is unstable with ROS topics

Drone's motion is unstable with ROS topics Hi, Please find the question in the following link. https://stackoverflow.c

2017-04-18 06:38:58 -0500 received badge  Notable Question (source)
2017-04-18 06:38:58 -0500 received badge  Popular Question (source)
2017-03-26 00:12:19 -0500 received badge  Famous Question (source)
2017-03-17 14:37:14 -0500 received badge  Notable Question (source)
2017-02-04 12:16:25 -0500 asked a question How to connect ORB_SLAM with ARDRONE 2.0 ?

Hi ,

I want to implement ORB_SLAM in ARDRONE's camera.

https://github.com/raulmur/ORB_SLAM

What are all the changes should I have to include ? Should I make changes to any of the launch files ?

Should that ardrone.launch file contain any code changes to include ORB-SLAM ?

Any fastest help is appreciable

2017-02-03 16:57:24 -0500 commented answer ROS Error: Cannot Launch Node of Type

Hi madeye, If i have to implement this ORB_SLAM in ARDRONE, which are the parameter do I have to change ??? there is launch file for ARDrone like ardrone.launch. so which launch file should I run to get 3D visualization of the environment ? should i use both launch files ??

2017-02-03 13:46:11 -0500 received badge  Supporter (source)
2017-02-03 13:22:25 -0500 received badge  Enthusiast
2017-02-01 09:55:27 -0500 received badge  Popular Question (source)
2017-02-01 00:13:38 -0500 commented question video stream needed for ARDRONE

@Mani : Can you help me to fix it ?

2017-01-31 23:57:25 -0500 received badge  Editor (source)
2017-01-21 16:54:26 -0500 asked a question video stream needed for ARDRONE

Hi,

This is Kathir. While using cv and ros bridge, I am not able to ardrone's camera's output in my computer. Could somebody help me to fix this ?

Should I have to change the topics in publisher or subscriber ? Why am I not getting the video feed ??

How to get video stream ? As per the code, imshow() should produce a window but in my code, nothing is happening.

#!/usr/bin/env python
import roslib
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image  
from cv_bridge import CvBridge, CvBridgeError

class image_converter:

 def __init__(self):
   print('Image converter constructor ')
   self.image_pub = rospy.Publisher("image_topic_2",Image,queue_size=1)

   self.bridge = CvBridge()
   self.image_sub = rospy.Subscriber("image_topic",Image,self.callback)

 def callback(self,data):
   try:
     cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
   except CvBridgeError as e:
     print(e)

   (rows,cols,channels) = cv_image.shape
   if cols > 60 and rows > 60 :
     cv2.circle(cv_image, (50,50), 10, 255)
   print('Above imshow function')
   cv2.imshow("Image window", cv_image)
   cv2.waitKey(3)

   try:
     self.image_pub.publish(self.bridge.cv2_to_imgmsg(cv_image, "bgr8"))
   except CvBridgeError as e:
     print(e)


def main(args):
 ic = image_converter()
 print('inside main ')
 rospy.init_node('image_converter', anonymous=True)
 try:
   rospy.spin()
 except KeyboardInterrupt:
   print("Shutting down")
 cv2.destroyAllWindows()

 if __name__ == '__main__':
   print('Function call started ')
   main(sys.argv)

rostopic hz :

 rostopic hz /ardrone/image_raw
   subscribed to [/ardrone/image_raw]
   average rate: 31.109
      min: 0.011s max: 0.051s std dev: 0.00873s window: 31
   average rate: 31.077
      min: 0.011s max: 0.059s std dev: 0.00947s window: 62
   average rate: 30.875
      min: 0.011s max: 0.061s std dev: 0.00909s window: 92
   average rate: 30.508

rosgraph is :

/ardrone/image_raw/compressedDepth/set_parameters
  /ardrone_driver/set_logger_level
  /ardrone/front/image_raw/compressedDepth/set_parameters
  /ardrone/setledanimation
  /ardrone/image_raw/theora/set_parameters
  /image_converter_3034_1485929043890/set_logger_level
  /ardrone/front/image_raw/compressed/set_parameters
  /ardrone/front/set_camera_info
  /ardrone/setflightanimation
  /ardrone/setrecord
  /image_converter_3034_1485929043890/get_loggers
  /rosout/set_logger_level
  /ardrone/image_raw/compressed/set_parameters
  /ardrone_driver/get_loggers
  /ardrone/togglecam
  /ardrone/flattrim
  /ardrone/bottom/image_raw/theora/set_parameters
  /ardrone/bottom/set_camera_info
  /ardrone/bottom/image_raw/compressed/set_parameters
  /ardrone/bottom/image_raw/compressedDepth/set_parameters
  /rosout/get_loggers
  /ardrone/setcamchannel
  /ardrone/front/image_raw/theora/set_parameters
2016-12-27 19:17:10 -0500 commented answer Is there a ROS simulation for parrot bebop drone 2 using bebop_autonomy?

@Mani Do you have support for Parrot bebop drone on Gazebo with Ros ?

2016-12-27 19:17:09 -0500 commented question Is there a ROS simulation for parrot bebop drone 2 using bebop_autonomy?

@AlexR : Have you got any support for simulation of bebop drone 2 on gazebo simulator ?

2016-12-27 19:17:09 -0500 commented answer Is there a ROS simulation for parrot bebop drone 2 using bebop_autonomy?

@errolflynn Have you simulated Parrot Bebop 2 with Gazebo ? Can you share the packages for simulating the Parrot Bebop ?