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

RSA_kustar's profile - activity

2021-12-23 00:09:24 -0500 received badge  Nice Question (source)
2021-03-22 05:12:08 -0500 received badge  Famous Question (source)
2021-01-28 04:41:17 -0500 received badge  Nice Question (source)
2020-10-12 04:07:08 -0500 marked best answer Frames and TFs are disappearing

I have two robot models. The first robot is the vehicle (AR.Drone) and the second is the Phantom Omni Device. I use rviz for visualization. I have problem with the tree of the TFs. Now for the AR.Drone, the parent frame is the 'world' frame while the parent frame for the Phantom Omni is the base frame. Now there are two problems. The first one is that when the TFs are shown in Rviz, the world frame appear for 3 seconds and starts to disappear. The second problem, the base TF is not shown. I want both robots to be shown with their URDF files but RViz only allow us to choose one Fixed frame.. What should I do ?

2020-05-26 05:46:36 -0500 received badge  Famous Question (source)
2020-04-06 01:37:37 -0500 received badge  Famous Question (source)
2020-04-06 01:37:37 -0500 received badge  Notable Question (source)
2020-03-09 06:00:29 -0500 received badge  Popular Question (source)
2020-03-09 06:00:29 -0500 received badge  Notable Question (source)
2020-03-09 06:00:29 -0500 received badge  Famous Question (source)
2019-09-20 02:38:07 -0500 marked best answer service state request callback function, error: Invalid number of arguments

Hi,

I created a service with the following definition and i called it navigation.srv:

float64 srvtype
float64 wayPointX
float64 wayPointY
float64 wayPointZ
float64 LDFlag
---
std_msgs/String navResponse

Then I used the service state machine provided from smach and following the tutorials:

import roslib;  
import rospy
import actionlib 
import smach
import smach_ros
import time
from std_msgs.msg import String
from sensor_msgs.msg import RegionOfInterest
from geometry_msgs.msg import PoseStamped 
from kuri_msgs.srv import navigation

from kuri_msgs.msg import Object
from sensor_msgs.msg import NavSatFix
from nav_msgs.msg import Odometry
from smach_ros import ServiceState

 FixPoseX = 0   
 FixPoseY = 0 
 FixPoseZ = 10  


class Ch1():
 rospy.init_node('ch1_state_machine')
 sm = smach.StateMachine(outcomes=['Done'])

 with sm:

    def exploration_request_cb (userdata,request):
        exploration_request = navigation().Request  
        exploration_request.srvtype=1
        exploration_request.wayPointX = FixPoseX
        exploration_request.wayPointY = FixPoseY
        exploration_request.wayPointZ = FixPoseZ
        exploration_request.LDFlag = 0
        return exploration_request



        smach.StateMachine.add('EXPLORATION',
                ServiceState('controller_service',
                navigation,
                request  = exploration_request_cb),
                       transitions={'succeeded':'MARKER_DETECTION' , 'aborted':'Done', 'preempted':'EXPLORATION'})

    ### MORE STATES HERE

 sis = smach_ros.IntrospectionServer('server_name', sm, '/SM_ROOT')
     sis.start()

     # Execute SMACH plan
     outcome = sm.execute()
     rospy.spin()
     sis.stop()


if __name__ == '__main__':
   Ch1()

The Service the I am using to be called ( I am also having a problem in sending back a response is as follow)

when I run the state machine it says that it is waiting for the service then I run the service the output is the following:

 import roslib
 import rospy
 from kuri_msgs.msg import *
 from kuri_msgs.srv import navigation
 from kuri_msgs.srv import navigationResponse
 from geometry_msgs.msg import PoseStamped 
 from nav_msgs.msg import Odometry 

 class ControllerService:
         def __init__(self):
               print 'Starting Service 1'
               self.s = rospy.Service('controller_service', navigation , self.pos_vel_controller)   

        def pos_vel_controller(self , req):
            self.landFlagDone = req.LDFlag 
                if req.srvtype == 1 :
                         x = req.wayPointX
             y  = req.wayPointY
                 z = req.wayPointZ
             if self.landFlagDone >0:
#######################3 How to return a response here ???????????????????
                 return 'succeeded'
             else: 
                    return 'aborted'


def main(args):
  rospy.init_node('Controller_Service')
  Controller = ControllerService()
  try:
     rospy.spin()
 except KeyboardInterrupt:
    print "Shutting down"

if __name__ == '__main__':
    main(sys.argv)

In the service terminal Killed

In the state machine terminal

 TypeError: Invalid number of arguments, args should be ['srvtype', 'wayPointX', 'wayPointY', 'wayPointZ', 'LDFlag'] args are(<function exploration_request_cb at 0x7f0f3fae6140>,)

What is the mistake in this code and how can I fix it ?

2019-08-01 06:51:32 -0500 marked best answer roscore is not working and cant install pip or rospkg ??

I has frute then I remove it and I downloaded hydro. I followed the steps until I reached to this step:

sudo rosdep init

I got the following error:

Traceback (most recent call last):
 File "/usr/bin/rosdep", line 3, in <module>
from rosdep2.main import rosdep_main
File "/usr/lib/pymodules/python2.7/rosdep2/__init__.py", line 40, in <module>
from .installers import InstallerContext, Installer, \
File "/usr/lib/pymodules/python2.7/rosdep2/installers.py", line 35, in <module>
from rospkg.os_detect import OsDetect
ImportError: No module named rospkg.os_detect

Then I looked for a solution and I did the following:

pip install -U rospkg

I got the following error :

Downloading/unpacking rospkg
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement rospkg
No distributions at all found for rospkg
Storing complete log in /home/asctec/.pip/pip.log
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.0', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 116, in main
return command.main(initial_args, args[1:], options)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 147, in main
 log_fp = open_logfile(log_fn, 'w')
 File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 176, in open_logfile
 log_fp = open(filename, mode)
IOError: [Errno 13] Permission denied: '/home/asctec/.pip/pip.log'

Also I tried:

sudo pip install --upgrade pip

and I got the following error:

Downloading/unpacking pip
Downloading pip-1.5.6.tar.gz (938Kb): 40Kb downloaded  
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
 File "/usr/lib/python2.7/dist-packages/pip/req.py", line 955, in prepare_files
 self.unpack_url(url, location, self.is_download)
 File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1072, in unpack_url
 return unpack_http_url(link, location, self.download_cache, only_download)
 File "/usr/lib/python2.7/dist-packages/pip/download.py", line 441, in unpack_http_url
 download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 366, in _download_url
 chunk = resp.read(4096)
 File "/usr/lib/python2.7/socket.py", line 380, in read
 data = self._sock.recv(left)
 File "/usr/lib/python2.7/httplib.py", line 561, in read
 s = self.fp.read(amt)
 File "/usr/lib/python2.7/socket.py", line 380, in read
 data = self._sock.recv(left)
 File "/usr/lib/python2.7/ssl.py", line 241, in recv
 return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 160, in read
  return self._sslobj.read(len)
  SSLError: The read operation timed out
 Storing complete log in /home/asctec/.pip/pip.log
 Traceback (most recent call last):
 File "/usr/bin/pip", line 9, in <module>
  load_entry_point('pip==1.0', 'console_scripts', 'pip')()
 File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line ...
(more)
2019-08-01 06:51:32 -0500 received badge  Self-Learner (source)
2019-07-15 01:24:30 -0500 received badge  Notable Question (source)
2019-07-14 06:55:14 -0500 edited question Writing map.ot file generates lines with the same adress

Writing map.ot file generates lines with the same adress Hi, I am trying to save the octomap in ".ot" format and visua

2019-07-14 06:53:19 -0500 asked a question Writing map.ot file generates lines with the same adress

Writing map.ot file generates lines with the same adress Hi, I am trying to save the octomap in ".ot" format and visua

2019-07-14 04:30:56 -0500 received badge  Popular Question (source)
2019-07-09 04:17:23 -0500 commented question readData and writeData function for ColorOctree visualization is giving white color in RVIZ els

@TharushiDeSilva No I can't visualize it using octovis. I got a msg "cannot open Octree file"

2019-07-08 06:42:44 -0500 commented question readData and writeData function for ColorOctree visualization is giving white color in RVIZ els

@TharushiDeSilva I am using /octomap_full topic and the voxel coloring is the cell color but still all voxels are white

2019-07-08 06:42:13 -0500 commented question readData and writeData function for ColorOctree visualization is giving white color in RVIZ els

@TharushiDeSilva I am using /octomap_full topic and the voxel coloring is the cell color but still all voxels are white

2019-07-08 06:37:47 -0500 commented question readData and writeData function for ColorOctree visualization is giving white color in RVIZ els

@TharushiDeSilva I am using /octomap_full topic and the voxel coloring is the cell color but still all voxels are white

2019-07-07 06:52:42 -0500 asked a question ColorOctree readData and writeData functions' visualization in RVIZ shows white voxels all the time

ColorOctree readData and writeData functions' visualization in RVIZ shows white voxels all the time Hi, I am creating

2019-07-07 06:46:23 -0500 asked a question readData and writeData function for ColorOctree visualization is giving white color in RVIZ els

readData and writeData function for ColorOctree visualization is giving white color in RVIZ els Hi, I am creating a co

2019-03-14 02:51:58 -0500 received badge  Notable Question (source)
2019-03-14 02:51:58 -0500 received badge  Famous Question (source)
2019-03-14 02:51:58 -0500 received badge  Popular Question (source)
2019-03-12 06:17:44 -0500 marked best answer Subscriber and publisher in the same node not working with costum msg

Hello,

I know that this question might be asked before, but I did not find the final solution for it. Here is the question:

I want to write a node that subscribe for data from a topic then publish these data to another topic. So, mainly I want a publisher and subscriber in the same node. So What I did so far is the following:

#include "ros/ros.h"
#include <geometry_msgs/Twist.h>
#include "pctx_control/Control.h"
#include "std_msgs/String.h"
#include "pctx_control/pctx.h" 
#include <sstream>


pctx_control::Control controlmsg ;

void function_callback (const geometry_msgs::Twist &msg) 
 {

controlmsg.ch = 0 ;
controlmsg.values[0] = msg.linear.x;
controlmsg.values[1] = msg.linear.y;
controlmsg.values[2] = msg.linear.z;
std::cout << "d1"<<controlmsg.values[0] << std::endl ;
std::cout << "d2" <<controlmsg.values[1]<< std::endl ;
std::cout << "d3" <<controlmsg.values[2]<< std::endl ;

}

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

 ros::init(argc, argv, "my_node");
  ros::NodeHandle n;
 ros::Publisher pub = n.advertise<pctx_control::Control>("topic2", 100);

  ros::Subscriber sub = n.subscribe("topic1", 1000, function_callback);

 ros::Rate loop_rate(10);
 ros::spinOnce();

 int count = 0;
 while (ros::ok())
  {

    pub.publish(controlmsg);

  ros::spin();
  loop_rate.sleep();

 }

return 0;
 }

I want to save data that I want to publish in a "custom msg" pctx_control::Control type;

This msg has the following format:

int32 ch
int32 value
int16[] values
2018-11-06 12:15:39 -0500 marked best answer Transform from laser frame to odom frame using transformation matrix in ROS c++

I am using a pioneer3AT with a Hykuoy laser finder. when I run the RosAria, I have 2 frames The odom frame ( fixed frame wich represent the start of the movement) and the baselink frame which is attached to the body of the robot.

Also, when I run the URG_node I get another frame which is the laser frame.

I added the laser in the same direction of the base_link and I calculated the distance from the base_link frame to the laser frame is [0.206 0 0.16] in meters and I created a static tf transformation between the laser and the baselink as following.

  <launch>
  <node pkg="tf" type="static_transform_publisher" name="laser_frame" args="0.206 0 0.16 0 0 0 1 base_link laser 100" />
 </launch>

My TF tree is as follows: odom -> base_link -> laser

now, in the code, I am reading the sensor_msgs/laserScan msgs as (r, theta) -->

What I want is to do transformation these data from laser frame to odom frame ?? how can I do that in ROS (in c++)??

2018-09-18 19:55:06 -0500 marked best answer ar_pose_marker from ar_pose packge not published

I would like to run the ar_pose package and read the ar_pose_marker_ data. I did the following

I have the following two packages : 1- ar_pose 2- uvc_camera

I run the following two launch files:

<launch>
<node pkg="tf" type="static_transform_publisher" name="world_to_marker"  args="0 1 1 -1.57 3.14 -1.57 world ar_marker 10" />
<node pkg="tf" type="static_transform_publisher" name="marker_to_cam" args="0 0 0.5 0 0 0 ar_marker camera 10" />
<node ns="camera" pkg="image_proc" type="image_proc" name="image_proc"/>
<node name="ar_pose" pkg="ar_pose" type="ar_single" respawn="false" output="screen">
   <param name="marker_pattern" type="string" value="data/4x4/4x4_1.patt"/>
   <param name="marker_width" type="double" value="152.4"/>
   <param name="marker_center_x" type="double" value="0.0"/>
   <param name="marker_center_y" type="double" value="0.0"/>
   <param name="threshold" type="int" value="100"/>
   <param name="use_history" type="bool" value="true"/>
    <param name="reverse_transform" type="bool" value="true"/>
</node>
</launch>

Then I run the camera launch file

<launch>
  <node pkg="uvc_camera" type="uvc_camera_node" name="uvc_camera" output="screen" ns="/camera">

    <param name="width" type="int" value="320" />
    <param name="height" type="int" value="240" />
    <param name="fps" type="int" value="30" />
    <param name="frame" type="string" value="camera" />
   <param name="auto_focus" type="bool" value="False" />
   <param name="focus_absolute" type="int" value="0" />
   <!-- other supported params: auto_exposure, exposure_absolute, brightness, power_line_frequency -->

   <param name="device" type="string" value="/dev/video0" />
   <param name="camera_info_url" type="string" value="file://$(find uvc_camera)/example.yaml" />
 </node>
</launch>

Then I run RVIZ and I put the fixed frames world. I could not find the ar_pose_marker_ at all ?? is there a plug-in for it since it is type of ARMARKER msgs Also, I cant see anything on top of the images as provided in the package description In addition, I tried to subscribe for the ar_pose_marker but there is no data as if the node ar_pose_single is not publishing it

How can I fix this and get the ar_pose_marker_ data ???

I attached Image for the rqt_graph and the output from Rviz for tf, camera , and the command line that shows that there are no output for the ar_pose_marker topic

image description

image description

EDIT:

The launch file has been edited to add the marker in the ground to be as ( 0, 0, 0) position or we can say that is is equal to the world frame and we remove the transformation between the camera and the marker because we actually need to obtain the position of the camera.. therefore the launch file will become as the following:

<launch>
<node pkg="tf" type="static_transform_publisher" name="world_to_marker"  args="0  0 0 0 0 0 world ar_marker 10" />
<node ns="camera" pkg="image_proc" type="image_proc" name="image_proc"/>
<node name="ar_pose" pkg="ar_pose" type="ar_single" respawn="false" output="screen">
   <param name="marker_pattern" type="string" value="data/4x4/4x4_1.patt"/>
   <param name="marker_width" type="double" value="152.4"/>
   <param name="marker_center_x" type="double" value="0.0"/>
   <param name="marker_center_y" type="double" value="0.0"/>
   <param name="threshold" type="int" value="100"/>
   <param name="use_history" type="bool" value="true"/>
    <param ...
(more)
2018-08-19 11:42:22 -0500 received badge  Famous Question (source)
2018-08-08 01:37:30 -0500 marked best answer Collision detection using fcl and ros wiki for octree and regular object

I have two objects. The first object is my robot which I want to represent it as a shpare and the second object is the obstacle that has unkonwn shape. I want to represent the shape of the obstacle with octree.

how can i use the api of the fcl to check collision between these two objects ( true or false) usinf fcl libraries using the api form ROS wiki? giving that the robot is moving.

Also, the obstacle is detected using laser scan data?? how to fill it in octree object ??

EDIT:

I wrote the following code but I dont know how to fill the octree

boost::shared_ptr<Sphere> Shpere0(new Sphere(1));
OcTree* tree = new OcTree(boost::shared_ptr<const octomap::OcTree>(generateOcTree()));
// GJKSolver_indep solver;
GJKSolver_libccd solver;
Vec3f contact_points;
FCL_REAL penetration_depth;
Vec3f normal;
Transform3f tf0, tf1;
tf0.setIdentity();
tf0.setTranslation(Vec3f(robotpose(0),robotpose(1),robotpose(2)));
tf0.setQuatRotation(Quaternion3f(0, 0, 0, 0));

 // HOW TO FILL the OCTREE HERE with point cloud data ???  
  tf1.setIdentity();
 bool res = solver.shapeIntersect(*Shpere0, tf0, *box1, tf1, &contact_points, &penetration_depth, &normal);
 cout << "contact points: " << contact_points << endl;
 cout << "pen depth: " << penetration_depth << endl;
 cout << "normal: " << normal << endl;
 cout << "result: " << res << endl;
 static const int num_max_contacts = std::numeric_limits<int>::max();
 static const bool enable_contact = true;
 fcl::CollisionResult result;
 fcl::CollisionRequest request(num_max_contacts, enable_contact);
 CollisionObject co0(Shpere0, tf0);
 CollisionObject co1(tree, tf1);
bool res_1 =   fcl::collide(&co0, &co1, request, result);

??

How can I fill the octree or octmap to be presented as an object and I can use the function collied to check if the shapre ( which represent my robot) is going to collied with the octree or octmap that I should construct from a point cloud data ?

2018-04-10 10:05:12 -0500 marked best answer static transformation publisher

I want to do a static transformation

the actual frame is in x forward y right z up the new frame if x forward y left and z up

I want to do transformation from the new to the actual frame using the static publish

<launch>

 <node pkg="tf" type="static_transform_publisher" name="laser" args="0 0 0 x y z w  /uav/base_link_ENU /laser  100"/>

</launch>

What should I replace the x y z and w
And do I need to have a listener ??

2018-04-06 04:19:37 -0500 received badge  Famous Question (source)
2018-02-20 07:47:12 -0500 received badge  Notable Question (source)
2018-02-20 07:47:12 -0500 received badge  Famous Question (source)
2018-02-11 21:00:37 -0500 received badge  Notable Question (source)
2017-12-03 17:05:07 -0500 marked best answer can not add a name space to spawn node

I have the following launch file:

<?xml version="1.0"?>

<launch>
    <!--<include file="$(find husky_gazebo)/launch/base.urdf.gazebo.launch"/>-->
     <param name="use_sim_time" value="true" />

    <!-- Send the Husky A200 Robot URDF/XACRO to param server -->
    <param name="robot_description" command="$(find xacro)/xacro.py '$(find husky_description)/urdf/base.urdf.xacro'" />

    <!-- Spawn robot in gazebo -->
    <node name="spawn_husky_model" pkg="gazebo_ros"  type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model mobile_base />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" ns="husky_ns">
        <param name="publish_frequency" type="double" value="50.0" />
    </node>




    <include file="$(find gazebo_ros)/launch/empty_world.launch"/>
    <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf" ns="husky_ns" >
      <rosparam>
        freq: 10.0
        sensor_timeout: 1.0
        publish_tf: true
        odom_used: true
        vo_used: true
        output_frame: odom
      </rosparam>
    </node>
</launch>

I want to add a name space to this node but I cant

 <!-- Spawn robot in gazebo -->
    <node name="spawn_husky_model" pkg="gazebo_ros"  type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model mobile_base ns="husky_ns" />

Why I cant add ? and how can I add a name space for this node ?