how to subscribe image use javascript

asked 2021-10-21 04:22:06 -0500

hyebin gravatar image

https://www.theconstructsim.com/devel...

I created index.html and main.js files according to this guideline.

The method of publishing cmd_vel is as follows.(in main.js)

    setTopic: function() {
        this.topic_cmd_vel = new ROSLIB.Topic({
            ros: this.ros,
            name: '/rail_robot/drive_controller/cmd_vel',
            messageType: 'geometry_msgs/Twist'
        })
    },            

    forward: function() {
        this.message = new ROSLIB.Message({
            linear: { x: 1, y: 0, z: 0, },
            angular: { x: 0, y: 0, z: 0, },
        })
        this.setTopic()
        this.topic_cmd_vel.publish(this.message)
    },

I want to subscribe to the image like this code form. And I want to post the image I've received on web. The code below is the code of index.html.

<img src="">

index.html is reading main.js like below:

<script type="text/javascript" src="main.js">

</script>

How can I do the subscription and show the image?

edit retag flag offensive close merge delete