ravi-more / reactjs-ros-robot-control-console-web

MIT License
5 stars 0 forks source link

Robot arrow on map #2

Closed akshat209141 closed 3 months ago

akshat209141 commented 4 months ago

Hey , your code does not contain that feature which you have shown in your video, the arrow representing the robot while we move the robot is not showing.

ravi-more commented 4 months ago

MapView Component

This component, located at src/components/mapview.jsx, is utilized to display a map with a pointer.

// mapView - method is responsible for displaying the map and a pointer 
mapView(){
        if(this.state.connected === true){
                try {
                    this.viewer2 = new window.ROS2D.Viewer({
                               divID : 'nav',
                               width : 750,
                               height : 550
                             });
                    // eslint-disable-next-line
                    this.state.nav = window.NAV2D.OccupancyGridClientNav({
                        ros : this.state.ros,
                        rootObject : this.viewer2.scene,
                        viewer : this.viewer2,
                        serverName : '/move_base',
                        topic : "/map"
                        });

                    console.log("Nav setup complete")
                } catch (error) {
                    console.log("Nav error");
                    console.log(error);
                }
         }
    }

All the necessary libraries are included in public/index.html in the head tag as follows:

<script src="./js/eventemitter2.min.js"></script>
<script src="./js/roslib.js"></script>
<script src="./js/ease1js.js"></script>
<script src="./js/mjpegcanvas.min.js"></script>
<script src="./js/ros2d.js"></script>
<script src="./js/nav2d.min.js"></script>
ravi-more commented 3 months ago

I am closing this issue now. Hope this will help!