Ask Your Question

SupermanPrime01's profile - activity

2021-01-15 03:38:03 -0600 received badge  Nice Question (source)
2020-08-07 03:38:37 -0600 received badge  Notable Question (source)
2020-01-09 17:28:56 -0600 received badge  Student (source)
2018-05-10 10:47:41 -0600 received badge  Famous Question (source)
2018-01-25 02:43:07 -0600 received badge  Famous Question (source)
2018-01-23 15:24:27 -0600 received badge  Popular Question (source)
2018-01-23 07:46:24 -0600 received badge  Famous Question (source)
2018-01-06 11:56:03 -0600 received badge  Famous Question (source)
2018-01-06 11:56:03 -0600 received badge  Notable Question (source)
2017-09-19 11:53:23 -0600 received badge  Famous Question (source)
2017-07-25 22:58:46 -0600 received badge  Notable Question (source)
2017-07-16 22:41:56 -0600 received badge  Notable Question (source)
2017-06-28 12:22:45 -0600 received badge  Popular Question (source)
2017-06-27 14:52:58 -0600 asked a question Problem building workspace with 'non-catkin pkgs'.

Invoking "make cmake_check_build_system" failed Hello, I'm having a problem with catkin_make command in my workspace. T

2017-05-18 00:07:42 -0600 marked best answer How do I average 60 values published values from a node

Hello,

Is there a way I can take 60 values from a topic and calculate the average after every 60 values. I'm working with GPS and the accuracy is about 3 meters. So I'll get readings that are ~3 meters of where I'm actually at. Taking the average helps pin point my approximate location but I don't know a way to do it without copying and pasting my data into an excel sheet.

Thank you in advance.

2017-05-17 12:24:47 -0600 received badge  Notable Question (source)
2017-05-15 23:22:07 -0600 received badge  Popular Question (source)
2017-05-15 17:16:27 -0600 asked a question How do I average 60 values published values from a node

How do I average 60 values published values from a node Hello, Is there a way I can take 60 values from a topic and cal

2017-04-28 15:23:31 -0600 received badge  Popular Question (source)
2017-04-28 15:09:33 -0600 received badge  Popular Question (source)
2017-04-26 22:19:04 -0600 marked best answer How do I Calculate Distance Using 2 GPS Topics

Hello,

So currently I have two GPS modules and they each have their own nodes. The 2 nodes publish their GPS information onto their own topics. So 2 nodes and 2 topics. I'm able to subscribe to both nodes but I'm having trouble using the variables in the callback function to calculate distance.

I would get this error: NameError: global name 'gps_lat' is not defined

Here's my code below

#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from nmea_msgs.msg import Sentence
from sensor_msgs.msg import NavSatFix
import math

def callback(data):
    gps_lat = round(data.latitude, 6)
    gps_lon = round(data.longitude, 6)

def callback1(data):
    gps1_lat = round(data.latitude, 6)
    gps1_lon = round(data.longitude, 6)

def listener():

    rospy.init_node('gps_monitor', anonymous=True)
    rospy.Subscriber("/fix", NavSatFix, callback)
    rospy.Subscriber("/fix1", NavSatFix, callback1)
    rospy.spin()

    delta_lat = (gps_lat*(108000) - gps1_lat*(108000))
    delta_lon = (gps_lon*(108000) - gps1_lon*(108000))
    hyp_m = (delta_lat**2 + delta_lon**2)**0.5
    hyp_ft = (hyp_m*3.2800839)
    rospy.loginfo("Distance is %s in ft.", hyp_ft)



if __name__ == '__main__':
    listener()
2017-04-26 22:19:04 -0600 received badge  Supporter (source)
2017-04-26 22:19:01 -0600 commented answer How do I Calculate Distance Using 2 GPS Topics

Thank you so much Geoff. This was exactly what I needed. When I tried the global variables method the distances would co

2017-04-26 19:44:10 -0600 asked a question How do I Calculate Distance Using 2 GPS Topics

How do I Calculate Distance Using 2 GPS Topics Hello, So currently I have two GPS modules and they each have their own

2017-04-26 18:31:32 -0600 commented question how to make multiple topics with nmea_navsat_driver

"libnmea_navsat_driver.driver1" then I went to the "nmea_navsat_driver/src/libnmea_navsat_driver.driver" folder to dupli

2017-04-26 18:28:55 -0600 commented question how to make multiple topics with nmea_navsat_driver

Sure thing. So what I did was I duplicated the file "nmea_serieal_driver" in the "nmea_navsat_driver/scripts" folder and

2017-04-26 17:39:39 -0600 received badge  Enthusiast
2017-04-25 17:34:00 -0600 asked a question how to make multiple topics with nmea_navsat_driver

how to make multiple topics with nmea_navsat_driver Hello, I'm trying to figure out how to create 2 nodes and 2 topics

2017-04-10 14:08:54 -0600 commented answer how do i run straight line command over again in turtlesim straight line tutorial using python

Thank you for providing the code. When people explain it to me, I have trouble visualizing it in my mind. Thankfully, you've provided the code and I can match the code with your description.

2017-04-10 14:07:35 -0600 received badge  Scholar (source)
2017-04-09 12:47:15 -0600 asked a question how do i run straight line command over again in turtlesim straight line tutorial using python

Hello,

I've gone through the turtlesim movement tutorials and they've helped a lot but I'm unable to get the script to continuously ask me for inputs for 1 minute and execute the movements. I've tried to use a while loop but it doesn't seem to work. When I Ctrl-C the terminal running the script it'll continuously ask me for inputs but the turtle doesn't move. How would I change the python code to have it asks me for inputs more than once and move the turtle multiple times without having to rerun the script?

The code I used is shown below:

#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
import time

def move():
    # Starts a new node
    rospy.init_node('robot_cleaner', anonymous=True)
    velocity_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10)
    vel_msg = Twist()

    #Receiveing the user's input
    print("Let's move your robot")
    speed = input("Input your speed:")
    distance = input("Type your distance:")
    isForward = input("Foward?: ")#True or False

    #Checking if the movement is forward or backwards
    if(isForward):
        vel_msg.linear.x = abs(speed)
    else:
        vel_msg.linear.x = -abs(speed)
    #Since we are moving just in x-axis
    vel_msg.linear.y = 0
    vel_msg.linear.z = 0
    vel_msg.angular.x = 0
    vel_msg.angular.y = 0
    vel_msg.angular.z = 0

    while not rospy.is_shutdown():

        #Setting the current time for distance calculus
        t0 = rospy.Time.now().to_sec()
        current_distance = 0

        #Loop to move the turtle in an specified distance
        while(current_distance < distance):
            #Publish the velocity
            velocity_publisher.publish(vel_msg)
            #Takes actual time to velocity calculus
            t1=rospy.Time.now().to_sec()
            #Calculates distancePoseStamped
            current_distance= speed*(t1-t0)
        #After the loop, stops the robot
        vel_msg.linear.x = 0
        #Force the robot to stop
        velocity_publisher.publish(vel_msg)


if __name__ == '__main__':
     try:
         timeout =  time.time() + 60
         while time.time() < timeout:
             move()

     except rospy.ROSInterruptException:
         pass
2017-03-29 03:16:07 -0600 received badge  Notable Question (source)
2017-03-28 04:47:03 -0600 received badge  Popular Question (source)
2017-03-27 20:20:40 -0600 asked a question Invoking "-j8 -l8" failed

Hello, I'm trying to install the tim_sumulator and I followed this guide for ros indigo https://github.com/dougvk/tum_simulator . Instead of creating a new workspace I downloaded the dependencies in my catkin_src/src directory. Now when I try to "catkin_make" while in the "catkin_ws" directory, I get this error Invoking "make -j8 -l8" failed

The following is what I get from the terminal:

Base path: /home/jtu/catkin_ws Source space: /home/jtu/catkin_ws/src Build space: /home/jtu/catkin_ws/build Devel space: /home/jtu/catkin_ws/devel Install space: /home/jtu/catkin_ws/install ####

Running command: "make cmake_check_build_system" in "/home/jtu/catkin_ws/build"

#### ####

Running command: "make -j8 -l8" in "/home/jtu/catkin_ws/build"

#### [ 0%] Built target geometry_msgs_generate_messages_py [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RawImu [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_AttitudeCommand [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RuddersCommand Built target _cvg_sim_msgs_generate_messages_check_deps_HeightCommand [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RawRC [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_PositionXYCommand [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_ServoCommand Built target _cvg_sim_msgs_generate_messages_check_deps_MotorCommand [ 0%] [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_Supply Built target _cvg_sim_msgs_generate_messages_check_deps_ControllerState Built target _cvg_sim_msgs_generate_messages_check_deps_ThrustCommand [ 0%] [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_HeadingCommand Built target _cvg_sim_msgs_generate_messages_check_deps_Altimeter Built target _cvg_sim_msgs_generate_messages_check_deps_VelocityZCommand [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_MotorPWM [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_VelocityXYCommand [ 0%] [ 0%] [ 0%] [ 0%] [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_Altitude Built target geometry_msgs_generate_messages_lisp Built target _cvg_sim_msgs_generate_messages_check_deps_YawrateCommand Built target _cvg_sim_msgs_generate_messages_check_deps_MotorStatus Built target _cvg_sim_msgs_generate_messages_check_deps_Compass Built target _cvg_sim_msgs_generate_messages_check_deps_RC [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RawMagnetic Built target geometry_msgs_generate_messages_cpp [ 0%] Built target std_msgs_generate_messages_lisp [ 0%] Built target std_msgs_generate_messages_cpp [ 0%] Built target std_msgs_generate_messages_py [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_Num [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_of [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_RecordEnable Built target _ardrone_autonomy_generate_messages_check_deps_navdata_raw_measures [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_kalman_pressure [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision Built target _ardrone_autonomy_generate_messages_check_deps_navdata_pwm [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_video_stream Built target _ardrone_autonomy_generate_messages_check_deps_navdata_time [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_detect [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_euler_angles [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_Navdata [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_altitude [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_CamSelect Built target _ardrone_autonomy_generate_messages_check_deps_navdata_rc_references [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_trackers_send [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_vector31 [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_FlightAnim Built target _ardrone_autonomy_generate_messages_check_deps_matrix33 [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_hdvideo_stream [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_references [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_demo [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_perf [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_trims [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_raw Built target _ardrone_autonomy_generate_messages_check_deps_navdata_watchdog [ 0%] [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_wifi Built target _ardrone_autonomy_generate_messages_check_deps_navdata_games Built target _ardrone_autonomy_generate_messages_check_deps_navdata_adc_data_frame [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_zimmu_3000 [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_phys_measures [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_magneto [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_wind_speed [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_gyros_offsets [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_vector21 [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_LedAnim [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_pressure_raw Performing update step for 'ardronelib' [ 0%] Built target sensor_msgs_generate_messages_py [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Pid_receive [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Pid2 [ 0%] [ 0%] Built target nav_msgs_generate_messages_py Performing configure step for 'ardronelib' [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Test [ 0%] [ 0%] [ 0%] No configure Built target _eagle_one_test_generate_messages_check_deps_State Built target sensor_msgs_generate_messages_lisp Built target nav_msgs_generate_messages_lisp [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Pid_send [ 0%] [ 0%] Built target _cvg_sim_gazebo_plugins_generate_messages_check_deps_SetBias Built target sensor_msgs_generate_messages_cpp [ 0%] [ 0%] [ 0%] Built target nav_msgs_generate_messages_cpp [ 0%] [ 0%] [ 0%] Performing build step for 'ardronelib' Building CXX object tum_simulator/cvg_sim_gazebo_plugins/CMakeFiles/hector_gazebo_ros_magnetic.dir/src/gazebo_ros_magnetic.cpp.o Building CXX object tum_simulator/cvg_sim_gazebo_plugins/CMakeFiles/hector_gazebo_ros_gps.dir/src/gazebo_ros_gps.cpp.o make[3]: warning: jobserver unavailable: using -j1. Add +' to parent make rule. Building CXX object tum_simulator/cvg_sim_gazebo_plugins/CMakeFiles/hector_gazebo_ros_sonar.dir/src/gazebo_ros_sonar.cpp.o Building CXX object ... (more)

2017-03-27 20:20:40 -0600 asked a question Invoking "make -j8 -l8" failed

Hello, I'm trying to install the tim_sumulator and I followed this guide for ros indigo https://github.com/dougvk/tum_simulator . Instead of creating a new workspace I downloaded the dependencies in my catkin_src/src directory. Now when I try to "catkin_make" while in the "catkin_ws" directory, I get this error Invoking "make -j8 -l8" failed

The following is what I get from the terminal:

Base path: /home/jtu/catkin_ws Source space: /home/jtu/catkin_ws/src Build space: /home/jtu/catkin_ws/build Devel space: /home/jtu/catkin_ws/devel Install space: /home/jtu/catkin_ws/install ####

Running command: "make cmake_check_build_system" in "/home/jtu/catkin_ws/build"

#### ####

Running command: "make -j8 -l8" in "/home/jtu/catkin_ws/build"

#### [ 0%] Built target geometry_msgs_generate_messages_py [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RawImu [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_AttitudeCommand [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RuddersCommand Built target _cvg_sim_msgs_generate_messages_check_deps_HeightCommand [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RawRC [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_PositionXYCommand [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_ServoCommand Built target _cvg_sim_msgs_generate_messages_check_deps_MotorCommand [ 0%] [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_Supply Built target _cvg_sim_msgs_generate_messages_check_deps_ControllerState Built target _cvg_sim_msgs_generate_messages_check_deps_ThrustCommand [ 0%] [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_HeadingCommand Built target _cvg_sim_msgs_generate_messages_check_deps_Altimeter Built target _cvg_sim_msgs_generate_messages_check_deps_VelocityZCommand [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_MotorPWM [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_VelocityXYCommand [ 0%] [ 0%] [ 0%] [ 0%] [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_Altitude Built target geometry_msgs_generate_messages_lisp Built target _cvg_sim_msgs_generate_messages_check_deps_YawrateCommand Built target _cvg_sim_msgs_generate_messages_check_deps_MotorStatus Built target _cvg_sim_msgs_generate_messages_check_deps_Compass Built target _cvg_sim_msgs_generate_messages_check_deps_RC [ 0%] [ 0%] Built target _cvg_sim_msgs_generate_messages_check_deps_RawMagnetic Built target geometry_msgs_generate_messages_cpp [ 0%] Built target std_msgs_generate_messages_lisp [ 0%] Built target std_msgs_generate_messages_cpp [ 0%] Built target std_msgs_generate_messages_py [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_Num [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_of [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_RecordEnable Built target _ardrone_autonomy_generate_messages_check_deps_navdata_raw_measures [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_kalman_pressure [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision Built target _ardrone_autonomy_generate_messages_check_deps_navdata_pwm [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_video_stream Built target _ardrone_autonomy_generate_messages_check_deps_navdata_time [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_detect [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_euler_angles [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_Navdata [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_altitude [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_CamSelect Built target _ardrone_autonomy_generate_messages_check_deps_navdata_rc_references [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_trackers_send [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_vector31 [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_FlightAnim Built target _ardrone_autonomy_generate_messages_check_deps_matrix33 [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_hdvideo_stream [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_references [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_demo [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_perf [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_trims [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_vision_raw Built target _ardrone_autonomy_generate_messages_check_deps_navdata_watchdog [ 0%] [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_wifi Built target _ardrone_autonomy_generate_messages_check_deps_navdata_games Built target _ardrone_autonomy_generate_messages_check_deps_navdata_adc_data_frame [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_zimmu_3000 [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_phys_measures [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_magneto [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_wind_speed [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_gyros_offsets [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_vector21 [ 0%] [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_LedAnim [ 0%] Built target _ardrone_autonomy_generate_messages_check_deps_navdata_pressure_raw Performing update step for 'ardronelib' [ 0%] Built target sensor_msgs_generate_messages_py [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Pid_receive [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Pid2 [ 0%] [ 0%] Built target nav_msgs_generate_messages_py Performing configure step for 'ardronelib' [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Test [ 0%] [ 0%] [ 0%] No configure Built target _eagle_one_test_generate_messages_check_deps_State Built target sensor_msgs_generate_messages_lisp Built target nav_msgs_generate_messages_lisp [ 0%] Built target _eagle_one_test_generate_messages_check_deps_Pid_send [ 0%] [ 0%] Built target _cvg_sim_gazebo_plugins_generate_messages_check_deps_SetBias Built target sensor_msgs_generate_messages_cpp [ 0%] [ 0%] [ 0%] Built target nav_msgs_generate_messages_cpp [ 0%] [ 0%] [ 0%] Performing build step for 'ardronelib' Building CXX object tum_simulator/cvg_sim_gazebo_plugins/CMakeFiles/hector_gazebo_ros_magnetic.dir/src/gazebo_ros_magnetic.cpp.o Building CXX object tum_simulator/cvg_sim_gazebo_plugins/CMakeFiles/hector_gazebo_ros_gps.dir/src/gazebo_ros_gps.cpp.o make[3]: warning: jobserver unavailable: using -j1. Add +' to parent make rule. Building CXX object tum_simulator/cvg_sim_gazebo_plugins/CMakeFiles/hector_gazebo_ros_sonar.dir/src/gazebo_ros_sonar.cpp.o Building CXX object ... (more)