Python rospy.get_param() Examples
The following are 30
code examples of rospy.get_param().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rospy
, or try the search function
.
Example #1
Source File: wheel_scaler.py From differential-drive with GNU General Public License v3.0 | 7 votes |
def scaleWheel(): rospy.init_node("wheel_scaler") rospy.loginfo("wheel_scaler started") scale = rospy.get_param('distance_scale', 1) rospy.loginfo("wheel_scaler scale: %0.2f", scale) rospy.Subscriber("lwheel", Int16, lwheelCallback) rospy.Subscriber("rwheel", Int16, rwheelCallback) lscaled_pub = rospy.Publisher("lwheel_scaled", Int16, queue_size=10) rscaled_pub = rospy.Publisher("rwheel_scaled", Int16, queue_size=10) ### testing sleep CPU usage r = rospy.Rate(50) while not rospy.is_shutdown: r.sleep() rospy.spin()
Example #2
Source File: head_lift_joy.py From cozmo_driver with Apache License 2.0 | 7 votes |
def __init__(self): """ Create HeadLiftJoy object. """ # params self._head_axes = rospy.get_param('~head_axes', 3) self._lift_axes = rospy.get_param('~lift_axes', 3) self._head_button = rospy.get_param('~head_button', 4) self._lift_button = rospy.get_param('~lift_button', 5) # pubs self._head_pub = rospy.Publisher('head_angle', Float64, queue_size=1) self._lift_pub = rospy.Publisher('lift_height', Float64, queue_size=1) # subs self._joy_sub = rospy.Subscriber('joy', Joy, self._joy_cb, queue_size=1)
Example #3
Source File: virtual_joystick.py From ROS-Programming-Building-Powerful-Robots with MIT License | 7 votes |
def main(): ########################################################################## ########################################################################## rospy.init_node('virtual_joystick') rospy.loginfo('virtual_joystick started') global x_min global x_max global r_min global r_max x_min = rospy.get_param("~x_min", -0.20) x_max = rospy.get_param("~x_max", 0.20) r_min = rospy.get_param("~r_min", -1.0) r_max = rospy.get_param("~r_max", 1.0) app = QtGui.QApplication(sys.argv) ex = MainWindow() sys.exit(app.exec_())
Example #4
Source File: wheel_loopback.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def __init__(self): ############################################### rospy.init_node("wheel_loopback"); self.nodename = rospy.get_name() rospy.loginfo("%s started" % self.nodename) self.rate = rospy.get_param("~rate", 200) self.timeout_secs = rospy.get_param("~timeout_secs", 0.5) self.ticks_meter = float(rospy.get_param('~ticks_meter', 50)) self.velocity_scale = float(rospy.get_param('~velocity_scale', 255)) self.latest_motor = 0 self.wheel = 0 rospy.Subscriber('motor', Int16, self.motor_callback) self.pub_wheel = rospy.Publisher('wheel', Int16,queue_size=10) ###############################################
Example #5
Source File: action_recognition.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def get_parameters(self): """ Gets the necessary parameters from parameter server Args: Returns: (tuple) (camera_topic, output_topic, recognition_interval, buffer_size) """ camera_topic = rospy.get_param("~camera_topic") output_topic = rospy.get_param("~output_topic") recognition_interval = rospy.get_param("~recognition_interval") buffer_size = rospy.get_param("~buffer_size") return (camera_topic, output_topic, recognition_interval, buffer_size)
Example #6
Source File: racecar_joy.py From tianbot_racecar with GNU General Public License v3.0 | 6 votes |
def __init__(self): rospy.loginfo("Tianbot Racecar JoyTeleop Initializing...") self._twist = Twist() self._twist.linear.x = 1500 self._twist.angular.z = 90 self._deadman_pressed = False self._zero_twist_published = False self._cmd_vel_pub = rospy.Publisher('~/car/cmd_vel', Twist, queue_size=5) self._joy_sub = rospy.Subscriber('/joy', Joy, self.joy_callback) self._timer = rospy.Timer(rospy.Duration(0.05), self.joystick_controller) self._axis_throttle = 1 _joy_mode = rospy.get_param("~joy_mode", "D").lower() if _joy_mode == "d": self._axis_servo = 2 if _joy_mode == "x": self._axis_servo = 3 self._throttle_scale = rospy.get_param("~throttle_scale", 0.5) self._servo_scale = rospy.get_param("~servo_scale", 1)
Example #7
Source File: arduino.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeDriveGeometry(self): wheelDiameter = rospy.get_param("~driveGeometry/wheelDiameter", "0.9") trackWidth = rospy.get_param("~driveGeometry/trackWidth", "0.1") countsPerRevolution = rospy.get_param("~driveGeometry/countsPerRevolution", "2000") wheelDiameter= wheelDiameter * 1000 trackWidth=trackWidth * 1000 #countsPerRevolution=countsperRevolution*1000; #wheelDiameterParts = self._GetBaseAndExponent(wheelDiameter) #trackWidthParts = self._GetBaseAndExponent(trackWidth) message = 'dg %d %d %d\r' % (int(wheelDiameter), int(trackWidth), int(countsPerRevolution)) rospy.logdebug("Sending drive geometry params message: " + message) self._WriteSerial(message)
Example #8
Source File: arduino_bkup.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeSpeedController(self): velocityPParam = rospy.get_param("~speedController/velocityPParam", "0") velocityIParam = rospy.get_param("~speedController/velocityIParam", "0") turnPParam = rospy.get_param("~speedController/turnPParam", "0") turnIParam = rospy.get_param("~speedController/turnIParam", "0") commandTimeout = self._GetCommandTimeoutForSpeedController() message = 'sc %.2f %.2f %.2f %.2f %.2f\r' % (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #message = 'sc %f %f %f\r' % (velocityPParam, velocityIParam, turnPParam) rospy.logdebug("Sending differential drive gains message: " + message) self._WriteSerial(message) #speedControllerParams = (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #rospy.loginfo(str(speedControllerParams)) #self._WriteSpeedControllerParams(speedControllerParams)
Example #9
Source File: teleop_key.py From cozmo_driver with Apache License 2.0 | 6 votes |
def __init__(self): # setup CozmoTeleop.settings = termios.tcgetattr(sys.stdin) atexit.register(self.reset_terminal) # vars self.head_angle = STD_HEAD_ANGLE self.lift_height = STD_LIFT_HEIGHT # params self.lin_vel = rospy.get_param('~lin_vel', 0.2) self.ang_vel = rospy.get_param('~ang_vel', 1.5757) # pubs self._head_pub = rospy.Publisher('head_angle', Float64, queue_size=1) self._lift_pub = rospy.Publisher('lift_height', Float64, queue_size=1) self._cmd_vel_pub = rospy.Publisher('cmd_vel', Twist, queue_size=1)
Example #10
Source File: virtual_joystick.py From differential-drive with GNU General Public License v3.0 | 6 votes |
def main(): ########################################################################## ########################################################################## rospy.init_node('virtual_joystick') rospy.loginfo('virtual_joystick started') global x_min global x_max global r_min global r_max x_min = rospy.get_param("~x_min", -0.20) x_max = rospy.get_param("~x_max", 0.20) r_min = rospy.get_param("~r_min", -1.0) r_max = rospy.get_param("~r_max", 1.0) app = QtGui.QApplication(sys.argv) ex = MainWindow() sys.exit(app.exec_())
Example #11
Source File: virtual_joystick.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def main(): ########################################################################## ########################################################################## rospy.init_node('virtual_joystick') rospy.loginfo('virtual_joystick started') global x_min global x_max global r_min global r_max x_min = rospy.get_param("~x_min", -0.20) x_max = rospy.get_param("~x_max", 0.20) r_min = rospy.get_param("~r_min", -1.0) r_max = rospy.get_param("~r_max", 1.0) app = QtGui.QApplication(sys.argv) ex = MainWindow() sys.exit(app.exec_())
Example #12
Source File: wheel_loopback.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def __init__(self): ############################################### rospy.init_node("wheel_loopback"); self.nodename = rospy.get_name() rospy.loginfo("%s started" % self.nodename) self.rate = rospy.get_param("~rate", 200) self.timeout_secs = rospy.get_param("~timeout_secs", 0.5) self.ticks_meter = float(rospy.get_param('~ticks_meter', 50)) self.velocity_scale = float(rospy.get_param('~velocity_scale', 255)) self.latest_motor = 0 self.wheel = 0 rospy.Subscriber('motor', Int16, self.motor_callback) self.pub_wheel = rospy.Publisher('wheel', Int16,queue_size=10) ###############################################
Example #13
Source File: cob_people_object_detection_tensorflow.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def get_parameters(self): """ Gets the necessary parameters from parameter server Args: Returns: (tuple) (model name, num_of_classes, label_file) """ model_name = rospy.get_param("~model_name") num_of_classes = rospy.get_param("~num_of_classes") label_file = rospy.get_param("~label_file") camera_namespace = rospy.get_param("~camera_namespace") video_name = rospy.get_param("~video_name") num_workers = rospy.get_param("~num_workers") return (model_name, num_of_classes, label_file, \ camera_namespace, video_name, num_workers)
Example #14
Source File: face_recognizer.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def get_parameters(self): """ Gets the necessary parameters from parameter server Args: Returns: (tuple) (camera_topic, detection_topic, output_topic) """ camera_topic = rospy.get_param("~camera_topic") detection_topic = rospy.get_param("~detection_topic") output_topic = rospy.get_param("~output_topic") output_topic_rgb = rospy.get_param("~output_topic_rgb") return (camera_topic, detection_topic, output_topic, output_topic_rgb)
Example #15
Source File: tracker.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def get_parameters(self): """ Gets the necessary parameters from parameter server Args: Returns: (tuple) (camera_topic, detection_topic, tracker_topic, cost_threhold) """ detection_topic = rospy.get_param("~detection_topic") tracker_topic = rospy.get_param('~tracker_topic') cost_threhold = rospy.get_param('~cost_threhold') min_hits = rospy.get_param('~min_hits') max_age = rospy.get_param('~max_age') return (detection_topic, tracker_topic, cost_threhold, \ max_age, min_hits)
Example #16
Source File: mic_client.py From dialogflow_ros with MIT License | 6 votes |
def __init__(self): # Audio stream input setup FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 16000 self.CHUNK = 4096 self.audio = pyaudio.PyAudio() self.stream = self.audio.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=self.CHUNK, stream_callback=self._get_data) self._buff = Queue.Queue() # Buffer to hold audio data self.closed = False # ROS Text Publisher text_topic = rospy.get_param('/text_topic', '/dialogflow_text') self.text_pub = rospy.Publisher(text_topic, String, queue_size=10)
Example #17
Source File: audio_server.py From dialogflow_ros with MIT License | 6 votes |
def __init__(self): FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 16000 CHUNK = 4096 self.audio = pyaudio.PyAudio() self.stream = self.audio.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK, stream_callback=self._callback) self.serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.read_list = [self.serversocket] self._server_name = rospy.get_param('/dialogflow_client/server_name', '127.0.0.1') self._port = rospy.get_param('/dialogflow_client/port', 4444) rospy.loginfo("DF_CLIENT: Audio Server Started!")
Example #18
Source File: arduino (copy).py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeSpeedController(self): velocityPParam = rospy.get_param("~speedController/velocityPParam", "1") velocityIParam = rospy.get_param("~speedController/velocityIParam", "1") turnPParam = rospy.get_param("~speedController/turnPParam", "1") turnIParam = rospy.get_param("~speedController/turnIParam", "1") commandTimeout = self._GetCommandTimeoutForSpeedController() velocityPParam=velocityPParam * 1000 velocityIParam= velocityIParam * 1000 turnPParam = turnPParam * 1000 turnIParam=turnIParam * 1000 message = 'sc %d %d %d %d %d\r' % (int(velocityPParam), int(velocityIParam), int(turnPParam), int(turnIParam), int(commandTimeout)) #message = 'sc %f %f %f\r' % (velocityPParam, velocityIParam, turnPParam) rospy.logdebug("Sending differential drive gains message: " + message) self._WriteSerial(message) #speedControllerParams = (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #rospy.loginfo(str(speedControllerParams)) #self._WriteSpeedControllerParams(speedControllerParams)
Example #19
Source File: arduino (copy).py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeDriveGeometry(self): wheelDiameter = rospy.get_param("~driveGeometry/wheelDiameter", "0.9") trackWidth = rospy.get_param("~driveGeometry/trackWidth", "0.1") countsPerRevolution = rospy.get_param("~driveGeometry/countsPerRevolution", "2000") wheelDiameter= wheelDiameter * 1000 trackWidth=trackWidth * 1000 #countsPerRevolution=countsperRevolution*1000; #wheelDiameterParts = self._GetBaseAndExponent(wheelDiameter) #trackWidthParts = self._GetBaseAndExponent(trackWidth) message = 'dg %d %d %d\r' % (int(wheelDiameter), int(trackWidth), int(countsPerRevolution)) rospy.logdebug("Sending drive geometry params message: " + message) self._WriteSerial(message)
Example #20
Source File: arduino.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeDriveGeometry(self): wheelDiameter = rospy.get_param("~driveGeometry/wheelDiameter", "0.9") trackWidth = rospy.get_param("~driveGeometry/trackWidth", "0.1") countsPerRevolution = rospy.get_param("~driveGeometry/countsPerRevolution", "2000") wheelDiameter= wheelDiameter * 1000 trackWidth=trackWidth * 1000 #countsPerRevolution=countsperRevolution*1000; #wheelDiameterParts = self._GetBaseAndExponent(wheelDiameter) #trackWidthParts = self._GetBaseAndExponent(trackWidth) message = 'dg %d %d %d\r' % (int(wheelDiameter), int(trackWidth), int(countsPerRevolution)) rospy.logdebug("Sending drive geometry params message: " + message) self._WriteSerial(message)
Example #21
Source File: arduino_bkup.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeSpeedController(self): velocityPParam = rospy.get_param("~speedController/velocityPParam", "0") velocityIParam = rospy.get_param("~speedController/velocityIParam", "0") turnPParam = rospy.get_param("~speedController/turnPParam", "0") turnIParam = rospy.get_param("~speedController/turnIParam", "0") commandTimeout = self._GetCommandTimeoutForSpeedController() message = 'sc %.2f %.2f %.2f %.2f %.2f\r' % (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #message = 'sc %f %f %f\r' % (velocityPParam, velocityIParam, turnPParam) rospy.logdebug("Sending differential drive gains message: " + message) self._WriteSerial(message) #speedControllerParams = (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #rospy.loginfo(str(speedControllerParams)) #self._WriteSpeedControllerParams(speedControllerParams)
Example #22
Source File: arduino_bkup.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeSpeedController(self): velocityPParam = rospy.get_param("~speedController/velocityPParam", "0") velocityIParam = rospy.get_param("~speedController/velocityIParam", "0") turnPParam = rospy.get_param("~speedController/turnPParam", "0") turnIParam = rospy.get_param("~speedController/turnIParam", "0") commandTimeout = self._GetCommandTimeoutForSpeedController() message = 'sc %.2f %.2f %.2f %.2f %.2f\r' % (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #message = 'sc %f %f %f\r' % (velocityPParam, velocityIParam, turnPParam) rospy.logdebug("Sending differential drive gains message: " + message) self._WriteSerial(message) #speedControllerParams = (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #rospy.loginfo(str(speedControllerParams)) #self._WriteSpeedControllerParams(speedControllerParams)
Example #23
Source File: arduino.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeSpeedController(self): velocityPParam = rospy.get_param("~speedController/velocityPParam", "1") velocityIParam = rospy.get_param("~speedController/velocityIParam", "1") turnPParam = rospy.get_param("~speedController/turnPParam", "1") turnIParam = rospy.get_param("~speedController/turnIParam", "1") commandTimeout = self._GetCommandTimeoutForSpeedController() velocityPParam=velocityPParam * 1000 velocityIParam= velocityIParam * 1000 turnPParam = turnPParam * 1000 turnIParam=turnIParam * 1000 message = 'sc %d %d %d %d %d\r' % (int(velocityPParam), int(velocityIParam), int(turnPParam), int(turnIParam), int(commandTimeout)) #message = 'sc %f %f %f\r' % (velocityPParam, velocityIParam, turnPParam) rospy.logdebug("Sending differential drive gains message: " + message) self._WriteSerial(message) #speedControllerParams = (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #rospy.loginfo(str(speedControllerParams)) #self._WriteSpeedControllerParams(speedControllerParams)
Example #24
Source File: virtual_joystick.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def main(): ########################################################################## ########################################################################## rospy.init_node('virtual_joystick') rospy.loginfo('virtual_joystick started') global x_min global x_max global r_min global r_max x_min = rospy.get_param("~x_min", -0.20) x_max = rospy.get_param("~x_max", 0.20) r_min = rospy.get_param("~r_min", -1.0) r_max = rospy.get_param("~r_max", 1.0) app = QtGui.QApplication(sys.argv) ex = MainWindow() sys.exit(app.exec_())
Example #25
Source File: twist_to_motors.py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def __init__(self): ############################################################# rospy.init_node("twist_to_motors") nodename = rospy.get_name() rospy.loginfo("%s started" % nodename) self.w = rospy.get_param("~base_width", 0.2) self.pub_lmotor = rospy.Publisher('lwheel_vtarget', Float32,queue_size=10) self.pub_rmotor = rospy.Publisher('rwheel_vtarget', Float32,queue_size=10) rospy.Subscriber('cmd_vel_mux/input/teleop', Twist, self.twistCallback) self.rate = rospy.get_param("~rate", 50) self.timeout_ticks = rospy.get_param("~timeout_ticks", 2) self.left = 0 self.right = 0 #############################################################
Example #26
Source File: arduino (copy).py From ROS-Programming-Building-Powerful-Robots with MIT License | 6 votes |
def _InitializeSpeedController(self): velocityPParam = rospy.get_param("~speedController/velocityPParam", "1") velocityIParam = rospy.get_param("~speedController/velocityIParam", "1") turnPParam = rospy.get_param("~speedController/turnPParam", "1") turnIParam = rospy.get_param("~speedController/turnIParam", "1") commandTimeout = self._GetCommandTimeoutForSpeedController() velocityPParam=velocityPParam * 1000 velocityIParam= velocityIParam * 1000 turnPParam = turnPParam * 1000 turnIParam=turnIParam * 1000 message = 'sc %d %d %d %d %d\r' % (int(velocityPParam), int(velocityIParam), int(turnPParam), int(turnIParam), int(commandTimeout)) #message = 'sc %f %f %f\r' % (velocityPParam, velocityIParam, turnPParam) rospy.logdebug("Sending differential drive gains message: " + message) self._WriteSerial(message) #speedControllerParams = (velocityPParam, velocityIParam, turnPParam, turnIParam, commandTimeout) #rospy.loginfo(str(speedControllerParams)) #self._WriteSpeedControllerParams(speedControllerParams)
Example #27
Source File: projection.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 6 votes |
def get_parameters(self): """ Gets the necessary parameters from parameter server Returns: (tuple) : depth_topic (String): Incoming depth topic name face_topic (String): Incoming face bounding box topic name output_topic (String): Outgoing depth topic name f (Float): Focal Length cx (Int): Principle Point Horizontal cy (Int): Principle Point Vertical """ depth_topic = rospy.get_param("~depth_topic") face_topic = rospy.get_param('~face_topic') output_topic = rospy.get_param('~output_topic') f = rospy.get_param('~focal_length') cx = rospy.get_param('~cx') cy = rospy.get_param('~cy') return (depth_topic, face_topic, output_topic, f, cx, cy)
Example #28
Source File: arduino_bkup.py From ROS-Programming-Building-Powerful-Robots with MIT License | 5 votes |
def _GetCommandTimeoutForSpeedController(self): """ Returns the command timeout for the speed controller in seconds. If no velocity command arrives for more than the specified timeout then the speed controller will stop the robot. """ return rospy.get_param("~speedController/commandTimeout", "0.5")
Example #29
Source File: robot_gui.py From ROS-Programming-Building-Powerful-Robots with MIT License | 5 votes |
def add(self,text): battery_value = rospy.get_param("battery_value") robot_status = rospy.get_param("robot_status") self.progressBar.setProperty("value", battery_value) self.label_4.setText(_fromUtf8(robot_status))
Example #30
Source File: base_controller.py From ROS-Programming-Building-Powerful-Robots with MIT License | 5 votes |
def __init__(self, Serializer, name): Thread.__init__ (self) self.finished = Event() # Handle for the Serializer self.mySerializer = Serializer # Parameters self.rate = float(rospy.get_param("~base_controller_rate", 10)) self.ticks_per_meter = float(self.mySerializer.ticks_per_meter) self.wheel_track = self.mySerializer.wheel_track self.gear_reduction = self.mySerializer.gear_reduction self.encoder_resolution = self.mySerializer.encoder_resolution now = rospy.Time.now() self.t_delta = rospy.Duration(1.0/self.rate) self.t_next = now + self.t_delta self.then = now # time for determining dx/dy # internal data self.enc_left = 0 # encoder readings self.enc_right = 0 self.x = 0. # position in xy plane self.y = 0. self.th = 0. # rotation in radians self.encoder_error = False # subscriptions rospy.Subscriber("cmd_vel", Twist, self.cmdVelCallback) # Clear any old odometry info self.mySerializer.clear_encoder([1, 2]) # Set up the odometry broadcaster self.odomPub = rospy.Publisher('odom', Odometry) self.odomBroadcaster = TransformBroadcaster() rospy.loginfo("Started Base Controller '"+ name +"' for a base of " + str(self.wheel_track) + "m wide with " + str(self.ticks_per_meter) + " ticks per meter")