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

Cipek's profile - activity

2021-11-12 15:08:47 -0500 received badge  Famous Question (source)
2020-12-23 14:42:37 -0500 received badge  Notable Question (source)
2020-12-23 14:42:37 -0500 received badge  Famous Question (source)
2020-12-23 14:42:37 -0500 received badge  Popular Question (source)
2019-11-28 12:48:08 -0500 received badge  Famous Question (source)
2019-09-23 09:07:05 -0500 received badge  Notable Question (source)
2019-09-23 09:07:05 -0500 received badge  Popular Question (source)
2019-06-23 03:49:02 -0500 received badge  Notable Question (source)
2019-06-21 04:50:53 -0500 received badge  Enthusiast
2019-06-20 14:15:51 -0500 commented answer Scripts don't see ROS if executed by ProcessBuilder()

I have been looking for the solution really long and that worked! Thank you.

2019-06-20 14:15:07 -0500 received badge  Commentator
2019-06-20 14:15:07 -0500 commented answer Scripts don't see ROS if executed by ProcessBuilder()

It worked perfectly. Thank you.

2019-06-20 14:14:51 -0500 marked best answer Scripts don't see ROS if executed by ProcessBuilder()

I want to execute a script with a ProcessBuilder(). My code is:

new ProcessBuilder().inheritIO().command("/bin/bash", "-c", "./deploy.sh").start();

In the bash script I have:

#!/bin/bash
rosrun my_package ardrone_test_1.py

It works if I run the bash script manually in the terminal, but if I do with the ProcessBuilder I got an error:

rosrun: command not found

The same if I run python scripts which uses ROS. There are errors that some package are not found, whereas it works fine if run via terminal.

2019-06-20 14:02:17 -0500 received badge  Popular Question (source)
2019-06-20 09:08:50 -0500 received badge  Notable Question (source)
2019-06-20 09:08:50 -0500 received badge  Famous Question (source)
2019-06-20 09:08:50 -0500 received badge  Popular Question (source)
2019-06-20 09:08:48 -0500 received badge  Famous Question (source)
2019-06-20 09:08:48 -0500 received badge  Notable Question (source)
2019-06-20 09:08:48 -0500 received badge  Popular Question (source)
2019-06-19 16:34:00 -0500 asked a question How to move a drone by a given distance using ardrone_autonomy

How to move a drone by a given distance using ardrone_autonomy I am working on a script for controlling a drone with ard

2019-06-19 07:14:22 -0500 commented question ros::spinOnce() blocks publisher

Could you support me with some links or example for this statemachine pattern?

2019-06-19 07:11:01 -0500 commented question ros::spinOnce() blocks publisher

Could you support me with some links?

2019-06-19 06:11:05 -0500 asked a question Running OpenCV code- error: ‘DescriptorMatcher’ was not declared in this scope

Running OpenCV code- error: ‘DescriptorMatcher’ was not declared in this scope I have installed the OpenCV on my machine

2019-06-19 06:02:19 -0500 edited question ros::spinOnce() blocks publisher

ros::spinOnce() blocks publisher I am working on controlling the AR Drone with c++ script. I added the subscriber for ch

2019-06-19 06:01:08 -0500 asked a question ros::spinOnce() blocks publisher

ros::spinOnce() blocks publisher I am working on controlling the AR Drone with c++ script. I added the subscriber for ch

2019-06-18 18:05:10 -0500 marked best answer Callback for a Ardrone Navdata Subscriber doesn't work

I want to track the state of the AR Drone. For that, I have created a Subscriber, but for some reason, it doesn't go into my callback function. This is my code:

#include "ros/ros.h"
#include "std_msgs/Empty.h"
#include "std_msgs/String.h"
#include <iostream>
#include <ardrone_autonomy/Navdata.h>
using namespace std;
using namespace ros;
using namespace std_msgs;

//from ardrone_autonomy.msg import Navdata

ardrone_autonomy::Navdata data;
int state;

void receiveNavdata(const ardrone_autonomy::Navdata& data)
{
    cout<<"\nIN NAV"<<endl;
    cout<<"\nState: "<< data.state<<endl;   
    state=data.state;   
}

int main(int argc, char **argv){

  init(argc, argv, "talker");
    NodeHandle rospy;

    Subscriber navData = rospy.subscribe("/ardrone/navdata", 1, receiveNavdata);


while( state == -1){
    ros::spinOnce();
    ros::Duration(0.1).sleep();
}   

Publisher takeoff = rospy.advertise<Empty>("/ardrone/takeoff", 1);

while(takeoff.getNumSubscribers() < 1){
    ros::Duration(0.1).sleep();
}

cout<<"\nTakeOff"<<endl;

takeoff.publish(empty);
ros::Duration(5).sleep();

    return 0;
}
2019-06-18 15:28:43 -0500 edited question Callback for a Ardrone Navdata Subscriber doesn't work

Callback for a Ardrone Navdata Subscriber doesn't work I want to track the state of the AR Drone. For that, I have creat

2019-06-18 15:28:14 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

I edited it. The problem is that it never prints out "take off". It stays in the while loop just before the cout. But as

2019-06-18 15:09:14 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

I edited it. The problem is that it never prints out "take off"

2019-06-18 15:09:01 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

I edited it. The problem is that it never prints "take off"

2019-06-18 15:08:27 -0500 edited question Callback for a Ardrone Navdata Subscriber doesn't work

Callback for a Ardrone Navdata Subscriber doesn't work I want to track the state of the AR Drone. For that, I have creat

2019-06-18 15:08:27 -0500 received badge  Editor (source)
2019-06-18 13:44:30 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

it helped but now it blocks here while(takeoff.getNumSubcsribers() < 1){...}, but it doesn't when I do not do spinOnc

2019-06-18 13:44:15 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

it helped but now it blocks here while(takeoff.getNumSubcsribers() < 1){...}, but it doesn't when I do not do spnOnce

2019-06-18 13:06:51 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

it helped but now it blocks here while(takeoff.getNumSubcsribers() < 1){...}, but it doesn't when I do not do spnOnce

2019-06-18 12:59:21 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

You were right that spin(), but now I need to create a system which waits until the state is defined and do something. I

2019-06-18 12:53:07 -0500 commented answer Callback for a Ardrone Navdata Subscriber doesn't work

You were right that spin(), but now I need to create a system which waits until the state is defined and do something. I

2019-06-18 11:49:52 -0500 asked a question Callback for a Ardrone Navdata Subscriber doesn't work

Callback for a Ardrone Navdata Subscriber doesn't work I want to track the state of the AR Drone. For that, I have creat

2019-06-14 09:56:48 -0500 asked a question Scripts don't see ROS if executed by ProcessBuilder()

Scripts don't see ROS if executed by ProcessBuilder() I want to execute a script with a ProcessBuilder(). My code is: n

2019-06-14 05:59:13 -0500 received badge  Organizer (source)
2019-06-14 05:58:59 -0500 edited question Error when running python script with ProcessBuilder()- rospkg.common.ResourceNotFound: rosgraph

Error when running python script with ProcessBuilder()- rospkg.common.ResourceNotFound: rosgraph I want to run a python

2019-06-14 05:58:06 -0500 asked a question Error when running python script with ProcessBuilder()- rospkg.common.ResourceNotFound: rosgraph

Error when running python script with ProcessBuilder()- rospkg.common.ResourceNotFound: rosgraph I want to run a python

2019-06-12 12:41:15 -0500 commented answer Python script for controlling the AR Drone doesn't work

Okay. No worries. I'll do some research then.

2019-06-12 11:20:04 -0500 marked best answer Python script for controlling the AR Drone doesn't work

I have written a simple python script to takeoff the drone.

#! /usr/bin/env python
import rospy
from std_msgs.msg import Empty

rospy.init_node('cipek')

empty = Empty()
takeoff = rospy.Publisher('/ardrone/takeoff', Empty, queue_size=1)
land = rospy.Publisher('/ardrone/land', Empty, queue_size=1)

takeoff.publish(empty)
print("works")

I have created a package with catkin. In one terminal I run roscore, in the other rosrun ardrone_autonomy ardrone_driver and in third rosrun my_package script.py. The python script is runnable (I have run chmod +x on it), and it works because it print out "works". The problem is that the drone doesn't react at all. However, when I run rostopic pub ardrone/takeoff std_msgs/empty "{}" --once in the console it works perfectly. Any ideas what is wrong?