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

siddharthcb's profile - activity

2023-07-24 19:04:18 -0500 received badge  Nice Answer (source)
2022-10-03 10:47:27 -0500 marked best answer how to subscribe to laser /scan topic and publish a customized scan topic back

hi, i want to consider any 72 points from the 'scan' topic for my other application. Currently the lidar i am using gives around 2000 points. I want to take only 72 points out of it and publish it as a new topic 'revised_scan'. I tried with a small script in python:

#! /usr/bin/env python

import rospy
from sensor_msgs.msg import LaserScan
import sensor_msgs.msg

pub = rospy.Publisher('/revised_scan', LaserScan, queue_size = 10)

rev_scan = LaserScan()

def callback(msg):
    #print(len(msg.ranges)) len is 2019 from 0-360
    req_range = rev_scan.msg.ranges[0:72]
    pub.publish(req_range)

def listener():
    rospy.init_node('revised_scan', anonymous=True)
    sub = rospy.Subscriber('/scan', LaserScan, callback)
    rospy.spin()

if __name__ == '__main__':
    listener()

however, it gives me an error saying

[ERROR] [1613466169.831151]: bad callback: <function callback at 0x7f99a8d350>
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "rev_scan.py", line 12, in callback
    req_range = rev_scan.msg.ranges[0:72]
AttributeError: 'LaserScan' object has no attribute 'msg'

Though i can change directly in the lidars source file to publish two topics(scan & revised_scan) but I want to make this as a standard irrespective of the type of lidar I will use in the future.

I appreciate if someone can help with this.

2022-10-03 10:47:27 -0500 received badge  Self-Learner (source)
2022-02-22 11:03:43 -0500 received badge  Famous Question (source)
2021-10-12 06:46:12 -0500 commented question Two-way communication between master-slave not working

it is expected to work in inter-distro environment also because I use noetic on master and melodic on bot. I am sure it

2021-10-12 05:46:13 -0500 commented answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

what is the maximum range you want your lidar to read? It has to be occupied because it corresponds to some angle. Btw,

2021-10-12 04:05:07 -0500 commented question Two-way communication between master-slave not working

Try adding this too and see if it works.. export ROS_HOSTNAME=<laptop ip> in laptop export ROS_HOSTNAME=<robot

2021-10-12 04:00:52 -0500 commented question Two-way communication between master-slave not working

export ROS_MASTER_URI=http://LaptopIP::11311 ROS_IP=LaptopIP I think you have missed a export prefix before ROS_IP?

2021-10-12 03:54:15 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:53:47 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:52:55 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:47:36 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:45:31 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:45:24 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:44:45 -0500 edited answer sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 03:44:27 -0500 received badge  Rapid Responder (source)
2021-10-12 03:44:27 -0500 answered a question sensor_msgs/LaserScan.msg ==> range_max should be discarded

Usually your lidar launch file will have a range_max parameter. You can keep it to whatever your desired value is. If th

2021-10-12 01:00:59 -0500 edited answer ImportError: dynamic module does not define module export function (PyInit__tf2)

As @mgruhler and @gvdhoom pointed out, yes, prenoetic with python3 will land you in so many problems. its better to swit

2021-10-11 06:54:30 -0500 received badge  Notable Question (source)
2021-10-11 06:34:23 -0500 edited answer Usage of rosbridge with python

Try this for python. pip3 install roslibpy roslibpy works for non-ros/windows env too. import time import roslib

2021-10-11 06:33:37 -0500 answered a question Usage of rosbridge with python

Try this for python. pip3 install roslibpy roslibpy works for non-ros/windows env too. import time import roslib

2021-10-11 06:12:40 -0500 answered a question rosbridge websocket server over internet

Its been quite long since this thread came up but hope you have figured your way out of this problem. I was facing the s

2021-09-27 09:12:10 -0500 received badge  Famous Question (source)
2021-09-22 14:02:47 -0500 received badge  Necromancer (source)
2021-09-22 14:02:47 -0500 received badge  Teacher (source)
2021-07-14 05:14:11 -0500 received badge  Notable Question (source)
2021-07-13 05:23:49 -0500 commented question Problem finding depthimage_to_laserscan executable

Try opening a new terminal and source .bashrc , see if you can find the package with roscd. if yes, try launching it fro

2021-07-08 23:48:41 -0500 commented question Robot position not updating in RVIZ

can you provide more details? what are you trying to do? and what is your config like?

2021-07-07 05:48:31 -0500 commented question min_obstacle_height seems ignored in costmap_2d with laserscan pointcloud

include your sensor launch files

2021-07-06 13:04:36 -0500 answered a question ImportError: dynamic module does not define module export function (PyInit__tf2)

errors like these are also caused by python version problems. so change the first line of the script from #! /usr/bin/e

2021-07-06 02:08:17 -0500 answered a question AMCL randomly loses localisation.

for <param name="odom_model_type" value="diff-corrected"/> type robot, try to keep <param name="odom_alpha

2021-06-20 08:19:35 -0500 received badge  Famous Question (source)
2021-06-16 03:57:02 -0500 commented question Detecting Shapes after Euclidean Clustering

were you able to solve it?

2021-06-14 00:46:30 -0500 received badge  Popular Question (source)
2021-06-10 00:13:40 -0500 commented answer xacro macros model not showing up in rviz(noetic)

thanks @djchopp. it worked. i did not have to add an extra dummy link though.

2021-06-10 00:12:58 -0500 commented answer xacro macros model not showing up in rviz(noetic)

thanks @djchopp. it worked.

2021-06-10 00:12:25 -0500 marked best answer xacro macros model not showing up in rviz(noetic)

hi, I am trying to visualize xacro macros model on rviz which works fine in gazebo but i have few issues while visualizing it in rviz. in gazebo i am able to visualize the links, collision and inertia are properly configured but when i launch rviz i get this warning

    Unable to parse component [${base_length}] to a double (while parsing a vector value)
    [ERROR] [1623216223.772835121, 69.582000000]: Could not parse visual element for Link [base_link]

i tried rosparam load <myxacro.urdf.xacro> robot_description and the same error. i followed the solution in this thread but no luck.

and i also get robotmodel error.

    Parameter [robot_description] does not exist, and was not found by searchParam()

i tried running export LC_NUMERIC="en_US.UTF-8" before rviz but does not solve it.

my xacro files

inertials.xacro

<?xml version="1.0" ?>
<!--  xacro macros for inertials.

    Define xacro macros for math constants and inertials:

    - solid cuboid
    - solid cylinder
    - null (a placeholder inertial for logical link elements)
 -->
<robot name="inertials" xmlns:xacro="http://wiki.ros.org/xacro">

    <!-- Math constants -->
    <xacro:property name="math_pi"        value="3.141592653589793" />
    <xacro:property name="math_pi_over_2" value="1.5707963267948966" />
    <xacro:property name="math_pi_over_4" value="0.785398163397448" />

    <!-- Inertial for solid cuboid with dimensions x y z  -->
    <xacro:macro name="solid_cuboid_inertial" params="rpy xyz mass x y z">
        <inertial>
            <origin rpy="${rpy}" xyz="${xyz}"/>
            <mass value="${mass}" />
            <inertia
                ixx="${mass * (y * y + z * z) / 12.0}" ixy="0.0" ixz="0.0"
                iyy="${mass * (x * x + z * z) / 12.0}" iyz="0.0"
                izz="${mass * (x * x + y * y) / 12.0}" />
        </inertial>
    </xacro:macro>
    <solid_cuboid_inertial/>

    <!-- Inertial for solid cylinder with radius and length aligned to z-axis  -->
    <xacro:macro name="solid_cylinder_inertial" params="rpy xyz mass radius length">
        <inertial>
            <origin rpy="${rpy}" xyz="${xyz}"/>
            <mass value="${mass}" />
            <inertia
                ixx="${mass * (3.0 * radius * radius + length * length) / 12.0}" ixy="0.0" ixz="0.0"
                iyy="${mass * (3.0 * radius * radius + length * length) / 12.0}" iyz="0.0"
                izz="${mass * (radius * radius) / 2.0}" />
        </inertial>
    </xacro:macro>
    <solid_cylinder_inertial/>

    <!-- A null inertial - used in placeholder links to esure the model will work in Gazebo -->
    <xacro:macro name="null_inertial">
        <inertial>
            <mass value="0.001"/>
            <inertia ixx="0.001" ixy="0" ixz="0" iyy="0.001" iyz="0" izz="0.001"/>
        </inertial>
    </xacro:macro>
    <null_inertial/>

</robot>

materials.xacro

<?xml version="1.0" ?>
<!--  xacro macros for robot materials.
 -->
<robot name="materials" xmlns:xacro="http://wiki.ros.org/xacro">
   <material name="red">
        <color rgba="0.8 0 0 1"/>
    </material>

    <material name="green">
        <color rgba="0 0.8 0 1"/>
    </material>

    <material name="blue">
        <color rgba="0 0 0.8 1"/>
    </material>

    <material name="orange">
        <color rgba="0.8 0.25 0 1"/>
    </material>

wheel.xacro

< ...
(more)
2021-06-10 00:12:22 -0500 commented answer xacro macros model not showing up in rviz(noetic)

thanks ranjit. for my application, drivers werent needed it was a minor robot_description error as djchopp pointed.

2021-06-09 05:21:18 -0500 edited question xacro macros model not showing up in rviz(noetic)

xacro macros model not showing up in rviz(noetic) hi, I am trying to visualize xacro macros model on rviz which work

2021-06-09 05:19:49 -0500 asked a question xacro macros model not showing up in rviz(noetic)

xacro macros model not showing up in rviz(noetic) hi, I am trying to visualize xacro macros model on rviz which work

2021-05-28 06:25:00 -0500 commented question I tried simulating a differential drive robot in gazebo but it behaves strangely when controlled with teleop_twist.

I am facing similar problem. did you get it working?

2021-05-28 06:21:48 -0500 commented question how to detect downstairs or cliff using pointcloud

@parzival I havent got started with it yet. Upon my research, i realized it is possible through segmentation using pcl.

2021-05-28 06:17:34 -0500 received badge  Popular Question (source)
2021-05-27 13:03:06 -0500 received badge  Famous Question (source)
2021-05-27 05:14:03 -0500 commented answer Simulate GPS sensor via ROS plugins (Hector_Plugins)

I am working on hector gps too.. do you have a published journal or repo of your work?

2021-05-15 20:45:28 -0500 marked best answer ImportError: dynamic module does not define module export function (PyInit__tf2)

hi, i am trying to run a package built from source on ros melodic. when i run the command i end up with this error:

from tf import TransformListener
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf/__init__.py", line 30, in <module>
    from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 38, in <module>
    from tf2_py import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>
    from ._tf2 import *

from this i understood that it is conflicting with the python path but this solution did not work for me and i get the same error. is there any other way to setup catkin_ws with python3?