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

l0g1x's profile - activity

2022-05-03 07:08:55 -0500 received badge  Guru (source)
2022-05-03 07:08:55 -0500 received badge  Great Answer (source)
2020-12-17 12:18:55 -0500 received badge  Great Question (source)
2020-05-28 08:27:55 -0500 marked best answer gtest testing function with subscriber reference

Im using gtest for writing test suites for my robot. Im trying to test a function that i use to convert my twist message being sent from the Nav Stack or joystick (cmd_vel topic) that is then converted into my individual wheel velocities for my roboteq motor controller. This function that i am testing is used in the cmd_vel subscriber callback in my roboteq driver node. So normally, when the callback is fired, i pass the reference of the twist, into my function like so (i type def'd geometry_msgs::Twist to TTwist, and TWheelMsg is my custom msg, also type def'd)

void    RosRoboteqDrv::CmdVelCallback(const TTwist::ConstPtr& twist_velocity)
{
    _wheelVelocity = RosRoboteqDrv::ConvertTwistToWheelVelocity(twist_velocity);

Where my my conversion function is defined like so:

TWheelMsg   ConvertTwistToWheelVelocity(const TTwist::ConstPtr& twist_velocity);

In my gtest class, im not sure how i can use this ConvertTwtistToWheelVelocity function since it is passing a reference. I tried looking up in the API docs where the reference originated from, and found that in the node handle subscriber template here it passes a boost shared pointer, which in my case i passed type geometry_msgs::Twist. So then i looked inside of the geometry_msgs source file, and found this:

typedef  ::geometry_msgs::Twist_< std::allocator< void > >

Can someone please tell me what should i do to be able to pass some value (clearly has to be reference) into the ConvertTwistToWheelVelocity function? I dont know what to do since std::allocator is the template type.

Since in the API docs it says that the node handle subscribe function is a template


EDIT: here is what my subscriber call looks like:

_sub = _nh.subscribe("cmd_vel", 1, &RosRoboteqDrv::CmdVelCallback, this);
2019-11-10 16:40:56 -0500 received badge  Guru (source)
2019-11-10 16:40:56 -0500 received badge  Great Answer (source)
2019-03-12 09:22:11 -0500 received badge  Great Answer (source)
2019-03-12 09:22:11 -0500 received badge  Guru (source)
2019-01-17 07:44:04 -0500 received badge  Good Answer (source)
2018-09-07 20:21:46 -0500 received badge  Guru (source)
2018-09-07 20:21:46 -0500 received badge  Great Answer (source)
2018-06-16 13:13:27 -0500 received badge  Good Answer (source)
2018-05-31 05:36:18 -0500 marked best answer Filling sensor_msgs/Image with uint8_t buffer array

So I'm working on making a camera driver, and the data struct contains the frame data such as the height and width, and uint8_t leftData and uint8_t rightData pointers. Ive been trying to see which way would be the best way to just fill simple fill in the sensor_msgs/Image message i create, but i cannot seem to find how to do it.

Here is what i have tried so far:

    leftImage.height                = pFrameData->height;
    leftImage.width                 = pFrameData->width;
    leftImage.encoding              = sensor_msgs::image_encodings::MONO8;
    leftImage.step                  = 64;
    leftImage.data                  = pFrameData->leftData;

But with that i get a error saying "no viable overloaded '=' "

Then after searching around i found people linking to the sensor_msgs::fillImage() header, and tried to use the memcpy method, but that did not work either (i got a seg fault)

Then i tried using the cv::Mat constructor to see if i could at LEAST somehow get a image to publish, by passing the size, type, and data pointer (pFrameData->leftData).

No luck with any of them. Im really new to opencv, cv_bridge, and camera related things in general. Would someone be able to guide me in the right direction?

Here is a example buffer for the left camera if i just print to the screen: 0x7ff7549ea800

EDIT 1:

Here is my frame callback function (after trying ahendrix's solution, which gave a malloc error which i put in comments below):

void frameCallback(const PFrame pFrameData)
{
    leftImage.header.stamp            = ros::Time::now();
    leftImage.header.frame_id       = "camera";
    leftImage.height                      = pFrameData->height;
    leftImage.width                       = pFrameData->width;
    leftImage.encoding                  = sensor_msgs::image_encodings::MONO8;
    leftImage.step                         = 64;

    const int image_size = pFrameData->height * pFrameData->width;
    leftImage.data.reserve(image_size);

    for( int i=0; i < image_size; i++ )
    {
            leftImage.data.push_back(pFrameData->leftData[i]); 
    }
 }
2018-05-31 05:36:18 -0500 received badge  Self-Learner (source)
2017-08-13 07:25:58 -0500 received badge  Nice Answer (source)
2017-07-24 16:24:14 -0500 received badge  Nice Answer (source)
2017-04-20 13:52:58 -0500 marked best answer Using gazebo_ros_control with SDF instead of URDF

My robot has a closed loop linkage, and therefore I cant use a URDF file as URDF only supports tree strucutres. Since SDF supports graph structures, I need to use that in order to simulate my robot. With that being said, I have a 2 actuators as well as a servo that I need to control. Normally, if I was to use an URDF, I would setup the tags in the URDF and then just include the gazebo_ros_control plugin in the URDF. But since the SDF specifications (sdformat.org) do not support tags, im not sure how to get the gazebo ros control plugin to work with my SDF file.

All the ros_control tutorials are based upon URDF, although there are lines in the tutorials stating "for your URDF/SDF file".

Currently, im simply adding this tag to the bottom of my SDF file (i wont include the whole thing for space reasons, for now at least):

....
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <robotNamespace>/surus_sim</robotNamespace>
        <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
    </plugin>

</model>
</sdf>

And when i launch the simulation, this is the error I receive in which i cant pinpoint where it comes from (searched through the ros_control plugin code):

[INFO] [WallTime: 1451341627.255617] [0.000000] Loading model xml from ros parameter
[INFO] [WallTime: 1451341627.264068] [0.000000] Waiting for service /gazebo/spawn_sdf_model
[INFO] [WallTime: 1451341628.176358] [0.000000] Calling service /gazebo/spawn_sdf_model
[INFO] [WallTime: 1451341629.094573] [0.001000] Spawn status: SpawnModel: Successfully spawned model
[spawn_model-3] process has finished cleanly
log file: /home/krystian/.ros/log/1fbfd810-adb2-11e5-9876-001c4239cab7/spawn_model-3*.log
[ INFO] [1451341632.830481140, 0.001000000]: Loading gazebo_ros_control plugin
[ INFO] [1451341632.830768827, 0.001000000]: Starting gazebo_ros_control plugin in namespace: /surus_sim
[ INFO] [1451341632.832180175, 0.001000000]: gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server.
[ERROR] [1451341633.054706078, 0.001000000]: Could not find the 'robot' element in the xml file
[ INFO] [1451341633.104100859, 0.001000000]: Loaded gazebo_ros_control.
[ INFO] [1451341633.150833544, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1451341633.232730090, 0.053000000]: Physics dynamic reconfigure ready.

The error [ERROR] [1451341633.054706078, 0.001000000]: Could not find the 'robot' element in the xml file is what I cannot figure out as only a URDF file contains the <robot> tag and SDF file does not. surus_sim is the name of the model in the sdf as well.

Any help would be appreciated. Would anyone know if the gazebo_ros_control plugin is meant to work directly with a SDF file? Ive looked around and a few people asked the question a while back but received no responses.

2017-04-08 04:22:17 -0500 received badge  Nice Answer (source)
2017-04-08 04:22:10 -0500 received badge  Good Question (source)
2017-04-06 11:21:02 -0500 received badge  Good Answer (source)
2016-10-27 07:18:31 -0500 marked best answer sbpl_lattice_planner loading move_base plugin fails

Im trying to setup my nav config to use pose_follower as my local planner (so i can have backwards movements) and then reading around, people say NavFn doesnt work with pose_follower. So i read around and saw people where saying to use sbpl_lattice_planner with pose_follower, so i tried to add it as a plugin to use with move base. For some reason im getting a really wierd error when i launch move_base (the full log can be viewed in a pastebin i made to not clutter the question. But the primary part of the error log is this:

process[move_base-1]: started with pid [9692]
[ WARN] [1428337418.710189086, 9.812000000]: Waiting on transform from base_link to odom to become available before running costmap, tf error:
[ INFO] [1428337418.724891841, 9.826000000]: Loading from pre-hydro parameter style
[ INFO] [1428337418.777851298, 9.878000000]: Using plugin "obstacle_layer"
[ INFO] [1428337418.840831680, 9.939000000]:     Subscribed to Topics:
[ INFO] [1428337418.889993790, 9.989000000]: Using plugin "inflation_layer"
[ INFO] [1428337419.030963854, 10.131000000]: Name is SBPLLatticePlanner
terminate called after throwing an instance of 'SBPL_Exception*'
[move_base-1] process has died [pid 9692, exit code -6, cmd /opt/ros/indigo/lib/move_base/move_base /odom:=/odometry/filtered __name:=move_base __log:=/home/parallels/.ros/log/3216eba8-dc79-11e4-9dbf-001c42dabd93/move_base-1.log].
[move_base-1] restarting process

I did the following to install/use sbpl_lattice planner as a plugin:

sudo apt-get install ros-indigo-sbpl

As when i install sbpl from source, it installs the files into /usr/local (i think i might be doing something wrong) and then therefore when i clone the sbpl_lattice_planner source and compile it via catkin_make it cant properly link the libspl shared libraries because its looking for it in /opt/ros/share/sbpl instead.

So after i install the sbpl ros debian, I clone the sbpl_lattice_planner source into my workspace, and compile successfully.

Then rospack plugins --attrib=plugin nav_core shows sbpl_lattice_planner is loaded as a plugin, and inside the bgp_plugin.xml i find that

<class name="SBPLLatticePlanner" type="sbpl_lattice_planner::SBPLLatticePlanner"...

So i use SBPLLatticePlanner as the name for the move_base parameter base_global_plannerto look like so:

<launch>
  <master auto="start"/>

  <node pkg="move_base" type="move_base" respawn="true" name="move_base" output="screen">

    <remap from="/odom" to="/odometry/filtered" />

    <param name="base_local_planner" value="pose_follower/PoseFollower"/>
    <param name="base_global_planner" value="SBPLLatticePlanner"/>

    <param name="SBPLLatticePlanner/primitive_filename" value="$(find sbpl)/matlab/mprim/pr2.mprim" />

    <param name="controller_frequency" value="10.0"/>
    <rosparam file="$(find test_2dnav)/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find test_2dnav)/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find test_2dnav)/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find test_2dnav)/global_costmap_params.yaml" command="load" />
#    <rosparam file="$(find test_2dnav)/base_local_planner_params.yaml" command="load" />
    <rosparam file="$(find test_2dnav)/pose_follower_params.yaml" command="load" />
  </node>
</launch>

Would anyone happen to know if im missing something/mis-configuring something? I know you must load a primitives file (which was the first issue i overcame).

2016-10-27 07:18:31 -0500 received badge  Self-Learner (source)
2016-10-21 10:02:40 -0500 received badge  Critic (source)
2016-09-26 08:49:17 -0500 received badge  Good Answer (source)
2016-07-08 19:00:43 -0500 commented answer How to get a map view of my bot using ROS?

I updated my post on how to turn the data from the gps into ros messages

2016-06-28 21:42:40 -0500 answered a question How to get a map view of my bot using ROS?

If what you are referring to is a satellite image representation of your current UTM position, there is a nice package that does this called mapviz which you can view here

EDIT: To publish the data as a rostopic, you will want to use a driver such as nmea_navsat_driver which you can get from here . By reading this wiki page you'll know everything about how the gps driver publishes your gps data through rostopics, what the topic names are, and the message type used to represent that data on the topic. The latitude/longitude information by default is usually published on the /fix topic as a sensor_msgs/NavSatFix message

2016-05-28 16:59:56 -0500 commented answer IMU_node doesn't work with 3dm-gx3-25, indigo, ubuntu 14.04

I actually ended up disabling it after i set a calibration from the microstrain utility application on windows

2016-05-28 16:59:09 -0500 commented question imu_node calibration check failed

anybody figure this out?

2016-05-28 16:57:35 -0500 answered a question libackermann_plugin.so

I havent ever tried that plugin you are trying to use, however theres another plugin that can be used called ackermann_vehicle. It has a working model which you can run off the bat. the upstream seems a bit old, so heres a link to a more recent update:

https://github.com/gKouros/ackermann_...

2016-05-09 12:01:33 -0500 commented question Problem using CameraPublisher plugin gazebo5

have you installed gazebo5_ros_pkgs?

2016-05-09 11:58:54 -0500 answered a question IMU_node doesn't work with 3dm-gx3-25, indigo, ubuntu 14.04

For me, the 3dm-gx3-25 showed up on /dev/ttyACM0 by defualt. Try typing ls -l /dev/ttyACM0 (assuming the imu is the only usb sensor you have connected), or you can try with process of elimination by disconnecting the sensor (wait about 5-10 seconds for the usb device to unregister), typing ls -l /dev/tty to view the whole list. Then connect the sensor, and view the list again. You should either see a new /dev/ttyACM or a new /dev/ttyUSB .

Id also recommend that you set up some udev rules. You can use this one

2016-05-09 11:48:33 -0500 commented question Subscribing /map consumes 4gb of memory!?!?!

What is the input source (into gmapping) frequency? I.e. your laser scanner, etc.

2016-05-08 15:28:03 -0500 received badge  Guru (source)
2016-05-06 13:06:07 -0500 commented answer Set delay between starting nodes within launch file

Yes that is correct

2016-05-06 07:42:12 -0500 received badge  Nice Answer (source)
2016-05-05 22:06:57 -0500 answered a question Set delay between starting nodes within launch file

Currently there is no such implementation. However, this was a topic brought up at the last ROS Live meeting, and seems that the idea is to try and allow a user to have more 'coding' freedom from within a launch file. I have seen some workarounds that people have posted in the past, and what they did was created a regular bash script that called roslaunch files from within itself, as it was easier (or maybe currently the only way) to implement a delay between roslaunch starts.

2016-04-13 21:27:12 -0500 commented answer Using gazebo_ros_control with SDF instead of URDF

@Adnen , I didnt create any custom plugin for this as I currently dont see any easy way of implementing a fix for this by creating a plugin. Did you have anything in mind?

2016-04-07 02:00:39 -0500 received badge  Good Answer (source)
2016-02-15 21:10:23 -0500 received badge  Self-Learner (source)
2016-02-15 21:10:15 -0500 received badge  Nice Question (source)
2016-02-02 15:16:25 -0500 marked best answer Couldn't find an AF_INET address for [] with Virtual Machine

So i tried a few different things already, primarily this answers: http://answers.ros.org/question/16355... but for some reason im still getting the Couldn't find an AF_INET address error.

I have a gazebo simulation setup on my desktop machine (14.04 indigo) that im running, and then trying to get my ubuntu VM on my mac to connect with the ros master on my desktop (for rviz and development purposes). Im using Parallels 10 and have two network interfaces configured; 1-shared network between mac and vm, 2-WiFi bridge so that the VM can have a ip address that is on the same subnet as my desktop (to allow one to ping the other, as said is needed in the network setup tutorials).

I editted /etc/hosts on both the desktop:

192.168.1.1     home-pc
192.168.1.2     ubuntu-mac

and my VM :

192.168.1.1     home-pc
192.168.1.2     ubuntu-mac

and then on my desktop (ros master) i edited the ~/.bashrc like so:

export ROS_MASTER_URI=http://home-pc:11311
export ROS_IP=192.168.1.1

and on my VM i edited ~/.bashrc like so:

 export ROS_MASTER_URI=http://home-pc:11311
 export ROS_IP=192.168.1.2

Im not sure whether the ROS_IP can also simply be the respective hostname or not, but thats what the answers i posted in the beggining said to do, and i was under the impression that that answer was already assuming you followed the NetworkSetup tutorial with having to setup the hostnames properly.

Might be a quick fix, but if anyone could give some insight thatd be great. Cheers