1 初始化
rclpy.init()
rclpy.spin()
rclpy.spin_once()
rclpy.spin_until_future_complete()
rclpy.get_global_executor()
rclpy.shutdown()
2 Node
from rclpy.node import Node
add_waitable
count_publishers(topic_name)
count_subscribers(topic_name)
destroy_node()
3 Topic
3.1 Publisher
Node.create_publisher(
msg_type,
topic,
qos_profile,
)
assert_liveliness()
destroy()
get_subscription_count()
publish(msg)
3.2 Subscription
Node.create_subscription(
msg_type,
topic,
callback(),
qos_profile
)
4 Services
4.1 Client
Node.create_client(
srv_type,
srv_name,
qos_profile
)
call(request)
call_async(request)
remove_pending_request()
service_is_ready()
wait_for_service()
4.2 Service
Node.create-service(
srv_type,
srv_name,
qos_profile
)
send_response()
5 Actions
5.1 Action Client
from rclpy.action import ActionClient
ActionClient(
action_type,
action_name,
)
add_to_wait_set(wait_set)
destroy()
get_num_entities()
is_ready(wait_set)
send_goal(goal)
send_goal_async()
server_is_ready()
wait_for_server()
5.2 Action Server
ActionServer(
action_type,
action_name,
callback,
)
add_to_wait_set(wait_set)
destroy()
get_num_entities()
is_ready(wait_set)
send_goal(goal)
send_goal_async()
server_is_ready()
wait_for_server()
6 Timer
from rclpy.timer import Rate,Timer
Rate(timer,*,context)
Timer(
callback,
callback_group,
timer_period_ns,
clock,
*,
context=None
)
cancel()
destroy()
is_canceled()
is_ready()
reset()
time_since_last_call()
time_until_next_call()
7 Context
init()
ok()
on_shutdown()
shutdown()
try_shutdown()