<commit_before>#!/usr/bin/env python  
import roslib
roslib.load_manifest('maru_msgs')
import rospy
import actionlib
import sys
import maru_msgs.msg
from math import pi


def exposure_client(exp,camera_name):
    name = camera_name+'/calib_exposure_action'
    print "waiting for server", name
    client_exp = actionlib.SimpleActionClient(name, maru_msgs.msg.calib_exposureAction)
    client_exp.wait_for_server()
    print "has server"
    goal = maru_msgs.msg.calib_exposureGoal()
    goal.goal_exposure = exp
    goal.accuracy = 5
    client_exp.send_goal(goal)
    res = client_exp.wait_for_result(rospy.Duration(20.0))
    return res



if __name__ == '__main__':
  
  try:
      rospy.init_node('exp_caller')
      cam_name = "/crane"
      if len(sys.argv) > 2:
          cam_name = sys.argv[2]
  
      result = exposure_client(int(sys.argv[1]),cam_name)
      # print result
      # print "Result:", ', '.join([str(n) for n in result.sequence])
  except rospy.ROSInterruptException:
      print "program interrupted before completion"<commit_msg>improved interface for exp_caller (and no default camera anymore)<commit_after>#!/usr/bin/env python  
import roslib
roslib.load_manifest('maru_msgs')
import rospy
import actionlib
import sys
import maru_msgs.msg
from math import pi


def exposure_client(exp,camera_name):
    name = camera_name+'/calib_exposure_action'
    rospy.loginfo("waiting for server " + name)
    client_exp = actionlib.SimpleActionClient(name, maru_msgs.msg.calib_exposureAction)
    if not client_exp.wait_for_server(rospy.Duration(5.0)):
        rospy.logerr("Could not find server")
        exit(0)

    goal = maru_msgs.msg.calib_exposureGoal()
    goal.goal_exposure = exp
    goal.accuracy = 5
    client_exp.send_goal(goal)
    res = client_exp.wait_for_result(rospy.Duration(20.0))
    return res



if __name__ == '__main__':

    try:
        rospy.init_node('exp_caller')


        if len(sys.argv) < 3:
            print "Usage: ./exp_caller brightness camera"
            exit(0)

        cam_name = sys.argv[2]

        try:
            brightness = int(sys.argv[1])
        except ValueError:
            rospy.logerr("target brightness of " + str(sys.argv[1]) + " is not an integer!")
            exit(0)

        result = exposure_client(brightness,cam_name)

    except rospy.ROSInterruptException:
        print "program interrupted before completion"
{'fraction_non_alphanumeric': 0.10195588847274241, 'fraction_numerical': 0.008322929671244279, 'mean_word_length': 3.269982238010657, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5153885', 'n_tokens_mistral': 857, 'n_tokens_neox': 802, 'n_words': 167}