Ask Your Question

Porti77's profile - activity

2018-12-14 16:34:22 -0500 received badge  Good Question (source)
2018-09-19 14:27:23 -0500 received badge  Famous Question (source)
2017-11-26 16:03:04 -0500 marked best answer Python shutdown node

How i can shutdown a node in python? In c++ is ros::shutdown() but in python i didn't find it. Thanks

2017-09-19 20:11:31 -0500 marked best answer get variable from topic with python

I created a node and subscribe a topic (nav_msgs/Odometry Message) i want operate with the quaternion, how i can get it value? With python

i try it this way:

rospy.Subscriber('/odometry/filtered', Odometry) 
x = Odometry.pose.pose.pose.orientation.x

but not work well

2017-09-19 20:11:16 -0500 received badge  Notable Question (source)
2017-09-19 20:11:16 -0500 received badge  Famous Question (source)
2017-09-19 04:47:01 -0500 received badge  Favorite Question (source)
2017-08-01 05:33:17 -0500 received badge  Famous Question (source)
2017-08-01 05:33:17 -0500 received badge  Notable Question (source)
2017-05-11 03:51:54 -0500 received badge  Nice Question (source)
2017-04-30 02:48:30 -0500 marked best answer quaternion to euler

How do I can convert orientation quaternion to Euler angles? Thank you

2017-04-15 03:00:17 -0500 marked best answer new update robot_localization

I have so time work with this package, last week i update this in other work_space and started to do test with old bags. I was surprised because a observation, now the front of base_link its Y???? Before was X. This is a modification? I link my rosbag https://www.dropbox.com/s/1kkzfjnf0bi...

-New package This is the two captures that i discovered that changes in the frame

-Old package image description

EDIT 2: I did a rosbag record https://www.dropbox.com/s/njkh0m9qox7... i launch a ekf with the same position and 4 times with each cardinal points, and the tf between utm and odom no changes the orientation.

EDIT 3: https://www.dropbox.com/s/ws428skxsg1...

I record a rosbag that during 12 minuts, the secuence is the next

MIN              ACTIONS
0
                     Only launched gps and compass
                     Compass pointing to north
1
                     Launch ekf, navsat, tf
3
                     Shutdown ekf, navsat, tf
                     Compass pointing to south
4
                     Launch ekf, navsat, tf
6
                     Shutdown ekf, navsat, tf
                     Compass pointing to east
7
                     Launch ekf, navsat, tf
9
                     Shutdown ekf, navsat, tf
                     Compass pointing to west
10
                     Launch ekf, navsat, tf
12

This route is a 8x8 square meters course 3 times, first north, second west, then south and finally east. Square route according to the right-hand rule. https://www.dropbox.com/s/2fyeh3k06qo...

This is the launch file:

<!-- Ekf -->
<launch>

   <param name="/use_sim_time" value="true" />
   <node pkg="rosbag" type="play" name="rosbagplay" args="/home/jorge_j/example.bag  --clock -d 3" required="true"/>

   <node pkg="tf2_ros" type="static_transform_publisher" name="bl_imu" args="0.0 0.0 0.0 0.0 0.0 0.0 1.0 base_link compass" /> 
   <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true">

       <param name="frequency" value="30"/>
       <param name="sensor_timeout" value="0.1"/>
       <param name="two_d_mode" value="true"/>

       <param name="map_frame" value="map"/>
       <param name="odom_frame" value="odom"/>
       <param name="base_link_frame" value="base_link"/>
       <param name="world_frame" value="odom"/>

       <param name="transform_time_offset" value="0.0"/>

       <param name="odom0" value="/odometry/gps"/>
       <param name="imu0" value="/compass/data"/>

         <rosparam param="odom0_config">[ true,  true, false,
                                         false, false, false,
                                         false, false, false,
                                         false, false, false,
                                         false, false, false]</rosparam>

         <rosparam param="imu0_config">[false, false, false,
                                        false, false,  true,
                                        false, false, false,
                                        false, false, false,
                                        false, false, false]</rosparam>

       <param name="odom0_differential" value="false"/>
       <param name="imu0_differential" value="false"/>

       <param name="odom0_relative" value="false"/>
       <param name="imu0_relative" value="false"/>

       <param name="imu0_remove_gravitational_acceleration" value="true"/>

       <param name="print_diagnostics" value="true"/>

       <param name="odom0_queue_size" value="10"/>
       <param name="imu0_queue_size" value="10"/>

       <param name="debug"           value="false"/>
       <param name="debug_out_file"  value="debug_ekf_localization.txt"/>

         <rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                                     0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                                     0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                                     0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                                     0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                                     0,    0 ...
(more)
2017-03-29 17:39:21 -0500 marked best answer I can't launch a node

I created this node and when i launch it, happened this

ERROR: cannot launch node of type [nmea_navsat_driver/nmea_serial_driver]: can't locate node [nmea_serial_driver] in package [nmea_navsat_driver]

My state variables are it:

jorge_j@Ulises:~/catkin_ws$ export | grep ROS
declare -x ROSLISP_PACKAGE_DIRECTORIES="/home/jorge_j/catkin_ws/devel/share/common-lisp"
declare -x ROS_DISTRO="indigo"
declare -x ROS_ETC_DIR="/opt/ros/indigo/etc/ros"
declare -x ROS_MASTER_URI="http://localhost:11311"
declare -x ROS_PACKAGE_PATH="/home/jorge_j/catkin_ws/src:/home/jorge_j/catkin_ws/install/share:/home/jorge_j/catkin_ws/install/stacks:/opt/ros/indigo/share:/opt/ros/indigo/stacks"
declare -x ROS_ROOT="/opt/ros/indigo/share/ros"
declare -x ROS_TEST_RESULTS_DIR="/home/jorge_j/catkin_ws/build/test_results"
2017-03-22 14:34:38 -0500 received badge  Favorite Question (source)
2017-02-09 07:18:01 -0500 received badge  Famous Question (source)
2016-12-20 01:11:47 -0500 received badge  Notable Question (source)
2016-10-27 04:22:31 -0500 received badge  Notable Question (source)
2016-09-14 14:44:11 -0500 marked best answer ekf odom and compass robot_localization

Hi! I have a compass sensor and a odom sensor, this start in the position 0,0,0. The compass it's in the correct position but when i echo the odometry filtered It is delaying it will respect the GPS signal.

Any answer?

EDIT 1: This is a rosbag with the sensor topics https://www.dropbox.com/s/6kwbd1yaxix... This is a tree graph, nodes graph and rviz capture. image description image description

Red color /odometry/filtered and green color position/GPS image description image description

The position GPS is in absolute coordinates. The ekf launch is this, with the base link compass transformation:

<!-- EKF -->
<launch>

<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0.0 0.0 0.0 0.0 0.0
0.0 1.0 base_link compass 20" />

<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true">
  <param name="frequency" value="30"/>  
  <param name="sensor_timeout" value="0.1"/>  
  <param name="two_d_mode" value="true"/>

  <param name="map_frame" value="map"/>
  <param name="odom_frame" value="odom"/>
  <param name="base_link_frame" value="base_link"/>
  <param name="world_frame" value="odom"/>

  <param name="odom0" value="position/gps"/>
  <param name="imu0" value="compass/data"/> 


  <rosparam param="odom0_config">[true,  true,  false, 
                                  false, false, false, 
                                  false, false, false, 
                                  false, false, false,
                                  false, false, false]</rosparam>

  <rosparam param="imu0_config">[false, false, false, 
                                 false, false, true, 
                                 false, false, false, 
                                 false, false, false,
                                 false, false, false]</rosparam>

  <param name="odom0_differential" value="false"/>
  <param name="imu0_differential" value="false"/>

  <param name="imu0_remove_gravitational_acceleration" value="true"/>

  <param name="print_diagnostics" value="false"/>

  <!-- ======== ADVANCED PARAMETERS ======== -->

  <param name="odom0_queue_size" value="2"/>
  <param name="imu0_queue_size" value="10"/>

  <param name="debug"           value="false"/>
  <param name="debug_out_file"  value="/home/tmoore/Desktop/debug_ekf_localization.txt"/>

  <rosparam param="process_noise_covariance">[0.05, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.05, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.0, 0.0, 0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0 ...
(more)
2016-09-14 14:42:15 -0500 marked best answer navsat robot_localization

In Navasat_transform_node have a question about when the node receives a position becomes GPS latitude and longitude, UTM this format is x, and an identifier of area and band, for example Spain 29T, 30T and 31T, what happens when we change area or band ? X and Y incrise continue or start again?

Edit1: I have other problem, i download the last version for indigo and the ekf not publish the tf between base_link and odom like the other versions. Whats happen? image description

image description

image description

2016-06-29 23:24:11 -0500 received badge  Favorite Question (source)
2016-06-29 03:56:01 -0500 received badge  Popular Question (source)
2016-06-28 03:02:32 -0500 commented answer ekf_localization with gps and imu

You can see a tutorial about launch files here http://wiki.ros.org/roslaunch/XML , if you are using the robot localization node you can use the launch file that are above or the example attached in the package. Regards

2016-06-20 02:42:55 -0500 received badge  Popular Question (source)
2016-06-16 06:57:57 -0500 asked a question ekf_localization control command

Hi! I just saw it now is possible add to the filter a control command, but looking at the code this control applies on the accelerations directly, and not x(t + 1) = Ax(t) + Bu(t). What model use in the filter?

The command of my robot is linear velocity and angular velocity, How i do it?

Thanks.

2016-06-15 04:57:54 -0500 commented answer robot_localization: erroneous filtered GPS output

Hi, i did a plugin for rviz which can plot a Odometry like a path, so you plot odometry/gps Download this https://github.com/porti77/rviz_plugi... , compile in your workspace and then you can plot this msg in rviz. If you was think in plot the GPS (NavSatFix) you have to convert it

2016-05-08 16:12:15 -0500 marked best answer microstrain_3dmgx2_imu

I'm working with robot_location and microstrain_3dmgx2_imu. When I launch imu_node i have the same error about calibration, but when i do: rosparam list to show the parameters that i can change, max_drift_rate not shown. Where i have find it? Thanks.

2016-04-24 06:36:39 -0500 marked best answer ekf_localization with gps and imu

Hi everyone: I'm working with robot localization package be position estimated of a boat, my sistem consist of:

Harware: -Imu MicroStrain 3DM-GX2 (I am only interested yaw) - GPS Conceptronic Bluetooth (I am only interested position 2D (X,Y))

Nodes: -Microstrain_3dmgx2_imu (driver imu) -nmea_serial_driver (driver GPS) -ekf (kalman filter) -navsat_transform (with UTM transform odom->utm) -tf_transform (broadcast link base_link->imu)

When I launch and conect all I have: image description image description

After changed micros_strain node i got that work successful, i connected only imu and ekf and work well.

My problem is when I integrate all system such as I explain above, the topic /odometry/filtered that is publishing for the filter not work well, because without reason some time the position starting to increase until hundreds of meters, i revised the position that i get from GPS and it work well. I think that the filter not work well. Any idea?

I let in dropbox a rosbag with the system working. https://www.dropbox.com/s/xqc7m47q28d...

Thanks!!

EDIT 1: For now I'm using the laptop as a robot, the imu will be mounted as shown in the picture. In the laptop serial cable I have placed facing the screen, which is the direction of my movement. The fork used is https://github.com/cra-ros-pkg/micros... . Navsat information is correct, the problem is the position in the case of filtered odometry, as sometimes hundreds of meters unexplained increases. image description

And i ploted odometry/filtered and odometry/gps and the result is this: image description

2016-04-21 03:26:50 -0500 commented question ekf_localization with gps and imu
2016-04-18 03:31:52 -0500 commented question ekf_localization with gps and imu

You can stack the position so rostopic echo -p /odometry/gps > odom_gps.csv and then plot a graphic with LibreOffice calc, other option is create a specific plugin for rviz, i did this plug-in that plot a odometry msg like a path msg. If you want this plug-in i can send you a link.

2016-04-18 03:23:20 -0500 received badge  Popular Question (source)
2016-03-08 11:31:06 -0500 received badge  Famous Question (source)
2016-02-28 23:09:32 -0500 received badge  Famous Question (source)
2016-02-18 08:50:40 -0500 asked a question rqt_publisher genpy.Time[0]

How i can publish a msg with rqt_publisher with current time added to the stamp in a msg?

2016-01-21 03:36:58 -0500 commented question Odometry to path rviz

My answer helped you?

2016-01-14 03:23:24 -0500 commented question Odometry to path rviz

I updated the correct code above.

2016-01-14 02:56:39 -0500 edited question Odometry to path rviz

Hi! I have a node that publish a message nav_msgs/Odometry, and i want see the trajectory in rviz, i know that i need a nav_msgs/Path. Somebody know a node that do it?

I create a node

#!/usr/bin/env python
from __future__ import print_function
import rospy
from tf.transformations import quaternion_from_euler
from std_msgs.msg import String
from nav_msgs.msg import Odometry, Path
from geometry_msgs.msg import PoseWithCovarianceStamped, PoseStamped
from sensor_msgs.msg import Joy

import sys
import json
from math import sqrt
from collections import deque

import time


def callback(data):
        global xAnt
        global yAnt
        global cont

    #Is created the pose msg, its necessary do it each time because Python manages objects by reference, 
        #and does not make deep copies unless explicitly asked to do so.
        pose = PoseStamped()    

    #Set a atributes of the msg
        pose.header.frame_id = "odom"
        pose.pose.position.x = float(data.pose.pose.position.x)
        pose.pose.position.y = float(data.pose.pose.position.y)
        pose.pose.orientation.x = float(data.pose.pose.orientation.x)
        pose.pose.orientation.y = float(data.pose.pose.orientation.y)
        pose.pose.orientation.z = float(data.pose.pose.orientation.z)
        pose.pose.orientation.w = float(data.pose.pose.orientation.w)

    #To avoid repeating the values, it is found that the received values are differents
        if (xAnt != pose.pose.position.x and yAnt != pose.pose.position.y):
                #Set a atributes of the msg
                pose.header.seq = path.header.seq + 1
                path.header.frame_id="odom"
                path.header.stamp=rospy.Time.now()
                pose.header.stamp = path.header.stamp
                path.poses.append(pose)
                #Published the msg

        cont=cont+1

        rospy.loginfo("Valor del contador: %i" % cont)
                if cont>max_append:
                        path.poses.pop(0)

        pub.publish(path)

    #Save the last position
        xAnt=pose.pose.orientation.x
        yAnt=pose.pose.position.y
        return path




if __name__ == '__main__':
        #Variable initialization
        global xAnt
        global yAnt
        global cont
        xAnt=0.0
        yAnt=0.0
        cont=0



        #Node and msg initialization
        rospy.init_node('path_plotter')


        #Rosparams that are set in the launch
        #max size of array pose msg from the path
        if not rospy.has_param("~max_list_append"):
                rospy.logwarn('The parameter max_list_append dont exists')
        max_append = rospy.set_param("~max_list_append",1000) 
        max_append = 1000
        if not (max_append > 0):
                rospy.logwarn('The parameter max_list_append not is correct')
                sys.exit()
        pub = rospy.Publisher('/path', Path, queue_size=1)


        path = Path() #creamos el mensaje path de tipo path 
        msg = Odometry()

        #Subscription to the topic
        msg = rospy.Subscriber('/odometry', Odometry, callback) 

        rate = rospy.Rate(30) # 30hz

    try:
                while not rospy.is_shutdown():
                    #rospy.spin()
                    rate.sleep()
        except rospy.ROSInterruptException:
                pass

I fixed the bugs and now the code works succesfull. Regards

2015-12-31 09:06:21 -0500 received badge  Famous Question (source)
2015-12-30 08:31:35 -0500 commented question Error - cannot locate node

Can you post cmakelist ?