CaSSandRa Perimeter recording mode.

bernard

Well-known member
Today i try to create a new map using Cassandra but something is strange :

I use a PC as client.
PI is locate inside the mower and comm is in UART mode.

Each time i click on add Point the remote control windows is closed and i need to open it again and again at each new point.
Is it normal or possible to add the add point button directly inside the remote control.
1711978887959.png

Also something else mower icon in the map is not refresh very fast and click on add point take 2s to be active ,where is the code part for this ?
I see the AT+S command is normaly send each 1s but why did you add the line: time.sleep(2*time_to_wait)
Code:
 time_to_wait = 1
    data_clean_finished = False
    time.sleep(2*time_to_wait)
1711979319078.png
 
Code:
def add_point(self, create: str) -> None:
        try:
            if not self.build.empty and not self.build[self.build['type'] == 'edit'].empty:
                logger.debug('Add point to existing figure')
                line = LineString(self.build[self.build['type'] == 'edit'][['X', 'Y']])
                point = Point(self.selected_point[['X', 'Y']])
                line_coords = list(line.coords)
                point_coords = list(point.coords)
                ###Remove double values###
                line_coords = list(dict.fromkeys(line_coords))
                ###Look for shortest way from selected point###
                first_coords = [min(line_coords, key=lambda coord: (coord[0]-point_coords[0][0])**2 + (coord[1]-point_coords[0][1])**2)]
                first_coords_nr = line_coords.index(first_coords[0])
                if first_coords_nr <= (len(line_coords)-2):
                    second_coords = line_coords[first_coords_nr + 1]
                else:
                    second_coords = line_coords[0]
                new_line = LineString([first_coords[0], second_coords])
                new_point = new_line.interpolate(new_line.length/2)
                logger.debug('New point coordinates: '+str(list(new_point.coords)))
                new_coords = line_coords[:first_coords_nr+1]
                new_coords.extend(list(new_point.coords))
                new_coords = new_coords + line_coords[first_coords_nr+1:]
                x, y = zip(*new_coords)
                self.build = self.build[self.build['type'] != 'edit']
                new_edit = {'X': x, 'Y': y}
                new_edit = pd.DataFrame(new_edit)
                if self.selected_name == 'dockpoints':
                    self.dockpoints = new_edit
                new_edit['type'] = 'edit'
                self.build = pd.concat([self.build, new_edit], ignore_index=True)
            else:
                logger.debug('Add point: '+str(robot.position_x)+' '+str(robot.position_y))
                #remove unfinished figure
                if create != 'figure' and not self.build.empty:
                    logger.debug('Mapping remove unfinished figure')
                    self.build = self.build[self.build['type'] != 'figure']
                #create point and add to data frame
                point = {'X': [robot.position_x], 'Y': [robot.position_y], 'type': [create]}
                df = pd.DataFrame(point)
                logger.debug('Moved data to data frame: '+str(point))
                df.columns = ['X', 'Y', 'type']
                self.build = pd.concat([self.build, df], ignore_index=True)
        except Exception as e:
            logger.error('Backend: Add point not possible')
            logger.debug(str(e))

In src/backend/data/mapdata.py
 
Is it normal or possible to add the add point button directly inside the remote control.
Unfortunately it is current the way how to add point


Also something else mower icon in the map is not refresh very fast and click on add point take 2s to be active ,where is the code part for this ?
Try to remove 3 from 3*1000
Code:
dcc.Interval(id=ids.MAPPINGINTERVAL, interval=3*1000, n_intervals=0, disabled=True)

in src/layout.py to increase update frequency in mapping mode
 
Zuletzt bearbeitet:
In src/backend/data/mapdata.py
At the end of the point adding is it possible to automatically reopen the remote control windows
Unfortunatly i don't know how to do (It's not true python or C++) ??

Code:
                  df = pd.DataFrame(point)
                logger.debug('Moved data to data frame: '+str(point))
                df.columns = ['X', 'Y', 'type']
                self.build = pd.concat([self.build, df], ignore_index=True)
                
                ADD CODE HERE TO REOPEN THE Remote control window
                
                
                
                
        except Exception as e:
 
At the end of the point adding is it possible to automatically reopen the remote control windows
Unfortunatly i don't know how to do (It's not true python or C++) ??
Backend is the wrong place to control UI components.

To do that you have make changes in components directory. Remote control is offcanvas.py
At the end of the file (row 124) you will find the callback for open control of offcanvas. If you add ids.BUTTONADDNEWPOINT to this callback you can implement a logic to reopen the remote control
 
Oben