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

suho0515's profile - activity

2023-04-10 21:19:01 -0500 marked best answer AttributeError : 'int' object has no attribute 'action'

Hello, i'm trying to control mobile robot 'rb1 base', it has elevate function which can move its head up and down. You can see the Service caller in the down side of the picture, it has the service topic named '/rb1_base/robotnik_base_control/set_elevator', based on that information, i wrote the service call program, you can see this top of the picture. In the SetElevator.h there is only one variable named 'int32 action', if i make the action variable to 1 then the robot elevate up, if i make it to -1 then the robot elevate down. so i wrote the code 'srv(1)' to elevate up the robot. But it says 'AttributeError : 'int' object has no attribute 'action''. Is there special way to change the variable 'int32 action'? Is it not just int?

here is the code.

from random import sample
from math import pow, sqrt
from actionlib_msgs.msg import *
from geometry_msgs.msg import Pose, PoseWithCovarianceStamped, Point, Quaternion, Twist
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from robotnik_msgs.srv import SetElevator, SetElevatorRequest, SetElevatorResponse
import rospy
import actionlib



class MultiPointNav():
    def __init__(self):
        rospy.init_node('multi_point_nav', anonymous=True)

        rospy.on_shutdown(self.shutdown)

        # How long in seconds should the robot pause at each location?
        self.rest_time = rospy.get_param("~rest_time", 3)

        # Are we running in the fake simulator?
        self.fake_test = rospy.get_param("~fake_test", False)

        # Goal state return values
        goal_states = ['PENDING', 'ACTIVE', 'PREEMPTED', 
                       'SUCCEEDED', 'ABORTED', 'REJECTED',
                       'PREEMPTING', 'RECALLING', 'RECALLED',
                       'LOST']


        locations = dict()

        locations['Point1'] = Pose(Point(-0.64500000000, 0.82600000000, 0.000), Quaternion(0.000, 0.000, 0.000, 1.000))
        locations['Point2'] = Pose(Point(-1.24000000000, -0.95300000000, 0.000), Quaternion(0.000, 0.000, 0.000, 1.000))
        #locations['Point3'] = Pose(Point(-2.50947999954, -5.9229183197, 0.000), Quaternion(0.000, 0.000, 0.000, 1.000))
        #locations['Point4'] = Pose(Point(-12.919, -23.867, 0.000), Quaternion(0.000, 0.000, 0.000, 1.000))
        #locations['Point5'] = Pose(Point(1.471, 1.007, 0.000), Quaternion(0.000, 0.000, 0.480, 0.877))
        #locations['Point6'] = Pose(Point(-0.861, -0.019, 0.000), Quaternion(0.000, 0.000, 0.892, -0.451))

        # Publisher to manually control the robot (e.g. to stop it, queue_size=5)
        self.cmd_vel_pub = rospy.Publisher('/rb1_base/cmd_vel', Twist, queue_size=5)

        # Subscribe to the move_base action server
        self.move_base = actionlib.SimpleActionClient("rb1_base/move_base", MoveBaseAction)

        rospy.loginfo("Waiting for move_base action server...")

        # Wait 60 seconds for the action server to become available
        self.move_base.wait_for_server(rospy.Duration(60))

        rospy.loginfo("Connected to move base server")

        # A variable to hold the initial pose of the robot to be set by 
        # the user in RViz
        initial_pose = PoseWithCovarianceStamped()

        # Variables to keep track of success rate, running time,
        # and distance traveled
        n_locations = len(locations)
        n_goals = 0
        n_successes = 0
        i = n_locations
        distance_traveled = 0
        start_time = rospy.Time.now()
        running_time = 0
        location = ""
        last_location = ""

        # Get the initial pose from the user
        rospy.loginfo("*** Click the 2D Pose Estimate button in RViz to set the robot's initial pose...")
        rospy.wait_for_message('/rb1_base/initialpose', PoseWithCovarianceStamped)
        self.last_location ...
(more)
2021-05-02 20:59:08 -0500 answered a question ur_robot_driver: test_move.py keeps on "waiting for server..."

hello, I've solved it out with the guide from you guys but little bit edited information. following Universal_Robots_RO

2021-03-21 09:08:28 -0500 received badge  Famous Question (source)
2021-03-21 09:08:28 -0500 received badge  Notable Question (source)
2021-03-21 09:08:28 -0500 received badge  Popular Question (source)
2019-09-26 11:04:21 -0500 asked a question depth camera doesn't move in Rviz

depth camera doesn't move in Rviz Hello guys, I'm trying to do hetor_slam with simulated drone with Gazebo. but there i

2019-08-14 02:22:43 -0500 received badge  Famous Question (source)
2019-08-09 06:02:53 -0500 commented answer create 2d occupancy grid map by laser data

i finally worked with this code. i've changed 3 thing. odometry topic name to the name i'm subscribed in main.py the

2019-08-09 00:52:24 -0500 commented answer create 2d occupancy grid map by laser data

Thank you very much :)

2019-08-08 23:50:58 -0500 commented answer create 2d occupancy grid map by laser data

Thanks again, i'm gonna try it! can i ask you something? if i understand right, the "main.py" get "scan data", "odom da

2019-08-08 22:02:44 -0500 commented answer create 2d occupancy grid map by laser data

it is very helpful. thanks! could you mention that where did you get these code?

2019-04-12 04:32:57 -0500 commented answer knowrob_cad_models: Cannot locate rosdep definition for [iai_cad_downloader]

suprisingly, it solved my problem! i typed 'rosdep install -y --from-paths . --ignore-src --rosdistro kinetic' before an

2019-03-22 00:09:54 -0500 received badge  Enthusiast
2019-03-18 21:43:51 -0500 commented answer AttributeError : 'int' object has no attribute 'action'

Hm... it doesn't works in those ways... If i put SetElevatorRequest argument in ServicePoxy then it says 'AttributeError

2019-03-18 15:15:27 -0500 received badge  Notable Question (source)
2019-03-18 00:44:03 -0500 edited answer AttributeError : 'int' object has no attribute 'action'

I solved this issue somehow! jarvisschultz told me it could be problem with service definition. so i try to make differn

2019-03-18 00:44:03 -0500 received badge  Editor (source)
2019-03-18 00:43:01 -0500 answered a question AttributeError : 'int' object has no attribute 'action'

I solved this issue somehow! jarvisschultz told me it could be problem with service definition. so i try to make differn

2019-03-17 17:32:29 -0500 received badge  Popular Question (source)
2019-03-16 20:26:58 -0500 commented question AttributeError : 'int' object has no attribute 'action'

Thank you for your information, jarvisschultz! okay i would share a bit of code where related with service call, and i

2019-03-15 16:44:07 -0500 asked a question AttributeError : 'int' object has no attribute 'action'

AttributeError : 'int' object has no attribute 'action' Hello, i'm trying to control mobile robot 'rb1 base', it has ele