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

johnbryant's profile - activity

2019-10-29 08:27:55 -0500 received badge  Famous Question (source)
2019-09-25 05:28:36 -0500 received badge  Notable Question (source)
2019-02-27 16:44:00 -0500 received badge  Famous Question (source)
2019-02-27 16:44:00 -0500 received badge  Notable Question (source)
2018-12-23 13:29:20 -0500 received badge  Popular Question (source)
2018-12-20 04:30:56 -0500 marked best answer Create new topic that copies odometry topic

Hi all, I want to create a new topic that copies the odometry topic data in order to be able to reset the new topic.

#! /usr/bin/env python
import rospy
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry

class reset_odometry:
    def __init__(self):

    rospy.init_node('reset_odometry', anonymous=False)
    self.sub = rospy.Subscriber ('/marvin/diff_drive_controller/odom', Odometry, self.get_odom)
    rospy.sleep(0)
    self.pub = rospy.Publisher('new_pose', Odometry, queue_size=1)
    self.odom = ()
    rospy.spin()
def get_odom (self,msg):
        pose = Odometry()
    self.odom = pose
    print ("pose in callback",self.odom)


def main():
""" main function
"""
node = reset_odometry()

if __name__ == '__main__':
while not rospy.is_shutdown() :
    main()

The way I have written my code the values returned in the new topic are always zero. Any thoughts?

2018-12-20 04:30:54 -0500 commented answer Create new topic that copies odometry topic

Oh yes you are right. Sorry for asking such a trivial question. Thank you again.

2018-12-20 04:23:32 -0500 received badge  Famous Question (source)
2018-12-20 04:01:44 -0500 asked a question Create new topic that copies odometry topic

Create new topic that copies odometry topic Hi all, I want to create a new topic that copies the odometry topic data in

2018-12-10 03:25:46 -0500 received badge  Popular Question (source)
2018-12-07 03:07:22 -0500 commented question Reset Odometry poses

Hi, thanks for your immediate response. Well, I want to do is exactly reset all the values given by odometry topic throu

2018-12-06 10:02:13 -0500 asked a question Reset Odometry poses

Reset Odometry poses Hi , I am trying to create a script in python that resets the odometry values I get from my odometr

2018-10-24 02:50:05 -0500 edited answer Rotating using odometry/ problem with +180, -180 degrees

I managed to unwrap the angle here is the final code for any future reference : #! /usr/bin/env python import rospy f

2018-10-24 02:49:31 -0500 edited question Rotating using odometry/ problem with +180, -180 degrees

Rotating using odometry/ problem with +180, -180 degrees Hi everyone I am trying to create a script where the robot base

2018-10-24 02:49:31 -0500 received badge  Editor (source)
2018-10-24 02:48:57 -0500 marked best answer Rotating using odometry/ problem with +180, -180 degrees

Hi everyone I am trying to create a script where the robot based on the yaw message given by odometry rotates by a certain amount of degrees e.g. 90 degrees. A problem occurs when the robot is trying to rotate from an initial yaw in degrees that is bigger than 90 degrees, since the yaw given by the odometry topic has of a range of [-180,180] where the -180 and 180 values are the same. Is there any way to unwrap this ?

#! /usr/bin/env python

import rospy
from geometry_msgs.msg import Twist
import sys
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion, quaternion_from_euler
import math

PI = 3.1415926535897
#bound = 0.8 # for marvin
bound = 1
roll = pitch = yaw = 0.0
kp = 10 # for marvin

class movement:
    def __init__(self):
            rospy.init_node('move_robot_node', anonymous=True)         
        self.pub_move = rospy.Publisher('/marvin/diff_drive_controller/cmd_vel', Twist, queue_size=10)
        sub = rospy.Subscriber ('/marvin/diff_drive_controller/odom', Odometry, self.get_rotation)  
        self.move = Twist()

    def publish_vel(self):
        self.pub_move.publish(self.move)

    def get_rotation(self,msg):
        global roll, pitch, yaw
        orientation_q = msg.pose.pose.orientation
            orientation_list = [orientation_q.x, orientation_q.y, orientation_q.z, orientation_q.w]
            (roll, pitch, yaw) = euler_from_quaternion(orientation_list)

    def rotate_right_90(self):
        self.move.linear.x = 0
        self.move.linear.y = 0
        self.move.linear.z = 0
        self.move.angular.x = 0
        self.move.angular.y = 0
        print("Let's rotate your robot 90 degrees right")
        #kp = 10 #kp for marvin
        yaw_degree = yaw *180/math.pi
        target = yaw_degree -90
        target_rad = target*math.pi/180
        error_angle = target_rad-yaw

        while (abs(error_angle)) > 0.002:    
            if target < -180:
                print "target_initial"
                print target
                difference = target +180
                target = 180 + difference
                target_rad = target*math.pi/180
                error_angle = -(2*PI - (target_rad - yaw))
                error_angle_degrees = error_angle*180/math.pi
                self.move.angular.z = kp*(error_angle)
                    if self.move.angular.z >= bound:
                    self.move.angular.z = bound
                elif self.move.angular.z <= -bound:
                    self.move.angular.z = -bound
                self.publish_vel()
            else:           
                self.move.angular.z = kp*(error_angle)
                    if self.move.angular.z >= bound:
                    self.move.angular.z = bound
                elif self.move.angular.z <= -bound:
                    self.move.angular.z = -bound
                error_angle = target_rad-yaw

                self.publish_vel()

if __name__ == "__main__": 
    mov = movement()
    rate = rospy.Rate(10)  
    while not rospy.is_shutdown() :
        movement = raw_input('Enter desired movement: ')       
        if movement == 'r':
            mov.rotate_right_90()
        mov.publish_vel()
        rate.sleep()
2018-10-24 02:41:35 -0500 answered a question Rotating using odometry/ problem with +180, -180 degrees

I managed to unwrap the angle here is the final code for any future reference : ! /usr/bin/env python import rospy fr

2018-10-24 01:00:39 -0500 received badge  Notable Question (source)
2018-10-23 10:03:57 -0500 received badge  Student (source)
2018-10-23 10:03:24 -0500 received badge  Popular Question (source)
2018-10-23 08:31:28 -0500 edited question Rotating using odometry/ problem with +180, -180 degrees

Rotating using odometry/ problem with +180, -180 degrees Hi everyone I am trying to create a script where the robot base

2018-10-23 08:30:57 -0500 asked a question Rotating using odometry/ problem with +180, -180 degrees

Rotating using odometry/ problem with +180, -180 degrees Hi everyone I am trying to create a script where the robot base

2018-08-24 03:00:41 -0500 commented question Using osm_cartography

I actually solved this problem, you just need to install the pyproj and then the package works perfectly fine.

2018-08-23 06:31:57 -0500 commented question Using osm_cartography

any answer on this error??

2018-08-23 06:31:21 -0500 received badge  Supporter (source)
2018-08-07 02:31:44 -0500 received badge  Enthusiast
2018-08-01 07:05:11 -0500 commented answer How to build a 2D map which has only boundries of objects/ walls but without cells (no grid)

any easy to implement package for line-segment based mapping???

2018-08-01 03:24:46 -0500 received badge  Notable Question (source)
2018-08-01 03:21:54 -0500 marked best answer How to save a vector based map

Hi I am using the laser_line_extraction package to create lines and vector out of the laser points. Is there any way to save these type of maps (line or vector based ) in ROS???? Thanks in advance.

2018-08-01 03:21:54 -0500 received badge  Scholar (source)
2018-08-01 03:21:53 -0500 commented answer How to save a vector based map

Yes , I got it, I am trying to see how I would make this work, seems hard to implement it but for sure it is worth inves

2018-07-31 17:46:20 -0500 received badge  Popular Question (source)
2018-07-31 09:19:28 -0500 commented question How to save a vector based map

I only have the following topics that the /line_extractor publishes : * /line_markers [visualization_msgs/Marker] * /l

2018-07-30 07:18:16 -0500 asked a question How to save a vector based map

How to save a vector based map Hi I am using the laser_line_extraction (https://github.com/kam3k/laser_line_extraction)

2018-07-30 06:30:06 -0500 answered a question Vector Maps for Mobile Robotics

Any answer on how to build and save a vector map in ROS???