public class Topic extends Object
| Constructor and Description |
|---|
Topic(Ros ros,
String name,
String type)
Create a ROS topic with the given information.
|
Topic(Ros ros,
String name,
String type,
int throttleRate)
Create a ROS topic with the given information.
|
Topic(Ros ros,
String name,
String type,
JRosbridge.CompressionType compression)
Create a ROS topic with the given information.
|
Topic(Ros ros,
String name,
String type,
JRosbridge.CompressionType compression,
int throttleRate)
Create a ROS topic with the given information.
|
| Modifier and Type | Method and Description |
|---|---|
void |
advertise()
Registers as a publisher for the topic.
|
JRosbridge.CompressionType |
getCompression()
Get the compression type for this topic.
|
String |
getName()
Get the name of this topic.
|
Ros |
getRos()
Get the ROS connection handle for this topic.
|
int |
getThrottleRate()
Get the throttle rate for this topic.
|
String |
getType()
Return the message type of this topic.
|
boolean |
isAdvertised()
Check if the current topic is advertising to ROS.
|
boolean |
isSubscribed()
Check if the current topic is subscribed to ROS.
|
void |
publish(Message message)
Publish the given message to ROS on this topic.
|
void |
subscribe(TopicCallback cb)
Subscribe to this topic.
|
void |
unadvertise()
Unregister as a publisher for the topic.
|
void |
unsubscribe()
Unregisters as a subscriber for the topic.
|
public Topic(Ros ros, String name, String type)
ros - A handle to the ROS connection.name - The name of the topic (e.g., "/cmd_vel").type - The message type (e.g., "std_msgs/String").public Topic(Ros ros, String name, String type, JRosbridge.CompressionType compression)
ros - A handle to the ROS connection.name - The name of the topic (e.g., "/cmd_vel").type - The message type (e.g., "std_msgs/String").compression - The type of compression used for this topic.public Topic(Ros ros, String name, String type, int throttleRate)
ros - A handle to the ROS connection.name - The name of the topic (e.g., "/cmd_vel").type - The message type (e.g., "std_msgs/String").throttleRate - The throttle rate to use for this topic.public Topic(Ros ros, String name, String type, JRosbridge.CompressionType compression, int throttleRate)
ros - A handle to the ROS connection.name - The name of the topic (e.g., "/cmd_vel").type - The message type (e.g., "std_msgs/String").compression - The type of compression used for this topic.throttleRate - The throttle rate to use for this topic.public Ros getRos()
public String getName()
public String getType()
public boolean isAdvertised()
public boolean isSubscribed()
public JRosbridge.CompressionType getCompression()
public int getThrottleRate()
public void subscribe(TopicCallback cb)
cb - The callback that will be called when incoming messages are
received.public void unsubscribe()
public void advertise()
public void unadvertise()
public void publish(Message message)
message - The message to publish.Copyright © 2014. All rights reserved.