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

user23fj239's profile - activity

2023-05-29 18:55:01 -0500 received badge  Nice Question (source)
2022-10-14 13:03:56 -0500 received badge  Good Question (source)
2022-08-28 03:15:39 -0500 marked best answer How to start rviz with a fixed frame

I have come across this question using the static_transform_publisher from the bash, but this is inconvinient. The arguments seem to offer this but cannot find an example what args -f acutally takes

  pc~/catkin_ws$ rviz -h
[ INFO] [1461508601.744858346]: rviz version 1.11.8
[ INFO] [1461508601.744970393]: compiled against OGRE version 1.8.1 (Byatis)
rviz command line options:
  -h [ --help ]               Produce this help message
  -s [ --splash-screen ] arg  A custom splash-screen image to display
  --help-file arg             A custom html file to show as the help screen
  -d [ --display-config ] arg A display config file (.rviz) to load
  -f [ --fixed-frame ] arg    Set the fixed frame

Could someone post an example for example this frame (no trans, no rot)

rosrun tf static_transform_publisher 0 0 0 0 0 0 1 map my_frame 10

EDIT So what I do is using a launch file to pack both commands together:

<launch>
<!-- set up the cosys -->
 <node pkg="tf" type="static_transform_publisher" name="map2frame_0" 
    args="0.0 0.0 0.0 0 0 0 1 map frame_0 100" />
<!-- start rviz -->
  <node pkg="rviz" type="rviz" name="my_rviz" 
    args="-d $(find rviz_markers)/include/rviz_config.rviz"/>
</launch>
2022-07-16 13:09:39 -0500 received badge  Good Answer (source)
2022-04-14 09:44:26 -0500 marked best answer Build RViz plugin from .ui file

My existing solution simply designs the GUI in qtcreator and then use the uic to generate the dotnect_window.h (link to plugin) which I might have to modify to derive from class ... : public rviz::Panel. How to automate this / do it all?

For example rqt_image_view already uses an .ui file, but it is rqt standalone. So I started with the RViz plugin teleop and added code from rqt_image_view . Maybe I could use the uncommented qt4/5_wrap_ui as a start? Just to give an idea:

cmake_minimum_required(VERSION 2.8.3)
project(rviz_dotnect_plugin)

# ros packages
find_package(catkin REQUIRED COMPONENTS
  rviz
)

catkin_package(
   # INCLUDE_DIRS
   # LIBRARIES ${PROJECT_NAME}
   CATKIN_DEPENDS rviz
   # DEPENDS
)
include_directories(
  ${catkin_INCLUDE_DIRS}
  include
)

link_directories(
  ${catkin_LIBRARY_DIRS}
)

# Bundle headers .h
set(HEADER_FILES
  include/drive_widget.h
  include/teleop_panel.h
)

# Automatically enable Qt's Meta-Object Compiler moc generation
set(CMAKE_AUTOMOC ON)

# Avoid keyword definition to avaid conflicts with boost or xapian etc
# e.g. http://muddyazian.blogspot.de/2012/04/getting-qt-app-working-with-boost-using.html
add_definitions(-DQT_NO_KEYWORDS)

# Use same QT version as rviz and specify headers run through MOC.
# MOC generated .cpp files are included automatically as headers.
if(rviz_QT_VERSION VERSION_LESS "5")
  message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
  find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
  include(${QT_USE_FILE})
  qt4_wrap_cpp(HEADER_FILES_MOCS ${HEADER_FILES})
  #qt4_wrap_ui(rqt_image_view_UIS_H ${rqt_image_view_UIS})
else()
  message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
  find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
  set(QT_LIBRARIES Qt5::Widgets)
  qt5_wrap_cpp(HEADER_FILES_MOCS ${HEADER_FILES})
  #qt5_wrap_ui(rqt_image_view_UIS_H ${rqt_image_view_UIS})
endif()

# Bundle source .cpp including the mocs
set(SOURCE_FILES
src/drive_widget.cpp
src/teleop_panel.cpp
${HEADER_FILES_MOCS}
)

# A rviz plugin is a shared library named ${PROJECT_NAME}.so
add_library(${PROJECT_NAME} ${SOURCE_FILES})

# Link executable with Qt libraries
target_link_libraries(${PROJECT_NAME}
  ${QT_LIBRARIES}
  ${catkin_LIBRARIES}
)

## Install rules...

I went on and generated the header from .ui via $ uic -o dotnect_window.h dotnect_window.ui. But uic deprecated the -i arg to generate the implementation file via uic -i PizzaEntry.h -o PizzaEntry.cpp pizza.ui. Argl.


Also the third step is nowhere to be found inside rqt_image_view.
I get confused with what is a rqt standalone and what I actually need to just get the rviz plugin asrviz::Panel building from .ui.

2022-01-25 13:09:29 -0500 marked best answer Convert cv_bridge Image to cv::Mat image

I would like to have a pure OpenCV version cv::Mat of the Image on which I can do further modifications. I tried cv_ptr->dImg; but it outputs errors. So far I have

 void imageCb(const sensor_msgs::ImageConstPtr& msg)
   {
    cv_bridge::CvImagePtr cv_ptr;
    try
    {
      cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::TYPE_16UC1);
    }
    catch (cv_bridge::Exception& e)
    {
      ROS_ERROR("cv_bridge exception: %s", e.what());
      return;
    }

    // Draw an example circle on the video stream
    //if (cv_ptr->image.rows > 60 && cv_ptr->image.cols > 60)
     // cv::circle(cv_ptr->image, cv::Point(px, py), 10, CV_RGB(255,0,0));
        cv::Mat dImg;
2022-01-25 13:09:28 -0500 received badge  Nice Answer (source)
2021-10-15 03:39:45 -0500 marked best answer Converting ros::time to double value without uint_t

I had a look at the ros::durationBase and it has functions toSec toNsec to convert the following into one int64_t which would exceed a double in c++;

int32_t     nsec
int32_t     sec
2021-08-04 05:16:51 -0500 received badge  Notable Question (source)
2021-08-04 05:16:51 -0500 received badge  Famous Question (source)
2021-02-16 04:42:37 -0500 marked best answer Tutorials-Markers: Do not overwrite last marker

I try to have mulitple markers via several publishes and then let them fade away if their lifetime is over. Unfortune if I publish a new marker the old marker disappears before its lifetime is up.
I did the basic tutorial on markers, but what bugs me is this line

If a new marker message is received before the lifetime has been reached, the lifetime will be reset to the value in the new marker message.

How do I add another marker on the same topic but not overwrite the marker from the previous publish.

  59     marker.action = visualization_msgs::Marker::ADD;

Above action should add but the default behaviour (I guess is), create the marker if not already there, if its already displayed in rviz then overwrite the last one. How to prevent overwriting. Could someone confirm there is no other way than needing a message array or another solution multiple topics

When using an array it also only displays the last marker of the array:

    visualization_msgs::MarkerArray marker_array;
marker_array.markers.resize(2);
for(int i=0; i<2; i++) {
    make_markerf(marker_array.markers[i], frame_ids[i], pars[i]);
}
pub.publish(marker_array);

with this function making the markers:

void make_markerf(visualization_msgs::Marker &marker,  std::basic_string<char> frame_id, double *pars){
marker.header.frame_id = frame_id;
marker.header.stamp = ros::Time::now();
marker.ns = "sensor_processor";
marker.id = 2;

marker.pose.position.x = pars[0];
marker.pose.position.y = pars[1];
marker.pose.position.z = pars[2];
marker.pose.orientation.x = pars[3];
marker.pose.orientation.y = pars[4];
marker.pose.orientation.z = pars[5];
marker.pose.orientation.w = pars[6];
marker.scale.x = pars[7];
marker.scale.y = pars[8];
marker.scale.z = pars[9];
marker.color.r = pars[10];
marker.color.g = pars[11];
marker.color.b = pars[12];
marker.color.a = pars[13];
marker.type = pars[14];
marker.action = pars[15]; //always 0
marker.lifetime = ros::Duration(pars[16],pars[17]); //tried 0, and 10,0

}

2021-02-16 04:42:37 -0500 received badge  Good Answer (source)
2021-02-16 04:42:37 -0500 received badge  Enlightened (source)
2021-01-26 19:20:30 -0500 marked best answer Set delay between starting nodes within launch file

I would like to put my nodes inside a launch file. The first node need to be up and running before the second node. Is it possible to set some timeout before the second starts. Like usleep(time) in roscpp

<launch>
<node name="talker" pkg="roscpp_tutorials" type="talker" />
//delay of e.g. 1second
<node name="listener" pkg="roscpp_tutorials" type="listener" />
</launch>

Is this technically possible?