Klamp't  0.8.1
ROS.h
1 #ifndef IO_ROS_H
2 #define IO_ROS_H
3 
4 #include <vector>
5 #include <KrisLibrary/math3d/primitives.h>
6 //forward declarations
7 namespace Meshing { class PointCloud3D; }
8 class RobotWorld;
9 class Robot;
11 class WorldSimulation;
12 class LinearPath;
13 class SensorBase;
14 
17 
21 bool ROSInit(const char* nodename="klampt");
23 bool ROSShutdown();
25 bool ROSInitialized();
28 bool ROSSubscribeUpdate();
30 bool ROSDetach(const char* topic);
37 bool ROSIsConnected(const char* topic);
39 std::string ROSFrame(const char* topic);
44 bool ROSWaitForUpdate(const char* topic,double timeout=0);
46 bool ROSHadUpdate(const char* topic);
48 bool ROSSetQueueSize(int size);
49 
50 bool ROSPublishPose(const Math3D::RigidTransform& T,const char* topic="klampt/transform");
51 bool ROSPublishJointState(const Robot& robot,const char* topic="klampt/joint_state");
52 bool ROSPublishPointCloud(const Meshing::PointCloud3D& pc,const char* topic="klampt/point_cloud");
54 bool ROSPublishTrajectory(const LinearPath& path,const char* topic="klampt/trajectory");
56 bool ROSPublishTrajectory(const Robot& robot,const LinearPath& path,const char* topic="klampt/trajectory");
58 bool ROSPublishTrajectory(const Robot& robot,const std::vector<int>& indices,const LinearPath& path,const char* topic="klampt/trajectory");
60 bool ROSPublishCommandedJointState(ControlledRobotSimulator& robot,const char* topic="klampt/joint_state_commanded");
62 bool ROSPublishSensedJointState(ControlledRobotSimulator& robot,const char* topic="klampt/joint_state_sensed");
67 bool ROSPublishSensorMeasurement(const SensorBase* sensor,const char* topic="klampt/sensor");
70 bool ROSPublishSensorMeasurement(const SensorBase* sensor,const Robot& robot,const char* topic="klampt/sensor",const char* frameprefix="klampt");
71 
75 bool ROSSubscribePose(Math3D::RigidTransform& T,const char* topic="klampt/joint_state");
79 bool ROSSubscribeJointState(Robot& robot,const char* topic="klampt/joint_state");
83 bool ROSSubscribePointCloud(Meshing::PointCloud3D& pc,const char* topic="klampt/point_cloud");
87 bool ROSSubscribeTrajectory(LinearPath& path,const char* topic="klampt/trajectory");
92 bool ROSSubscribeTrajectory(Robot& robot,LinearPath& path,const char* topic="klampt/trajectory");
93 
97 bool ROSPublishTransforms(const RobotWorld& world,const char* frameprefix="klampt");
101 bool ROSPublishTransforms(const WorldSimulation& sim,const char* frameprefix="klampt");
104 bool ROSPublishTransforms(const Robot& robot,const char* frameprefix="klampt");
106 bool ROSPublishTransform(const Math3D::RigidTransform& T,const char* frame="klampt_transform");
107 
112 bool ROSSubscribeTransforms(RobotWorld& world,const char* frameprefix="klampt");
117 bool ROSSubscribeTransforms(Robot& robot,const char* frameprefix="klampt");
121 bool ROSSubscribeTransform(Math3D::RigidTransform& T,const char* frameprefix="klampt_transform");
122 
125 #endif
Definition: ROS.h:7
bool ROSDetach(const char *topic)
Deletes a topics. [TODO] To remove the subscribed TF topics, call ...
The main robot type used in RobotSim.
Definition: Robot.h:79
int ROSNumPublishedTopics()
Returns the number of advertised topics.
A class containing information about an ODE-simulated and controlled robot.
Definition: ControlledSimulator.h:17
bool ROSPublishTrajectory(const LinearPath &path, const char *topic="klampt/trajectory")
publishes a Trajectory message with default joint names
bool ROSWaitForUpdate(const char *topic, double timeout=0)
bool ROSPublishTransforms(const RobotWorld &world, const char *frameprefix="klampt")
bool ROSSetQueueSize(int size)
Sets the global queue size.
The main world class containing multiple robots, objects, and static geometries (terrains). Lights and other viewport information may also be stored here.
Definition: World.h:20
bool ROSShutdown()
Must call this after all other ROS[X] calls to cleanly shut down ROS.
bool ROSSubscribePointCloud(Meshing::PointCloud3D &pc, const char *topic="klampt/point_cloud")
A piecewise linear path.
Definition: Paths.h:13
A sensor base class. A SensorBase should allow a Controller to both connect to a simulation as well a...
Definition: Sensor.h:51
bool ROSSubscribeTrajectory(LinearPath &path, const char *topic="klampt/trajectory")
bool ROSSubscribeTransform(Math3D::RigidTransform &T, const char *frameprefix="klampt_transform")
bool ROSSubscribeUpdate()
bool ROSHadUpdate(const char *topic)
Returns true if the ROS topic had an update on the past ROSSubscribeUpdate step.
bool ROSSubscribePose(Math3D::RigidTransform &T, const char *topic="klampt/joint_state")
bool ROSPublishSensorMeasurement(const SensorBase *sensor, const char *topic="klampt/sensor")
bool ROSSubscribeJointState(Robot &robot, const char *topic="klampt/joint_state")
int ROSNumSubscribedTopics()
Returns the number of subscribed topics.
bool ROSSubscribeTransforms(RobotWorld &world, const char *frameprefix="klampt")
bool ROSPublishTransform(const Math3D::RigidTransform &T, const char *frame="klampt_transform")
Publishes the transform to the transform server under the given name.
A physical simulator for a RobotWorld.
Definition: WorldSimulation.h:67
bool ROSInitialized()
Returns true if ROS is initialized.
std::string ROSFrame(const char *topic)
Returns the ROS frame ID that the data is attached to, if any.
bool ROSIsConnected(const char *topic)
bool ROSInit(const char *nodename="klampt")
bool ROSPublishSensedJointState(ControlledRobotSimulator &robot, const char *topic="klampt/joint_state_sensed")
publishes a JointState about the robot&#39;s current sensed joint state
bool ROSPublishCommandedJointState(ControlledRobotSimulator &robot, const char *topic="klampt/joint_state_commanded")
publishes a JointState about the robot&#39;s current commanded joint state