How to use the dotmap.DotMap function in dotmap

To help you get started, we’ve selected a few dotmap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smlbansal / Visual-Navigation-Release / tests / test_spline.py View on Github external
goal_pos_nk2 = tf.concat([goal_posx_nk1, goal_posy_nk1], axis=2)
    goal_heading_nk1 = tf.ones((n, 1, 1), dtype=tf.float32) * target_state[2]
    goal_speed_nk1 = tf.ones((n, 1, 1), dtype=tf.float32) * vf

    start_config = SystemConfig(dt, n, 1, speed_nk1=start_speed_nk1, variable=False)
    goal_config = SystemConfig(dt, n, 1, position_nk2=goal_pos_nk2,
                               speed_nk1=goal_speed_nk1, heading_nk1=goal_heading_nk1,
                               variable=True)

    start_nk5 = start_config.position_heading_speed_and_angular_speed_nk5()
    start_n5 = start_nk5[:, 0]

    goal_nk5 = goal_config.position_heading_speed_and_angular_speed_nk5()
    goal_n5 = goal_nk5[:, 0]

    p = DotMap(spline_params=DotMap(epsilon=1e-5))
    ts_nk = tf.tile(tf.linspace(0., dt*k, k)[None], [n, 1])
    spline_traj = Spline3rdOrder(dt=dt, k=k, n=n, params=p.spline_params)
    spline_traj.fit(start_config, goal_config, factors=None)
    spline_traj.eval_spline(ts_nk, calculate_speeds=True)

    pos_nk3 = spline_traj.position_and_heading_nk3()
    v_nk1 = spline_traj.speed_nk1()
    start_pos_diff = (pos_nk3 - start_n5[:, None, :3])[:, 0]
    goal_pos_diff = (pos_nk3 - goal_n5[:, None, :3])[:, -1]
    assert(np.allclose(start_pos_diff, np.zeros((n, 3)), atol=1e-6))
    assert(np.allclose(goal_pos_diff, np.zeros((n, 3)), atol=1e-6))

    start_vel_diff = (v_nk1 - start_n5[:, None, 3:4])[:, 0]
    goal_vel_diff = (v_nk1 - goal_n5[:, None, 3:4])[:, -1]
    assert(np.allclose(start_vel_diff, np.zeros((n, 1)), atol=1e-6))
    assert(np.allclose(goal_vel_diff, np.zeros((n, 1)), atol=1e-6))
github smlbansal / Visual-Navigation-Release / tests / test_dynamics.py View on Github external
def create_system_dynamics_params():
    p = DotMap()

    p.v_bounds = [0.0, .6]
    p.w_bounds = [-1.1, 1.1]

    p.simulation_params = DotMap(simulation_mode='ideal',
                                 noise_params = DotMap(is_noisy=False,
                                                       noise_type='uniform',
                                                       noise_lb=[-0.02, -0.02, 0.],
                                                       noise_ub=[0.02, 0.02, 0.],
                                                       noise_mean=[0., 0., 0.],
                                                       noise_std=[0.02, 0.02, 0.]))
    return p
github smlbansal / Visual-Navigation-Release / tests / test_goal_angle_objective.py View on Github external
def create_params():
    p = DotMap()
    # Angle Distance parameters
    p.goal_angle_objective = DotMap(power=1,
                                    angle_cost=25.0)
    p.obstacle_map_params = DotMap(obstacle_map=SBPDMap,
                                   map_origin_2=[0., 0.],
                                   sampling_thres=2,
                                   plotting_grid_steps=100)
    p.obstacle_map_params.renderer_params = create_renderer_params()

    return p
github smlbansal / Visual-Navigation-Release / tests / test_data_gen.py View on Github external
p = DotMap()
    p.seed = 1
    p.n = 1
    p.k = 15
    p.map_bounds = [[-2.0, -2.0], [2.0, 2.0]]
    p.dx, p.dt = .05, .1
      
    p.lqr_coeffs = DotMap({'quad' : [1.0, 1.0, 1.0, 1e-10, 1e-10],
                                    'linear' : [0.0, 0.0, 0.0, 0.0, 0.0]})
    p.ctrl = 1.

    p.avoid_obstacle_objective = DotMap(obstacle_margin=0.3,
                                        power=2,
                                        obstacle_cost=25.0)
    # Angle Distance parameters
    p.goal_angle_objective = DotMap(power=1,
                                    angle_cost=25.0)
    # Goal Distance parameters
    p.goal_distance_objective = DotMap(power=2,
                                       goal_cost=25.0)

    return p
github smlbansal / Visual-Navigation-Release / params / renderer_params.py View on Github external
def create_params():
    p = DotMap()
    p.dataset_name = 'sbpd'
    p.building_name = 'area4'
    p.flip = False

    p.camera_params = DotMap(modalities=['occupancy_grid'],  # occupancy_grid, rgb, or depth
                             width=64,
                             height=64,  # the remaining params are for rgb and depth only
                             z_near=.01,
                             z_far=20.0,
                             fov_horizontal=90.,
                             fov_vertical=90.,
                             img_channels=3,
                             im_resize=1.)
    
    # The robot is modeled as a solid cylinder
    # of height, 'height', with radius, 'radius',
github smlbansal / Visual-Navigation-Release / params / system_dynamics / turtlebot_dubins_v2_params.py View on Github external
def create_params():
    p = DotMap()
    p.system = TurtlebotDubinsV2
    p.dt = .05
    p.v_bounds = [0.0, .6]
    p.w_bounds = [-1.1, 1.1]

    # Set the acceleration bounds such that
    # by default they are never hit
    p.linear_acc_max = 10e7
    p.angular_acc_max = 10e7

    p.simulation_params = DotMap(simulation_mode='realistic',
                                 noise_params = DotMap(is_noisy=False,
                                                       noise_type='uniform',
                                                       noise_lb=[-0.02, -0.02, 0.],
                                                       noise_ub=[0.02, 0.02, 0.],
                                                       noise_mean=[0., 0., 0.],
github quanvuong / handful-of-trials-pytorch / config / default.py View on Github external
# Add possible overrides
    type_map.ctrl_cfg.prop_cfg.model_init_cfg.model_dir = str
    type_map.ctrl_cfg.prop_cfg.model_init_cfg.load_model = make_bool

    type_map.ctrl_cfg.prop_cfg.model_train_cfg = DotMap(
        batch_size=int, epochs=int,
        holdout_ratio=float, max_logging=int
    )

    ctrl_cfg.prop_cfg.mode = "TSinf"
    ctrl_cfg.prop_cfg.npart = 20
    # Finish setting model class

    # Setting MPC cfg
    ctrl_cfg.opt_cfg.mode = "CEM"
    type_map.ctrl_cfg.opt_cfg.cfg = DotMap(
        max_iters=int,
        popsize=int,
        num_elites=int,
        epsilon=float,
        alpha=float
    )
    ctrl_cfg.opt_cfg.cfg = cfg_module.OPT_CFG[ctrl_cfg.opt_cfg.mode]
github ConvLab / ConvLab / convlab / modules / word_dst / multiwoz / sumbt / sumbt_config.py View on Github external
from dotmap import DotMap


args = DotMap()

args.max_label_length = 32
args.max_turn_length = 22
args.hidden_dim = 100
args.num_rnn_layers = 1
args.zero_init_rnn = False
args.attn_head = 4
args.do_eval = True
args.do_train = False
args.do_lower_case = False
args.distance_metric = 'cosine'
args.train_batch_size = 4
args.dev_batch_size = 1
args.eval_batch_size  = 16
args.learning_rate = 5e-5
args.num_train_epochs = 3
github unsuthee / VariationalDeepSemanticHashing / utils.py View on Github external
def Load_Dataset(filename):
    dataset = scipy.io.loadmat(filename)
    x_train = dataset['train']
    x_test = dataset['test']
    x_cv = dataset['cv']
    y_train = dataset['gnd_train']
    y_test = dataset['gnd_test']
    y_cv = dataset['gnd_cv']
    
    data = DotMap()
    data.n_trains = y_train.shape[0]
    data.n_tests = y_test.shape[0]
    data.n_cv = y_cv.shape[0]
    data.n_tags = y_train.shape[1]
    data.n_feas = x_train.shape[1]

    ## Convert sparse to dense matricesimport numpy as np
    train = x_train.toarray()
    nz_indices = np.where(np.sum(train, axis=1) > 0)[0]
    train = train[nz_indices, :]
    train_len = np.sum(train > 0, axis=1)

    test = x_test.toarray()
    test_len = np.sum(test > 0, axis=1)

    cv = x_cv.toarray()
github smlbansal / Visual-Navigation-Release / params / simulator / simulator_params.py View on Github external
# Define the Objectives

    # Obstacle Avoidance Objective
    p.avoid_obstacle_objective = DotMap(obstacle_margin0=0.3,
                                        obstacle_margin1=0.5,
                                        power=3,
                                        obstacle_cost=1.0)
    # Angle Distance parameters
    p.goal_angle_objective = DotMap(power=1,
                                    angle_cost=.008)
    # Goal Distance parameters
    p.goal_distance_objective = DotMap(power=2,
                                       goal_cost=.08,
                                       goal_margin=.3)

    p.objective_fn_params = DotMap(obj_type='valid_mean')
    p.reset_params = DotMap(
                            obstacle_map=DotMap(reset_type='random',
                                                params=DotMap(min_n=4, max_n=7,
                                                              min_r=.3, max_r=.8)),
                            start_config=DotMap(
                                                position=DotMap(
                                                    # There could be different reset types
                                                    # 'random': the position is initialized randomly on the
                                                    # map but at least at a distance of the obstacle margin from the
                                                    # obstacle.
                                                    reset_type='random'
                                                ),
                                                heading=DotMap(
                                                    # 'zero': the heading is initialized to zero.
                                                    # 'random': the heading is initialized randomly within the given
                                                    # bounds.

dotmap

ordered, dynamically-expandable dot-access dictionary

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages