RosClient
- class compas_fab.backends.RosClient(host='localhost', port=9090, is_secure=False, planner_backend='moveit')[source]
Bases:
roslibpy.ros.Ros
,compas_fab.backends.interfaces.client.ClientInterface
Interface to use ROS as backend via the rosbridge.
The connection is managed by
roslibpy
.RosClient
is a context manager type, so it’s best used in combination with thewith
statement to ensure resource deallocation.- Parameters
host (
str
) – ROS bridge host. Defaults tolocalhost
.port (
int
) – Port of the ROS Bridge. Defaults to9090
.is_secure (
bool
) –True
to indicate it should use a secure web socket, otherwiseFalse
.planner_backend (str) – Name of the planner backend plugin to use. The plugin must be a sub-class of
compas_fab.backends.PlannerInterface
. Defaults to"moveit"
, making use ofcompas_fab.backends.MoveItPlanner
.
Examples
>>> from compas_fab.backends import RosClient >>> with RosClient() as client: ... print('Connected: %s' % client.is_connected) Connected: True
Note
For more examples, check out the ROS examples page.
Methods
__init__
([host, port, is_secure, ...])add_attached_collision_mesh
(*args, **kwargs)Forwards call to appropriate method in the planner.
add_collision_mesh
(*args, **kwargs)Forwards call to appropriate method in the planner.
append_collision_mesh
(*args, **kwargs)Forwards call to appropriate method in the planner.
blocking_call_from_thread
(callback, timeout)Call the given function from a thread, and wait for the result synchronously for as long as the timeout will allow.
call_async_service
(message, callback, errback)Send a service request to ROS once the connection is established.
call_in_thread
(callback)Call the given function in a thread.
call_later
(delay, callback)Call the given function after a certain period of time has passed.
call_sync_service
(message, timeout)Send a blocking service request to ROS once the connection is established, waiting for the result to be return.
close
()Disconnect from ROS.
connect
()Connect to ROS.
delete_param
(name[, callback, errback])Delete parameter from the ROS Parameter Server.
emit
(event_name, *args)Trigger a named event.
execute_joint_trajectory
(joint_trajectory[, ...])Execute a joint trajectory via the MoveIt infrastructure.
follow_configurations
(callback, joint_names, ...)follow_joint_trajectory
(joint_trajectory[, ...])Follow the joint trajectory as computed by MoveIt planner.
forward_kinematics
(*args, **kwargs)Forwards call to appropriate method in the planner.
get_action_servers
(callback[, errback])Retrieve list of action servers in ROS.
get_message_details
(message_type[, ...])Retrieve details of a message type in ROS.
get_node_details
(node[, callback, errback])Retrieve list subscribed topics, publishing topics and services of a specific node name.
get_nodes
([callback, errback])Retrieve list of active node names in ROS.
get_param
(name[, callback, errback])Get the value of a parameter from the ROS Parameter Server.
get_params
([callback, errback])Retrieve list of param names from the ROS Parameter Server.
get_planning_scene
(*args, **kwargs)Forwards call to appropriate method in the planner.
get_service_request_callback
(message)Get the callback which, when called, sends the service request.
get_service_request_details
(type[, ...])Retrieve details of a ROS Service Request.
get_service_response_details
(type[, ...])Retrieve details of a ROS Service Response.
get_service_type
(service_name[, callback, ...])Retrieve the type of a service in ROS.
get_services
([callback, errback])Retrieve list of active service names in ROS.
get_services_for_type
(service_type[, ...])Retrieve list of services in ROS matching the specified type.
get_time
([callback, errback])Retrieve the current ROS time.
get_topic_type
(topic[, callback, errback])Retrieve the type of a topic in ROS.
get_topics
([callback, errback])Retrieve list of topics in ROS.
get_topics_for_type
(topic_type[, callback, ...])Retrieve list of topics in ROS matching the specified type.
inverse_kinematics
(*args, **kwargs)Forwards call to appropriate method in the planner.
load_robot
([load_geometry, urdf_param_name, ...])Load an entire robot instance -including model and semantics- directly from ROS.
off
(event_name[, callback])Remove a callback from an arbitrary named event.
on
(event_name, callback)Add a callback to an arbitrary named event.
on_ready
(callback[, run_in_thread])Add a callback to be executed when the connection is established.
plan_cartesian_motion
(*args, **kwargs)Forwards call to appropriate method in the planner.
plan_motion
(*args, **kwargs)Forwards call to appropriate method in the planner.
remove_attached_collision_mesh
(*args, **kwargs)Forwards call to appropriate method in the planner.
remove_collision_mesh
(*args, **kwargs)Forwards call to appropriate method in the planner.
reset_planning_scene
(*args, **kwargs)Forwards call to appropriate method in the planner.
run
([timeout])Kick-starts a non-blocking event loop.
Kick-starts a blocking loop to wait for events.
send_on_ready
(message)Send message to ROS once the connection is established.
set_param
(name, value[, callback, errback])Set the value of a parameter from the ROS Parameter Server.
set_status_level
(level, identifier)Signals the termination of the main event loop.
Attributes
id_counter
Generate an auto-incremental ID starting from 1.
is_connected
Indicate if the ROS connection is open or not.
ros_distro
Retrieves the ROS version to which the client is connected (eg.