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

mohamed ahmed's profile - activity

2023-08-07 17:43:44 -0500 received badge  Nice Answer (source)
2023-02-01 06:17:29 -0500 received badge  Nice Question (source)
2022-06-16 06:42:32 -0500 received badge  Famous Question (source)
2022-06-03 06:06:37 -0500 answered a question Can a ros node do the equivalent of 'rosnode ping'

You can use rosnode_ping_all() or rosnode_ping() import rosnode alive_nodes, unpinged_nodes = rosnode.rosnod

2022-06-03 06:03:18 -0500 received badge  Famous Question (source)
2022-04-28 18:25:38 -0500 marked best answer adding std_msgs Int16 and int ?

i made a simple publisher which publish a Int16. the problem is in the subscriber i try to receive the int16 and add a constant number to it for example 2 the publisher code:

#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import Int16
import random
def ty():
    pub = rospy.Publisher('to', Int16, queue_size=10)
    rospy.init_node('talker1')
    r = rospy.Rate(1) # 1hz
    while not rospy.is_shutdown():

        value=random.randint(0, 100)
        print(value)
        pub.publish(value)
        r.sleep()
if __name__ == '__main__':
    try:
        ty()
    except rospy.ROSInterruptException:
        pass

the subscriber code:

#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import Int16

def cb(x):
    rospy.loginfo(x+2)
def listener():


    # In ROS, nodes are uniquely named. If two nodes with the same
    # node are launched, the previous one is kicked off. The
    # anonymous=True flag means that rospy will choose a unique
    # name for our 'listener' node so that multiple listeners can
    # run simultaneously.
    rospy.init_node('listener', anonymous=True)

    rospy.Subscriber("to", Int16, cb)
    rospy.spin()

if __name__ == '__main__':
    listener()

i got this error :

TypeError: unsupported operand type(s) for +: 'Int16' and 'int'

how can i solve this problem

2021-06-21 04:50:05 -0500 received badge  Notable Question (source)
2021-05-12 04:48:15 -0500 received badge  Popular Question (source)
2021-05-07 07:56:54 -0500 received badge  Notable Question (source)
2021-05-07 07:56:29 -0500 commented question How to correctly translate a pose along an axis?

This answer might be helpful https://answers.ros.org/question/222306/transform-a-pose-to-another-frame-with-tf2-in-pytho

2021-04-27 08:58:35 -0500 received badge  Famous Question (source)
2021-04-22 13:59:47 -0500 received badge  Necromancer (source)
2021-04-21 08:03:12 -0500 commented question How to run turtlebot in Gazebo using a python code

To check if the script(python code) is working Run this python script. And in another terminal run rostopic echo /cmd_ve

2021-04-09 05:49:13 -0500 edited answer What is the size of octomap?

To know the amount of unkown by using this method. getUnknownLeafCenters for example: ourmap.getUnknownLeafCenters(l, m

2021-04-09 05:49:13 -0500 received badge  Editor (source)
2021-04-09 03:16:31 -0500 answered a question What is the size of octomap?

To know the amount of unkown by using this method. getUnknownLeafCenters

2021-04-09 03:09:43 -0500 received badge  Popular Question (source)
2021-04-09 03:06:02 -0500 commented answer Orocos kdl not installed

I didn't follow the steps by myself, but according to the instruction after building the workspace you should have a oro

2021-04-09 03:06:02 -0500 received badge  Commentator
2021-04-09 02:45:59 -0500 answered a question Orocos kdl not installed

to install orocos_kdl sudo apt install liborocos-kdl-dev is ros_mara_ws your custom workspace or you are following a tu

2021-04-09 02:45:59 -0500 received badge  Rapid Responder (source)
2021-04-07 02:55:21 -0500 edited answer Is there a way to extract the edge with coordinates out of occupancy map in ROS?

You can iterate over the leafs of your map and set the bounding box(which has values around your robot) for (octomap::O

2021-04-07 02:51:21 -0500 answered a question Is there a way to extract the edge with coordinates out of occupancy map in ROS?

You can iterate over the leafs of your map and set the bounding box(which has values around your robot) for (octomap::O

2021-04-07 02:51:21 -0500 received badge  Rapid Responder (source)
2021-04-06 04:05:43 -0500 commented question How to remap /move_base_simple/goal to my own topic in turtlebot3_navigation?

Can you try to edit the launch file add remap to it and check if it is working <remap from="/move_base_simple/goal" t

2021-04-05 01:25:50 -0500 answered a question CMake Error: Could not find module Findcatkin_simple.cmake

Clone this repo into your workspace/src directory and it should work

2021-04-05 01:18:06 -0500 commented answer launching Gazebo error

I'm not sure if it is a good practice to edit read only files, but you can do so using the following command sudo gedit

2021-04-04 13:21:45 -0500 received badge  Teacher (source)
2021-04-04 05:56:31 -0500 commented answer How do I change the topic that rqt_robot_monitor subscribes to?

You can remap the topics in your launch file

2021-04-04 05:50:14 -0500 answered a question launching Gazebo error

Check this it may answer your question

2021-04-04 05:50:14 -0500 received badge  Rapid Responder (source)
2021-04-04 05:45:10 -0500 answered a question publish after processing data from 2 synced subscribers (rospy)

After processing the data in the call back you can invoke pub.publish(YOUR_DATA), in the callback also.

2021-04-04 05:45:10 -0500 received badge  Rapid Responder (source)
2021-04-04 05:32:54 -0500 commented question ros-kinetic-control*: command not found

You can try execute each command seprately because with && if one command fail the others will not be executed

2021-04-01 08:31:17 -0500 answered a question Delay a ROS Topic by a certain amount of time

You can use ros::topic::waitForMessage

2021-04-01 05:30:19 -0500 asked a question What is the size of octomap?

What is the size of octomap? I'm working with octomap, I call the /octomap_binary service, and convert it to octree. As

2021-04-01 05:14:02 -0500 answered a question read data from octomap_full/octomap_binary

You can use octomap_msgs/conversions.h just include this file and then you can use all the fuctions for example: octoma

2021-03-29 09:33:36 -0500 commented question PID package for ros2 foxy

Check this it may help

2021-03-29 07:59:22 -0500 asked a question How to build global map using octomap?

How to build global map using octomap? Hello everyone, I build a simple launch file where I launch the octomap_server a

2021-03-25 02:50:30 -0500 commented question How to subscribe the octomap msgs and use it for 3d path planning?

This may help, it contain functions to read and write octomaps

2021-03-25 02:44:06 -0500 commented question Create map from raw point cloud data and navigation& planning

Have a look at conversion.h which contain methods to read and write octomaps

2021-03-25 02:35:58 -0500 answered a question how to use octomap_server?

To launch octomap_server add the following to your launch file: <node pkg="octomap_server" type="octomap_server_no

2021-03-06 10:10:05 -0500 received badge  Student (source)
2020-09-15 02:21:03 -0500 received badge  Notable Question (source)
2020-03-06 06:05:14 -0500 marked best answer CMake_Error, gazebo_ros

hello, when i try to use catkin_make for my workspace, i got this error

CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "gazebo_ros" with
  any of the following names:

    gazebo_rosConfig.cmake
    gazebo_ros-config.cmake

  Add the installation prefix of "gazebo_ros" to CMAKE_PREFIX_PATH or set
  "gazebo_ros_DIR" to a directory containing one of the above files.  If
  "gazebo_ros" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  RoboND-Kinematics-Project/gazebo_grasp_plugin/CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/mohamed/Documents/workspace/build/CMakeFiles/CMakeOutput.log".
See also "/home/mohamed/Documents/workspace/build/CMakeFiles/CMakeError.log".
Makefile:1914: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

my workspace contain only this package in the src: https://github.com/udacity/RoboND-Kin...

i removed my gazebo and installed a new version gazebo9, i thought this what cause the error so i removed it and installed gazebo7 again.

when i try to use catkin_make with a workspace which doesn't contain any thing related to gazebo it works fine. i am using Ubuntu 16, gazebo 7.14.0, kinetic-kame. Thanks in advance