ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I suggest you create a player class and take the main method out of it. This way, you can instantiate a new robot and use it as a variable in a ROS class.

What I mean:

First class: - PlayerLaser (inherits player) - starts player (from inherited methods) - has laser messages (now laser is an object)

Second class: - RosLaser - Has methods to get laser data. - Has a return method

In your main method (separate entity): - create a ROS publisher - create a Robot (or PlayerLaser) - have a RosLaser::getLaserMessage() function that returns the ROS laser type - publish the method

There are some examples with a player class on my github.

I suggest you create a player class and take the main method out of it. This way, you can instantiate a new robot and use it as a variable in a ROS class.

What I mean:

First class: - PlayerLaser (inherits player) - starts player (from inherited methods) - has laser messages (now laser is an object)

Second class: - RosLaser - Has methods to get laser data. - Has a return method

In your main method (separate entity): - create a ROS publisher - create a Robot (or PlayerLaser) - have a RosLaser::getLaserMessage() function that returns the ROS laser type - publish the method

There are some examples with a player class on my github.

I suggest you create a player class and take the main method out of it. This way, you can instantiate a new robot and use it as a variable in a ROS class.

What I mean:

First class:

-
  • PlayerLaser (inherits player) - player)
    • starts player (from inherited methods) - methods)
    • has laser messages (now laser is an object)

Second class:

-
  • RosLaser -
    • Has methods to get laser data.
    • -
    • Has a return method

In your main method (separate entity): - create a ROS publisher - create a Robot (or PlayerLaser) - have a RosLaser::getLaserMessage() function that returns the ROS laser type - publish the method

There are some examples with a player class on my github.

click to hide/show revision 4
Made the answer all pretty.

I suggest you create a player class and take the main method out of it. This way, you can instantiate a new robot and use it as a variable in a ROS class.

What I mean:

First class:

  • PlayerLaser (inherits player)
    • starts player (from inherited methods)
    • has laser messages (now laser is an object)

Second class:

  • RosLaser
    • Has methods to get laser data.
    • Has a return method

  • In your main method (separate (separate entity): -
    • create a ROS publisher - publisher
    • create a Robot (or PlayerLaser) - PlayerLaser)
    • have a RosLaser::getLaserMessage() function that returns the ROS laser type - laser type
    • publish the method

  • There are some examples with a player class on my github.

    I suggest you create a player class and take the main method out of it. This way, you can instantiate a new robot and use it as a variable in a ROS class.

    What I mean:

    First class:

    • PlayerLaser (inherits player)
      • starts player (from inherited methods)
      • has laser messages (now laser is an object)

    Second class:

    • RosLaser
      • Has methods to get laser data.
      • Has a return method
    • In your main method (separate entity):
      • create a ROS publisher
      • create a Robot (or PlayerLaser)
      • have a RosLaser::getLaserMessage() function that returns the ROS laser type
      • publish the method

    There are some examples with a player class on my github. As for a ROS class, look here.