topics seem like the best way for storing "states" of the robot (stateful). so that we can monitor all states/components of the robots like position, temperature, voltage, etc. that makes sense to me.
however, i also see a lot of people using topics as a way to send instructions/commands to the robots (like the topic /head_pan_joint/command for sending commands to servos, like /cmd_vel for sending movement instructions to mobile base, etc). in this case, it doesn't make sense to me.
it seems to me that this should be designed as a service (stateless). if you want to send a command to servo, create a service at the servo level that can be called upon. if you want to send a command to mobile base, create a service at the mobile base that can be called upon.
what are the advantages of designing things like /cmd_vel and /head_pan_joint/command as topics? what are the disadvantages of desigining them as services?
thanks.
↧
design question: topic vs service?
↧
Relation between Services and Nodes
Hello,
I have a very simple question. What's the relation between services and nodes? Can we say services are functions/methods defined in a node. For example, according to this tutorial:
http://wiki.ros.org/ROS/Tutorials/UnderstandingServicesParams
when I'm running the turtlesim_node node, here is the list of active services:
/clear
/kill
/reset
/rosout/get_loggers
/rosout/set_logger_level
/spawn
/teleop_turtle/get_loggers
/teleop_turtle/set_logger_level
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/get_loggers
/turtlesim/set_logger_level The question is where are all these services defined? Where can I find their codes? Thanks
/kill
/reset
/rosout/get_loggers
/rosout/set_logger_level
/spawn
/teleop_turtle/get_loggers
/teleop_turtle/set_logger_level
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/get_loggers
/turtlesim/set_logger_level The question is where are all these services defined? Where can I find their codes? Thanks
↧
↧
Using Actionlib for publishing force data in ROS
Hello All!
So here is what I want to implement, in a simple list format
1) I want to have a topic which publishes data from my force sensor (serial) onto the network constantly.
2) I want to have a service, which when called, starts logging force values from the data stream being published.
3) In the case that I use multiple force sensors at once, I want to have each topic publishing and service request-response business to happen in an individual thread.
My current implementation (which simply publishes topics for all sensors in a while(ros::ok()) loop for all sensors) publishes data at about 16 Hz per force sensor, and I have a feeling it is the ROS stuff that is messing with the data output rate. I tried reading serial data off the sensors into a file without any ROS stuff in between, and then manually counted/calculated the frequency of data logging. I got an average frequency of about 55 Hz per sensor, clearly indicating that I am choking the system somewhere.
This is when I remembered a prior suggestion by Lorentz that I should use the actionlib library within ROS to achieve my above listed objectives. Is there any good tutorial on implementing actionlib server/client systems within threads, encapsulated in a class structure in C++?
Also, I am open to other suggestions with which I can increase my data rate compared to what it is now. I got frequent suggestions from my friends about using a circular queue/ buffer, also known as a ring buffer to store my data temporarily until it is read. How can I implement this buffer idea under a ROS backdrop? Any pointers in this matter would go a long way in solving this issue.
Thanks and any help is much appreciated!
↧
Is it bad practice to create and shutdown services during runtime?
Hi all!
I'm trying to connect my robot to a webserver using a node communication node.
This node creates the service "/get_webdata" when the connection is established and authenticated. When the connection is lost, the service is destroyed again.
This allows me to use wait_for_service in other nodes, which is pretty useful for waiting without ugly sleep-loops.
So my question is: is this a common ros practice to use:
webdata = rospy.Service("/get/webdata", Webdata, self.web_cb)
and
webdata.shutdown("Connection lost")
to signal other nodes if the connection is up?
I didn't read anywhere that it's bad practice, but it feels like I'm abusing this feature.
Would it be a better solution to keep the service running all the time and instead return a status variable, indicating that the connection is unavailable?
↧
Set a parameter through ROS services
Hi to everyone,
Yesterday I was going through the parameters of my work environment in ROS. One of my colleagues told me that if I need to change a parameter I should do it within rosservice and not by doing:
rosparam set /pathToTheParameter/parameterUniqueName
He was not able to explain me why but I would like to understand it.
Someone of you could please help me?
Thanks.
↧
↧
Calling a multiplexer select from a node
Hi I'm wondering how I would go about calling the multiplexer select from inside a node instead of using the command line tool. Are there any examples on how to accomplish this as I cannot find any?
Thanks in advance for any help you can give.
↧
Rospy Services with method class
Hi,
How can i use a class method for rospy.Service()?
The .srv file is
int64 a
int64 b
---
bool response
The code in the server.py is
s = rospy.Service('setVelocity', SetVelocity, self.setVelocity)
The signature of the setVelocity method
def setVelocity (self, r, l)
In the client.py i've
s = rospy.ServiceProxy('setVelocity', SetVelocity)
s(3,5)
and i get this error:
error processing request: setVelocity() takes exactly 3 arguments (2 given)
Sorry for my bad english
↧
[Solved]One callback interrupting another, is that possible?
Hi, I built a node with a class in it, the class has two callbacks one is bind to dynamic reconfigure server, the other is bind to a service. Both callbacks are class member. So it is something like this:
class A
{
bool param;
bool callback1 (node::service::Request &req, node::service::Response &res)
{
//some long computations
if (param)
//do something
else
//do something else
}
void callback2 (node::nodeConfig &config, uint32_t level)
{
//updating parameters...
param = config.param;
}
}
The service callback has some internal loop that requires user input to continue, my idea was to let user (re)configure parameters while the service executes. However this is not working because callback2 does not interrupt callback1 and param is only set AFTER callback1 terminates.
What would be the correct way to achieve this ? How can i rewrite the class so that callback2 can interrupt callback1 ?
I thought that maybe this happens because both callbacks are class members, what if callback2 is a global function ?
↧
How can I make a robot joints and links reset completely in gazebo from python?
I want to make an experiment in gazebo using an evolutive learning algorithm to find walking gaits in an hexapod robot. For this, I've built an hexapod consisting in a body and six legs controlled by three revolute joints to emulate servo motors. The experiment will consist in the following stages:
1. Spawn the hexapod model in Gazebo
1. Generate a population of randomly generated gaits (lists of joint states) to send to the hexapod
2. Pick a gait from the population and send each set of joint states in sequence to the respective topics in the hexapod
3. Measure how much the hexapod advances for the given gait
4. Use the gaits with the biggest advance achieved to build the next population
5. Go back to step 2 until the algorithm reaches a limit of iterations and finds a gait that makes the hexapod walk properly
Do develop this, I am programming in python to send the moving commands. I generate a list of the walking patterns I want to test and then I iterate on that list to try the patterns. After that, I measure the advance in x making a service call to
/gazebo/get_model_state
And here comes the problem. To reset the model, I make a service call to
/gazebo/reset_simulation
(I have also tried /gazebo/reset_world)
and my robot model goes back to position <0,0,0> and rotation <0,0,0>. The problem is that after I make this service call, the joints states and the links are not reseted and this causes sometimes the model to go up fliying since the legs intersect with the floor model and the simulator processes this badly.
I wanted to ask if there is some way to make a call to gazebo to reset the model's pose including its joints states so the robot can go back exactly to the state it was spawned in for all of its joints and links.
By now, I'll reset joints positions by calling their respective topics before reseting the simulation, but I find this solution dirty and more time consuming than reseting the whole model with a single call (Time is important, since I have to make lots of iterations).
Thanks in advance to help me with my first question in the forum :)
↧
↧
How to use "MsgSrvDoc" in wiki
Hello, I have a [wiki page](http://wiki.ros.org/maggie_devices_msgs?distro=hydro) for my messages and services but it doesn't work the "MsgSrvDoc" label when I used in a wiki page.
I based the structure of [my package](https://github.com/UC3MSocialRobots/maggie_devices_msgs) and the wiki page on [common_msgs](http://wiki.ros.org/common_msgs) repo.
So, my question is, why is it not working in the wiki page I created?
Thanks.
↧
How to use ROS services
I am trying to get data from a gps and use it in a program that I am writing. I read somewhere that ROS services would be an ideal tool for me to use to accomplish my task. I read over the tutorial that ROS provides but I am still having troubles understanding how to use them. In the links below I have the information that I need for my program to work.
http://docs.ros.org/jade/api/geographic_msgs/html/msg/GeoPose.html
http://docs.ros.org/jade/api/geographic_msgs/html/msg/GeoPoint.html
↧
having to compile msgs and srvs first
Hi all,
I'm working with a large stack that includes some custom ROS messages and services.
Every time I try to compile from scratch, catkin yells at me about not knowing where certain message header files are.
To fix this problem, I do a `catkin_make --pkg` on the specific service package or message package I'm trying to use.
Is there any way to force compilation of those packages first? It doesn't really make sense that they're not being compiled first to begin with as they're listed as build and run depends in the package.xml's of the packages that complain.
Thanks!
↧
Generic Ros Service Clients
I'm currently trying to use the [topic_tools/mux](http://wiki.ros.org/topic_tools/mux) node to multiplex multiple topics using the same selector (which is implemented as a ROS service). Now, I've recently discovered that ROS Services cannot be created with the same name, and if they are then the most recent Services gets created and the ones before are destroyed (without notification to the user by the way which is not good in the sense that it may not be intended by the user). So then, another solution would be to create the multiplexer each with a different service name. Then I would create another node that broadcasted to these services. Now, I would like to make this generic (as it would be very useful for later use) such that this node would:
- take __N__ output service names, and an input service name (called __S__) via program arguments
- For each __N__ services name create a ServiceClient and check to make sure all clients have the same request and respond ROS types. If they don't then exit with some failure type
- Then advertise a service with name __S__. This service will simply take the called request and forward it to each of the __N__ clients. The response from these clients can be ignored (for now).
My current problem is that I can't find a way to determine the Service type based on the given qualified service name using the current roscpp API. I may be missing something however, it appears that the only way to create a ROS Service client is to know the Request and Respond types first; there is no generic wrapper around this so that applications - such as mine - can forward client requests to services without regard to the type. This seems to be possible as I would assume that there is some class that the roscpp API is using to bind a service's name with its service type - that and the topic_tools/mux node seems to be able to do this for topics (that is forwarding the messages from one topic to another without regard to the topic message types). And though services are different than topics they both seem to be based on message types.
↧
↧
Using MoveGroup in different nodes (moveit!)
Hi!,
Right now im working with a custom robot and moveit!, and what Im trying to do, is to generate some services nodes, and use them to move my robot using moveit!.
The problem is that for optimization reasons, i dont want to have to initialize a MoveGroup in my node services every time i call one of them, as i have to do right now. However i couldnt find any way to send an already defined MoveGroup to another node, and work with it.
So the question is, Is ther anyway to do this? To work with the same defined MoveGroup in different nodes?
Thank you in advance! any help will be welcome :D
↧
rosjava_tutorial_services on android
Hello.
I am trying to create a ROS client server application in android.
I'm using the rosjava_tutorial_services. If i create both server and client on the android emulator everything works fine.
But if i create the client on the android emulator and the server on the pc, the client can not connect to the server (connection refused on address 127.0.0.1:(generic port)).
I also tried to change the file hosts of the emulator (localhost from 127.0.0.1 to 10.0.2.2) but i received the same error.
Anyone know how to connect the client to the server? What IP address should i use?
↧
Problems building a node which depends on another node.
Hopefully someone can help, I've been trying to get this to work for quite a while now.
I have a custom node which provides services and messages called dp_ptu47 (it's a pan tilt unit). I'm trying to get access to the services of the dp_ptu47 node from another client node, which will be running on a different machine.
I get the following error when I catkin_make my client node:
-- +++ processing catkin package: 'sme_awareness'
-- ==> add_subdirectory(sme_awareness)
-- Using these message generators: gencpp;genlisp;genpy
CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:75 (find_package):
Could not find a package configuration file provided by "dp_ptu47_msgs"
with any of the following names:
dp_ptu47_msgsConfig.cmake
dp_ptu47_msgs-config.cmake
Add the installation prefix of "dp_ptu47_msgs" to CMAKE_PREFIX_PATH or set
"dp_ptu47_msgs_DIR" to a directory containing one of the above files. If
"dp_ptu47_msgs" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
sme_awareness/CMakeLists.txt:7 (find_package)
I've checked that the 'dp_ptu47_msgs' package exists and it's there and ros seems happy, I've also looked for the file that the error message says it can't find 'dp_ptu47_msgsConfig.cmake' and this exists in the 'install/share/dp_ptu47_msgs/cmake' path of the node. The error message doesn't say where it it's looking for the file so I'm not sure if this is in the right place or not.
I've tried all sorts of things to find out what's going on, and I'm out of ideas. Does anyone have any ideas what could be causing this.
Thanks
↧
genjava_message_artifacts empty jar for custom services
I am trying to incorporate custom services into my rosjava project. I have copied the directory containing all the srv files (there are no custom messages, just services), but when I run genjava_message_artifacts it generates a jar for me, but the jar is completely empty.
I have tried adding the directory into the rosjava_minimal/src directory as well, but - again - I end up with no class files being generated.
If anybody could please help, it would be greatly appreciated. It just will not cooperate and generate the jar that I need to continue my work.
Thanks.
↧
↧
ROS operating system services, how ?
I'm researching how ROS is implementing operating services like: including hardware abstraction, low-level device control, implementation of commonly-used functionality,message-passing between processes and package management. Every where I read something about ROS this is stated in the intro but not explained clearly.
Does anyone now how they are implemented or a good source where I can find more information about this? :)
↧
Why does a response vector of type geometry_msgs/PoseStamped[] poses in a service always has 24 elements? (c++)
Hi guys,
I can't explain what is happening, maybe it is just my compiler, or my ROS version, but every time that I want to use the response vector poses (of type geometry_msgs/PoseStamped[]) it has 24 places, so if I ask for the size before assigning any value to it:
bool generate_robot_targets_service(robot_pick_place::GenerateRobotTargets::Request &req, robot_pick_place::GenerateRobotTargets::Response &res){
int poses_size = sizeof(res.poses);
std::cout << "The size of poses is: " << poses_size << std::endl;//shows: The size of poses is: 24
return true;
}
poses_size is equal to 24. **Why?**
I try to delete the 24 ? (whatever they are) using the erase() vector method and it gives a core dumped error (like always).
I could try creating a vector pointer and assigning it to the res.poses to point to the new memory, but still, **Why does it start with 24 positions filled with garbage?**
Any idea is welcome, please comment.
↧
camera calibration service not available (specific driver for VRMagic)
Hello all;
I am using "camera calibration" node to calibrate a stereo system based on a VRMagic D3 stereo camera.
The driver I am using to obtain the images from the camera is "vrmagic_ros_bridge_server".
My launch file is:
I have remapped the images to a common workspace, and the following topics:
/img_pub1
/img_pub1_camera_info
/img_pub2
/img_pub2_camera_info
/rosout
/rosout_agg
/stereo/camera_info
/stereo/left
/stereo/left/compressed
/stereo/left/compressed/parameter_descriptions
/stereo/left/compressed/parameter_updates
/stereo/left/compressedDepth
/stereo/left/compressedDepth/parameter_descriptions
/stereo/left/compressedDepth/parameter_updates
/stereo/left/theora
/stereo/left/theora/parameter_descriptions
/stereo/left/theora/parameter_updates
/stereo/right
/stereo/right/compressed
/stereo/right/compressed/parameter_descriptions
/stereo/right/compressed/parameter_updates
/stereo/right/compressedDepth
/stereo/right/compressedDepth/parameter_descriptions
/stereo/right/compressedDepth/parameter_updates
/stereo/right/theora
/stereo/right/theora/parameter_descriptions
/stereo/right/theora/parameter_updates
The services that I have available are:
/publish_image_and_info_to_common_ws_node_1/get_loggers
/publish_image_and_info_to_common_ws_node_1/set_logger_level
/publish_image_and_info_to_common_ws_node_2/get_loggers
/publish_image_and_info_to_common_ws_node_2/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level
/stereo/left/compressed/set_parameters
/stereo/left/compressedDepth/set_parameters
/stereo/left/theora/set_parameters
/stereo/right/compressed/set_parameters
/stereo/right/compressedDepth/set_parameters
/stereo/right/theora/set_parameters
/vrmagic_ros_bridge_server_node/get_loggers
/vrmagic_ros_bridge_server_node/set_logger_level
Unfortunately, when I use the "camera_calibration" node, I have the following error:
rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.024 right:=/stereo/right left:=/stereo/left right_camera:=/right left_camera:=/left
('Waiting for service', '/left/set_camera_info', '...')
Service not found
('Waiting for service', '/right/set_camera_info', '...')
Service not found
Which is obvious, because my vrmagic camera driver is not providing that services. If I use "--no-service-check" flag, the terminal get blocked and I obtain no results.
I know this issue has appeared more times on the forums, and all the answers where related to solutions changing or modifying the camera driver to obtain results, but, what if the driver that we are using does NOT provide that services in anyway?
It is not possible to calibrate cameras without using stardard camera drivers?
I would appreciate any king of help a lot...
Thank you,
Alberto
↧