Ask Your Question

Nelle's profile - activity

2019-09-13 16:51:16 -0500 marked best answer What is rospy.sleep for?

Really confused here. I want to delay certain publishing of messages to a topic for about 1-2 seconds. Can rospy.sleep help? My code already works fine, but I need the delay since I cannot put any delays in the Arduino/rosserial because it gives a lost sync error. Can someone please help? I've been doing this for 2 weeks and no solution so far. Here is my code.

#!/usr/bin/env python


import rospy
import time

from std_msgs.msg import Int32  
from sensor_msgs.msg import Range

flags = Int32()

class warning_flag():
    def __init__(self):
        self.aIR_FR = None
        self.aIR_FL = None
        self.dIR_front = None
        self.dIR_BR = None
        self.dIR_BL = None
        self.sonic = None

    def aIR_FR_callback(self, aIR_FR_msg):
        print "Analog IR Right Range: %s" % aIR_FR_msg.range
        self.aIR_FR = aIR_FR_msg.range
        self.warn()

    def aIR_FL_callback(self, aIR_FL_msg):
        print "Analog IR Left Range: %s" % aIR_FL_msg.range
        self.aIR_FL = aIR_FL_msg.range
        self.warn()

    def dIR_BL_callback(self, dIR_BL_msg):
        print "Digital IR Left Range: %s" % dIR_BL_msg.range
        self.dIR_BL = dIR_BL_msg.range
        self.warn()

    def dIR_BR_callback(self, dIR_BR_msg):
        print "Digital IR Right Range: %s" % dIR_BR_msg.range
        self.dIR_BR = dIR_BR_msg.range
        self.warn()

    def dIR_front_callback(self, dIR_front_msg):
        print "Digital IR Range: %s" % dIR_front_msg.range
        self.dIR_front = dIR_front_msg.range
        self.warn()

    def sonic_callback(self, sonic_msg):
        print "Ultrasonic Range: %s" % sonic_msg.range
        self.sonic = sonic_msg.range    
        self.warn()

    def warn(self):
        sonic_zone = 0.3
        aIR_FR_zone = 0.2
        aIR_FL_zone = 0.2
        dIR_front_zone = 0
        dIR_BR_zone = 1
        dIR_BL_zone = 1

        if (self.aIR_FR > aIR_FR_zone and self.aIR_FL <= aIR_FL_zone):
            print "Turn right"
            flags.data = 2

    elif (self.aIR_FR <= aIR_FR_zone and self.aIR_FL > aIR_FL_zone):
            print "Turn Left"
            flags.data = 3

        elif (self.aIR_FR <= aIR_FR_zone and self.aIR_FL <= aIR_FL_zone):
            if ((self.sonic > sonic_zone and self.dIR_front != dIR_front_zone) or
        (self.sonic <= sonic_zone and self.dIR_front != dIR_front_zone)):    
                if (self.dIR_BR != dIR_BR_zone and self.dIR_BL != dIR_BL_zone):
                    print "Stop"
                    flags.data = 5
                else:    
                    if (self.aIR_FR > self.aIR_FL):
                        print "Turn Right"
                        flags.data = 2
                    else:
                        print "Turn Left"
                        flags.data = 3

        elif ((self.sonic > sonic_zone and self.dIR_front == dIR_front_zone) or
        (self.sonic <= sonic_zone and self.dIR_front == dIR_front_zone)):
                if (self.dIR_BR == dIR_BR_zone and self.dIR_BL == dIR_BL_zone):
                    print "Back off"
                    flags.data = 4
            #put delay here
            if (self.aIR_FR > self.aIR_FL):
                       print "Turn Right"
                        flags.data = 2
                    else:
                        print "Turn Left"
                        flags.data = 3
                else:    
                    if (self.aIR_FR > self.aIR_FL):
                        print "Turn Right"
                        flags.data = 2
                    else:
                        print "Turn Left"
                        flags.data = 3

        elif (self.aIR_FR > aIR_FR_zone and self.aIR_FL > aIR_FL_zone):
            if (self.sonic > sonic_zone and self.dIR_front == dIR_front_zone):
        print "Advance"
        flags.data = 1                
        else:   
        if (self.dIR_BR == dIR_BR_zone and self.dIR_BL == dIR_BL_zone):
                    print "Back off"
                    flags.data = 4
            #put delay here
            if (self.aIR_FR > self.aIR_FL):
                        print "Turn Right"
                        flags.data = 2
                    else:
                        print "Turn Left"
                        flags.data = 3
                else:    
                    if (self.aIR_FR > self.aIR_FL):
                        print "Turn Right"
                        flags.data = 2
                    else:
                        print "Turn Left"
                        flags.data = 3

def main():
    rospy.init_node('sensor_pub_sub_node')
    warn_pub=rospy.Publisher('Warnings', Int32, queue_size=1000)
    warning = warning_flag()
    aIR_FR_sub=rospy.Subscriber('aIR_FR', Range, warning.aIR_FR_callback)
    aIR_FL_sub=rospy.Subscriber('aIR_FL', Range, warning.aIR_FL_callback)
    dIR_BR_sub=rospy.Subscriber('dIR_BR', Range, warning ...
(more)
2019-07-18 08:35:57 -0500 received badge  Famous Question (source)
2019-06-24 10:43:55 -0500 received badge  Notable Question (source)
2019-06-24 10:43:55 -0500 received badge  Popular Question (source)
2019-06-24 04:22:30 -0500 received badge  Notable Question (source)
2019-03-01 16:34:31 -0500 marked best answer raspicam_node and face_detector node together

Hi!

I seem to be confused about using face_detection in my custom bot. I have an RPi camera and want to use it to detect faces. I found one here. And I also found this neat face_detector package. Can someone please show me how this can be done? I'm running my ROS kinetic on raspbian and raspberry pi v3.

I want my camera to detect faces and at the same time, display the results using Rviz in my ros-enabled remote computer.

2019-03-01 16:30:54 -0500 marked best answer How to autonavigate in an unknown map

I have a custom robot running on raspberry pi(raspbian) with ROS kinetic. I have understood from this that for the robot to avoid obstacles, there must be a known map that will only be generated by manually controlling the robot using either joystick or keyboard, etc. Can it be possible for the robot to autonomously navigate through an unknown map and avoid obstacles? Where can I find such package and how do I integrate this with my custom robot? My robot does not have any LIDARs, btw. It has an ultrasonic sensor in front, 2 analog IR sensors in the front sides and 2 digital IR sensors in the back.

2019-01-31 04:51:17 -0500 received badge  Famous Question (source)
2018-12-21 03:15:33 -0500 received badge  Famous Question (source)
2018-12-01 17:25:37 -0500 received badge  Famous Question (source)
2018-10-24 09:52:09 -0500 received badge  Notable Question (source)
2018-10-06 06:12:52 -0500 received badge  Famous Question (source)
2018-10-05 13:48:28 -0500 received badge  Famous Question (source)
2018-09-19 12:32:53 -0500 received badge  Notable Question (source)
2018-09-13 09:11:31 -0500 received badge  Student (source)
2018-09-13 02:55:45 -0500 received badge  Notable Question (source)
2018-09-13 02:49:52 -0500 commented answer Is people detection enough for them to be marked on a simulated map like in rviz?

how can make the robot move towards the image using 2D images? Do I need YOLO to publish certain msgs like this one?

2018-09-13 02:17:17 -0500 received badge  Popular Question (source)
2018-09-13 02:07:51 -0500 commented answer Is people detection enough for them to be marked on a simulated map like in rviz?

We do not have wheel encoders too, btw. So I'm not really sure how to move the robot towards the person it detected.

2018-09-13 02:05:56 -0500 commented answer Is people detection enough for them to be marked on a simulated map like in rviz?

Our ROS-YOLO only publishes binary data like 1 if there is a person detected or 2 if there are no person detected. If we

2018-09-13 01:41:13 -0500 commented question Is people detection enough for them to be marked on a simulated map like in rviz?

If I want my robot to go to a detected person, do I need a tracking package?

2018-09-13 01:10:30 -0500 asked a question Is people detection enough for them to be marked on a simulated map like in rviz?

Is people detection enough for them to be marked on a simulated map like in rviz? Hello all. We are now in the later pa

2018-09-10 15:51:02 -0500 received badge  Famous Question (source)
2018-09-10 04:41:21 -0500 received badge  Popular Question (source)
2018-09-10 01:49:15 -0500 commented question ROS YOLO on rpi3 and movidius

Do you know any ros-yolo package that can run on raspberry pi and movidius?

2018-09-10 01:42:49 -0500 commented question ROS YOLO on rpi3 and movidius

We are aiming to make the detections on board the RPi. I don't see any ros-yolo packages in the internet that runs on rp

2018-09-10 01:39:49 -0500 commented question ROS YOLO on rpi3 and movidius

No customizations were done. They just tested if YOLO v3 would run on rpi and movidius, and it works. Now the problem is

2018-09-10 01:29:37 -0500 received badge  Popular Question (source)
2018-09-10 01:21:55 -0500 asked a question ROS YOLO on rpi3 and movidius

ROS YOLO on rpi3 and movidius We are on a project to make a rescue-robot that detects persons using YOLO and movidius mo

2018-09-07 03:17:07 -0500 received badge  Notable Question (source)
2018-09-05 01:21:31 -0500 received badge  Popular Question (source)
2018-09-04 23:18:45 -0500 received badge  Popular Question (source)
2018-09-04 20:53:16 -0500 commented answer What is rospy.sleep for?

I tried to put it in my code and it doesn't seem to work. It keeps coming back to back off even if my sensors for other

2018-09-04 20:52:52 -0500 commented answer What is rospy.sleep for?

I tried to put it in my code and it doesn't seem to work. It keeps coming back to back off.

2018-09-04 19:25:46 -0500 commented answer What is rospy.sleep for?

Can I use rospy.sleep in my code then? Just to pause for a few seconds? I want to delay the publishing of a message for

2018-09-04 19:11:11 -0500 edited question What is rospy.sleep for?

What is rospy.sleep for? Really confused here. I want to delay certain publishing of messages to a topic for about 1-2 s

2018-09-04 19:00:39 -0500 asked a question What is rospy.sleep for?

What is rospy.sleep for? Really confused here. I want to delay certain publishing of messages to a topic for about 1-2 s

2018-09-04 02:53:33 -0500 commented question Use Arduino Libraries in ROS

If I can't use delays in rosserial, can I instead delay the publishing of a message? So it looks like I'm delaying too?

2018-09-04 02:50:26 -0500 commented question Use Arduino Libraries in ROS

The library for the sensors was just to simplify the code and put all the functions for the sensors in a neat library. S

2018-09-04 02:45:41 -0500 commented question Use Arduino Libraries in ROS

Do I need to include the rosserial library in my custom library?

2018-09-04 02:43:12 -0500 commented question Lost sync with device, restarting... when Arduino code have delay

The linked question is one of my other problems. But since the library part is not working, I resorted to the one withou

2018-09-04 00:42:47 -0500 asked a question Lost sync with device, restarting... when Arduino code have delay

Lost sync with device, restarting... when Arduino code have delay Hello all. I have a problem with rosserial. I have a

2018-09-03 21:04:21 -0500 asked a question Use Arduino Libraries in ROS

Use Arduino Libraries in ROS Hello all. I have made a publisher/subscriber for rosserial to communicate with Arduino. T

2018-08-25 23:04:47 -0500 received badge  Notable Question (source)
2018-08-23 14:46:50 -0500 received badge  Popular Question (source)
2018-08-21 21:57:44 -0500 asked a question How to autonavigate in an unknown map

How to autonavigate in an unknown map I have a custom robot running on raspberry pi(raspbian) with ROS kinetic. I have u

2018-08-21 20:01:58 -0500 asked a question Can I use ROS YOLO with a raspberry pi camera?

Can I use ROS YOLO with a raspberry pi camera? I am very unfamiliar with YOLO and computer vision in general. I just wan

2018-08-17 15:17:54 -0500 received badge  Notable Question (source)
2018-08-17 03:04:15 -0500 received badge  Popular Question (source)