Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find equivalent or simulate a way to log info to ROS from roslibjs #211

Closed
6 tasks done
MartensCedric opened this issue Nov 9, 2019 · 4 comments · Fixed by #299
Closed
6 tasks done

Find equivalent or simulate a way to log info to ROS from roslibjs #211

MartensCedric opened this issue Nov 9, 2019 · 4 comments · Fixed by #299
Assignees

Comments

@MartensCedric
Copy link
Collaborator

MartensCedric commented Nov 9, 2019

Find a way to log front end logs into ros to mimic the rospy logging behaviour:

  • Check in roslibjs library for preexisting ROS logging functions (none exist)
  • Create roslibjs issue related to logging (so far only one reply saying to publish to /rosout)
  • Implement logging js functions
    • Find definition for ROS log messages
    • Figure out how/what data to generate for each data element
    • Implement functions in ros_helpers.js
@PeterGhimself
Copy link
Member

I think if we simply create a publisher to the topic /rosout it should have the same effect, though that might mean we have to format the message properly ourselves.

@joshua-glazer
Copy link
Member

joshua-glazer commented Feb 7, 2020

here's the roslibjs web documentation for reference, although I don't see anything about ROS logging. I just made an issue in the roslibjs repo 😎 about it. Perhaps it's an opportunity to contribute to open source?

@joshua-glazer
Copy link
Member

I managed to publish a message to /rosout from within the GUI but there's a bunch of data in the /rosgraph_msgs/Log message type that I don't yet know how to generate. If we want to do it nicely we could make the logwarn, logerr, loginfo etc functions just like you can do in rospy.

Here's my code. As you can see based on the message definition, when I created the message I left out a lot of data. I imagine that will have an impact on how ROS actually understands the log message and I'm not sure how much is necessary for it to work correctly (possibly all of it) but I don't know how to generate all the data that's in the definition.

ros_logger = new ROSLIB.Topic({
    ros: ros,
    name: 'rosout',
    messageType: 'rosgraph_msgs/Log'
  })
log_msg = new ROSLIB.Message({
    level:2,
    msg:"hello from the gui"
})
ros_logger.publish(log_msg)

@joshua-glazer
Copy link
Member

joshua-glazer commented Feb 10, 2020

we could make it like:

// Severity level constants
// DEBUG=1 // debug level
// INFO=2  // general level
// WARN=4  // warning level
// ERROR=8 // error level
// FATAL=16 // fatal/critical level

function loginfo(message) {
    ros_logger.publish(
        new ROSLIB.Message({
            level : 2, // INFO
            msg : message
        })
    )
}

or something

@joshua-glazer joshua-glazer self-assigned this Feb 10, 2020
joshua-glazer added a commit that referenced this issue Feb 10, 2020
joshua-glazer added a commit that referenced this issue Feb 11, 2020
@joshua-glazer joshua-glazer mentioned this issue Feb 11, 2020
6 tasks
joshua-glazer added a commit that referenced this issue Feb 13, 2020
Co-authored-by: MartensCedric <cedricmartens98@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants