Skip to content

Robotarium constructor shows incorrect robot poses at startup #24

@PhilipLoewen

Description

@PhilipLoewen

Here is a minimum working example to illustrate the issue in the title. Just run it. The input commands will cause the console to pause twice while you inspect the plot window.

# 2024-10-06 [PDL] - test Robotarium constructor
#
import rps.robotarium as robotarium
from rps.utilities.transformations import *
from rps.utilities.barrier_certificates import *
from rps.utilities.misc import *
from rps.utilities.controllers import *

import numpy as np
import time

N = 1    # Number of robots ... this is a solo experiment.

theta = 0.25 * np.pi   # Initial orientation angle. Edit as desired.
initial_conditions = np.array([0.,0.,theta]).reshape(3,1)

roboscheme = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions,sim_in_real_time=False)

canvas = roboscheme.axes
canvas.set_aspect('equal')
canvas.plot([0.,0.],[-1.,1.],color="#FFAACCEE",linestyle="dashed")
canvas.plot([-1.6,1.6],[0.,0.],color="#FFAACCEE",linestyle="dashed")

notes = canvas.text(0.0,-0.4,"The Robotarium constructor draws the robot parts in the wrong places.",
                    horizontalalignment='center')

input("Press Enter to take one null step.")

_ = roboscheme.get_poses()
roboscheme.set_velocities(np.arange(N),np.zeros((2,1)))
roboscheme.step()
notes.set(text="After one null step, the robot is drawn correctly.")

input("Press Enter to finish simulation.")
roboscheme.call_at_scripts_end()

It looks like the drawing commands in the file robotarium_abc.py got reworked in the file robotarium.py. Calling step() activates the commands in the second file, but before that the plot shows the results of the incorrect commands in the first file. The code blocks of interest start with if(self.show_figure): in both cases.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions