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

v.leto's profile - activity

2023-12-14 05:03:25 -0500 received badge  Famous Question (source)
2023-01-31 00:03:50 -0500 received badge  Notable Question (source)
2023-01-31 00:03:50 -0500 received badge  Famous Question (source)
2022-11-10 08:30:15 -0500 received badge  Famous Question (source)
2022-11-04 05:20:35 -0500 received badge  Famous Question (source)
2022-09-20 01:46:38 -0500 received badge  Notable Question (source)
2022-09-20 01:46:38 -0500 received badge  Famous Question (source)
2022-07-20 09:50:58 -0500 received badge  Notable Question (source)
2022-05-26 09:05:26 -0500 received badge  Popular Question (source)
2022-05-26 09:05:26 -0500 received badge  Notable Question (source)
2022-01-28 12:02:26 -0500 received badge  Famous Question (source)
2022-01-19 13:52:20 -0500 received badge  Popular Question (source)
2021-12-30 17:53:34 -0500 received badge  Popular Question (source)
2021-12-28 10:26:40 -0500 received badge  Teacher (source)
2021-12-28 10:26:40 -0500 received badge  Self-Learner (source)
2021-12-28 10:25:16 -0500 received badge  Popular Question (source)
2021-12-28 10:24:17 -0500 marked best answer print UInt8MultiArray values in python
Hi! I would like to save into 3 arrays the fields of a custum message:

std_msgs/UInt8MultiArray  pixel
std_msgs/Float64MultiArray nord
std_msgs/Float64MultiArray est

this is my callback to listen to the message. When I try to print pixel I get letters. How could I transform them to integers from 0 to 255? thanks

 def callback(data):
        #rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.pixel.data)
        #rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.est.data)
        #rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.nord.data)
        pixel= np.array(data.pixel.data)
        print(pixel)
        est = np.array(data.est.data)
        nord= np.array(data.nord.data)
2021-12-28 10:23:42 -0500 received badge  Rapid Responder (source)
2021-12-28 10:23:42 -0500 answered a question print UInt8MultiArray values in python

Hi! Thank you very much for your interest @osilva. I finally found a solution...and maybe it was easier than what I thou

2021-12-28 10:13:49 -0500 received badge  Supporter (source)
2021-12-28 10:01:10 -0500 commented question print UInt8MultiArray values in python

Your code works. I tried to modify mine in order to look like yours but I get errors. I used an online decorder and I th

2021-12-28 10:00:49 -0500 commented question print UInt8MultiArray values in python

Your code works. I tried to modify mine in order to look like yours but I get errors. I used an online decorder and I th

2021-12-28 09:27:39 -0500 received badge  Popular Question (source)
2021-12-28 09:10:41 -0500 commented question how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make?

/home/valeria/catkin_ws/src:/opt/ros/melodic/share

2021-12-28 08:52:29 -0500 received badge  Student (source)
2021-12-28 07:34:08 -0500 commented question how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make?

what I meant is that I have only this line. Ican't copy paste the whole file here, it is not allowed

2021-12-27 16:09:43 -0500 received badge  Popular Question (source)
2021-12-27 15:37:09 -0500 commented question print UInt8MultiArray values in python

I have read that it is a base64 because uint8[] are converted by rosbridge to base64,...

2021-12-27 14:51:06 -0500 commented question how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make?

I've added this line source /opt/ros/melodic/setup.bash

2021-12-27 14:50:10 -0500 edited question how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make?

how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make? I have to type source

2021-12-27 14:40:54 -0500 commented question print UInt8MultiArray values in python

Hi @osilva! print(pixel) outputs hcc`hda`dadhgcfc_bcccaacaacebfdhfcifggadfhhbihiffcgfddbeafbceacfgbfbdcgfddebab_`

2021-12-27 14:40:34 -0500 commented question print UInt8MultiArray values in python

Hi @osilva! print(pixel) outputs hcc`hda`dadhgcfc_bcccaacaacebfdhfcifggadfhhbihiffcgfddbeafbceacfgbfbdcgfddebab_`

2021-12-27 08:50:46 -0500 asked a question print UInt8MultiArray values in python

print UInt8MultiArray values in python Hi! I would like to save into 3 arrays the fields of a custum message: std_msgs/

2021-12-26 12:59:23 -0500 marked best answer can't import custum message in python
Hi guys! I get this mistake.

 Traceback (most recent call last):
      File "prova.py", line 6, in <module>
        from immagine.msg import pixel_ned
    ImportError: No module named immagine.msg

It seems that my code doesn't find the custum message I created. immagine is my package and pixel_ned is the name of my .msg file. If I type rosmsg show pixel_ned it exists and I have no problem using it with a c++ code. What is going on?

My listener is this:

#!/usr/bin/env python
import numpy as np

import matplotlib.pyplot as plt

import rospy
from immagine.msg import pixel_ned
from std_msgs.msg import Float64MultiArray

def callback(data):
    rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data)


def listener():

    # In ROS, nodes are uniquely named. If two nodes with the same
    # name 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('ascolta_immagine', anonymous=True)
    rospy.Subscriber("/scrivi_immagine", pixel_ned, callback)
    rospy.spin()# spin() simply keeps python from exiting until this node is stopped

if __name__ == '__main__':
    listener()

And this my Cmake

cmake_minimum_required(VERSION 2.8.3)
project(immagine)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS

  roscpp
  rospy
  std_msgs
  marta_msgs

 ## DI QUESTI NONSONO SICURA 


    geometry_msgs

  message_generation
  sensor_msgs
  auv_lib
  genmsg
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
find_package(cmake_modules REQUIRED)

find_package(Eigen REQUIRED)



## Generate messages in the 'msg' folder
 add_message_files(
   FILES
   pixel_ned.msg
#   Message1.msg
#   Message2.msg
)


## Generate added messages and services with any dependencies listed here
generate_messages(
   DEPENDENCIES
   std_msgs
   marta_msgs
   )

catkin_install_python(PROGRAMS scripts/prova.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
###########
## Build ##
###########

if(NOT DEFINED CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${Eigen_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
#   src/${PROJECT_NAME}/immagine.cpp
# ) 
add_library(immagine src/funzioni.cpp)

    ## Declare a C++ executable
    ## With catkin_make all packages are built within a single CMake context
    ## The recommended prefix ensures that target names across packages don't collide
    add_executable(gestisco_dati src/gestisco_dati.cpp)


## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(gestisco_dati ${catkin_EXPORTED_TARGETS})
add_dependencies(gestisco_dati immagine_gencpp)#perchè dipende da un messaggio costumizzato

## Specify libraries to link a library or executable target against
target_link_libraries(gestisco_dati immagine ${catkin_LIBRARIES})
2021-12-26 12:59:12 -0500 answered a question can't import custum message in python

I forgot to import as pixel_ned iscomposed of these two kind of messages from std_msgs.msg import Float64MultiArray fr

2021-12-26 12:59:12 -0500 received badge  Rapid Responder (source)
2021-12-26 12:08:00 -0500 asked a question can't import custum message in python

can't import custum message in python Hi guys! I get this mistake. Traceback (most recent call last): File "prov

2021-12-26 07:43:16 -0500 commented answer cannot include custom .msg files in python code

Hi @david.c.liebman I have the same problem but I didn't understand how to fix it. Shoul d I put source ~/catkin_ws/de

2021-12-26 06:34:52 -0500 marked best answer How to send arrays with std_msgs/UInt8MultiArray and std_msgs/Float64MultiArray?

Hi! I woul like to send arrays to a node, I've tried with this code, but I think there is something wrong when I try to copy the array values in the data structure...

uint8_t SSS_ground_unito[doppio_bins]={0};
immagine::pixel_ned messaggio;
double point_seabed_n[doppio_bins]={0};
double point_seabed_e[doppio_bins]={0};

//funzione per inviare il messaggio al nuovo nodo
void send_immagine(uint8_t SSS_grnd_unito[],double point_sbed_n[], double point_sbed_e[]){
    messaggio.pixel.data=SSS_ground_unito;
    messaggio.nord.data=point_seabed_n;
    messaggio.est.data=point_seabed_e;
    cout <<"send"<< messaggio.pixel.data<<endl;
    write_Out.publish(messaggio);//pubblica il messaggio sul topic 
    ROS_INFO("ping inviato");
 }

this is my msg

std_msgs/UInt8MultiArray  pixel
std_msgs/Float64MultiArray nord
std_msgs/Float64MultiArray est
2021-12-26 06:33:20 -0500 commented question how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make?

Hi! it doesn't run nodes

2021-12-23 14:02:51 -0500 asked a question how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make?

how could I avoid source /home/valeria/catkin_ws/devel/setup.bash every time I do catkin_make? I have to type source

2021-12-23 10:22:29 -0500 commented question camke doesn't work due to a ROS reinstallation

anyway I must run source /home/valeria/catkin_ws/devel/setup.bash after every catkin_make. What did I skip?

2021-12-23 10:02:55 -0500 asked a question How to send arrays with std_msgs/UInt8MultiArray and std_msgs/Float64MultiArray?

How to send arrays with std_msgs/UInt8MultiArray and std_msgs/Float64MultiArray? Hi! I woul like to send arrays to a no

2021-12-23 09:48:10 -0500 commented question camke doesn't work due to a ROS reinstallation

I don't know what I did but no it works...

2021-12-23 06:44:56 -0500 commented question camke doesn't work due to a ROS reinstallation

Hi @Geoff I had problem with ubuntu. I needed to install a python library(matlibplot) but I deleted packages. So I took

2021-12-22 13:49:03 -0500 asked a question camke doesn't work due to a ROS reinstallation

camke doesn't work due to a ROS reinstallation Hi! I had to reinstall ROS and when try to do cmake I get this. It stops

2021-12-17 03:56:09 -0500 received badge  Notable Question (source)
2021-12-11 04:21:57 -0500 received badge  Popular Question (source)